mirror of
https://github.com/labstack/echo.git
synced 2024-12-22 20:06:21 +02:00
7741bd0125
Signed-off-by: Vishal Rana <vr@labstack.com>
47 lines
1018 B
Go
47 lines
1018 B
Go
// +build !appengine
|
|
|
|
package fasthttp
|
|
|
|
import "github.com/valyala/fasthttp"
|
|
|
|
type (
|
|
// URL implements `engine.URL`.
|
|
URL struct {
|
|
*fasthttp.URI
|
|
}
|
|
)
|
|
|
|
// Path implements `engine.URL#Path` function.
|
|
func (u *URL) Path() string {
|
|
return string(u.URI.Path())
|
|
}
|
|
|
|
// SetPath implements `engine.URL#SetPath` function.
|
|
func (u *URL) SetPath(path string) {
|
|
u.URI.SetPath(path)
|
|
}
|
|
|
|
// QueryParam implements `engine.URL#QueryParam` function.
|
|
func (u *URL) QueryParam(name string) string {
|
|
return string(u.QueryArgs().Peek(name))
|
|
}
|
|
|
|
// 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
|
|
}
|
|
|
|
// QueryString implements `engine.URL#QueryString` function.
|
|
func (u *URL) QueryString() string {
|
|
return string(u.URI.QueryString())
|
|
}
|
|
|
|
func (u *URL) reset(uri *fasthttp.URI) {
|
|
u.URI = uri
|
|
}
|