2016-02-09 11:43:00 -08:00
|
|
|
// +build !appengine
|
|
|
|
|
2016-01-28 23:46:11 -08:00
|
|
|
package fasthttp
|
|
|
|
|
|
|
|
import "github.com/valyala/fasthttp"
|
|
|
|
|
|
|
|
type (
|
2016-03-14 19:58:46 -07:00
|
|
|
// URL implements `engine.URL`.
|
2016-01-28 23:46:11 -08:00
|
|
|
URL struct {
|
2016-03-10 12:05:33 -08:00
|
|
|
*fasthttp.URI
|
2016-01-28 23:46:11 -08:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2016-03-19 15:47:20 -07:00
|
|
|
// Path implements `engine.URL#Path` function.
|
2016-01-28 23:46:11 -08:00
|
|
|
func (u *URL) Path() string {
|
2016-03-10 12:05:33 -08:00
|
|
|
return string(u.URI.Path())
|
2016-01-28 23:46:11 -08:00
|
|
|
}
|
|
|
|
|
2016-03-19 15:47:20 -07:00
|
|
|
// SetPath implements `engine.URL#SetPath` function.
|
2016-03-14 19:58:46 -07:00
|
|
|
func (u *URL) SetPath(path string) {
|
2016-03-14 23:33:16 -07:00
|
|
|
u.URI.SetPath(path)
|
2016-03-14 19:58:46 -07:00
|
|
|
}
|
|
|
|
|
2016-03-21 13:10:20 -07:00
|
|
|
// QueryParam implements `engine.URL#QueryParam` function.
|
|
|
|
func (u *URL) QueryParam(name string) string {
|
2016-03-14 23:33:16 -07:00
|
|
|
return string(u.QueryArgs().Peek(name))
|
2016-01-28 23:46:11 -08:00
|
|
|
}
|
2016-02-20 14:04:09 -08:00
|
|
|
|
2016-03-23 11:10:22 -05:00
|
|
|
// QueryParams implements `engine.URL#QueryParams` function.
|
|
|
|
func (u *URL) QueryParams() (params map[string][]string) {
|
|
|
|
params = make(map[string][]string)
|
|
|
|
u.QueryArgs().VisitAll(func(k, v []byte) {
|
|
|
|
// TODO: Filling with only first value
|
|
|
|
params[string(k)] = []string{string(v)}
|
|
|
|
})
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2016-03-19 15:47:20 -07:00
|
|
|
// QueryString implements `engine.URL#QueryString` function.
|
2016-03-15 08:50:43 -07:00
|
|
|
func (u *URL) QueryString() string {
|
|
|
|
return string(u.URI.QueryString())
|
|
|
|
}
|
|
|
|
|
2016-03-10 12:05:33 -08:00
|
|
|
func (u *URL) reset(uri *fasthttp.URI) {
|
|
|
|
u.URI = uri
|
2016-02-21 19:58:19 -08:00
|
|
|
}
|