mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 08:00:54 +00:00
fix 4219
This commit is contained in:
parent
6bbca96c6c
commit
b575fa1ebe
@ -89,7 +89,7 @@ func (input *BeegoInput) URI() string {
|
||||
|
||||
// URL returns the request url path (without query, string and fragment).
|
||||
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.
|
||||
|
@ -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) {
|
||||
|
||||
r, _ := http.NewRequest("GET", "/person/anderson/thomas?learn=kungfu", nil)
|
||||
|
Loading…
Reference in New Issue
Block a user