2016-02-09 21:43:00 +02:00
|
|
|
// +build !appengine
|
|
|
|
|
2016-01-29 09:46:11 +02:00
|
|
|
package fasthttp
|
|
|
|
|
|
|
|
import "github.com/valyala/fasthttp"
|
|
|
|
|
|
|
|
type (
|
2016-03-15 04:58:46 +02:00
|
|
|
// URL implements `engine.URL`.
|
2016-01-29 09:46:11 +02:00
|
|
|
URL struct {
|
2016-03-10 22:05:33 +02:00
|
|
|
*fasthttp.URI
|
2016-01-29 09:46:11 +02:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2016-03-20 00:47:20 +02:00
|
|
|
// Path implements `engine.URL#Path` function.
|
2016-01-29 09:46:11 +02:00
|
|
|
func (u *URL) Path() string {
|
2016-03-10 22:05:33 +02:00
|
|
|
return string(u.URI.Path())
|
2016-01-29 09:46:11 +02:00
|
|
|
}
|
|
|
|
|
2016-03-20 00:47:20 +02:00
|
|
|
// SetPath implements `engine.URL#SetPath` function.
|
2016-03-15 04:58:46 +02:00
|
|
|
func (u *URL) SetPath(path string) {
|
2016-03-15 08:33:16 +02:00
|
|
|
u.URI.SetPath(path)
|
2016-03-15 04:58:46 +02:00
|
|
|
}
|
|
|
|
|
2016-03-21 22:10:20 +02:00
|
|
|
// QueryParam implements `engine.URL#QueryParam` function.
|
|
|
|
func (u *URL) QueryParam(name string) string {
|
2016-03-15 08:33:16 +02:00
|
|
|
return string(u.QueryArgs().Peek(name))
|
2016-01-29 09:46:11 +02:00
|
|
|
}
|
2016-02-21 00:04:09 +02:00
|
|
|
|
2016-03-23 18:10:22 +02: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-20 00:47:20 +02:00
|
|
|
// QueryString implements `engine.URL#QueryString` function.
|
2016-03-15 17:50:43 +02:00
|
|
|
func (u *URL) QueryString() string {
|
|
|
|
return string(u.URI.QueryString())
|
|
|
|
}
|
|
|
|
|
2016-03-10 22:05:33 +02:00
|
|
|
func (u *URL) reset(uri *fasthttp.URI) {
|
|
|
|
u.URI = uri
|
2016-02-22 05:58:19 +02:00
|
|
|
}
|