mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 09:50:55 +00:00
commit
5973ef107c
@ -89,7 +89,7 @@ func (input *BeegoInput) URI() string {
|
|||||||
|
|
||||||
// URL returns the request url path (without query, string and fragment).
|
// URL returns the request url path (without query, string and fragment).
|
||||||
func (input *BeegoInput) URL() string {
|
func (input *BeegoInput) URL() string {
|
||||||
return input.Context.Request.URL.EscapedPath()
|
return input.Context.Request.URL.Path
|
||||||
}
|
}
|
||||||
|
|
||||||
// Site returns the base site url as scheme://domain type.
|
// Site returns the base site url as scheme://domain type.
|
||||||
|
@ -212,6 +212,23 @@ func TestAutoExtFunc(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestEscape(t *testing.T) {
|
||||||
|
|
||||||
|
r, _ := http.NewRequest("GET", "/search/%E4%BD%A0%E5%A5%BD", nil)
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
|
||||||
|
handler := NewControllerRegister()
|
||||||
|
handler.Get("/search/:keyword(.+)", func(ctx *context.Context) {
|
||||||
|
value := ctx.Input.Param(":keyword")
|
||||||
|
ctx.Output.Body([]byte(value))
|
||||||
|
})
|
||||||
|
handler.ServeHTTP(w, r)
|
||||||
|
str := w.Body.String()
|
||||||
|
if str != "你好" {
|
||||||
|
t.Errorf("incorrect, %s", str)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestRouteOk(t *testing.T) {
|
func TestRouteOk(t *testing.T) {
|
||||||
|
|
||||||
r, _ := http.NewRequest("GET", "/person/anderson/thomas?learn=kungfu", nil)
|
r, _ := http.NewRequest("GET", "/person/anderson/thomas?learn=kungfu", nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user