1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 09:50:55 +00:00

Merge pull request #4221 from flycash/ftr/log_format

fix 4219
This commit is contained in:
Ming Deng 2020-09-12 00:02:51 +08:00 committed by GitHub
commit 5973ef107c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 13 deletions

View File

@ -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.

View File

@ -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)