mirror of https://github.com/gofiber/fiber.git
commit
96d5286e9d
2
ctx.go
2
ctx.go
|
@ -604,7 +604,7 @@ func (ctx *Ctx) Method(override ...string) string {
|
|||
if len(override) > 0 {
|
||||
method := utils.ToUpper(override[0])
|
||||
mINT := methodInt(method)
|
||||
if mINT == 0 && method != MethodGet {
|
||||
if mINT == -1 {
|
||||
return ctx.method
|
||||
}
|
||||
ctx.method = method
|
||||
|
|
|
@ -622,6 +622,9 @@ func Test_Ctx_Method(t *testing.T) {
|
|||
utils.AssertEqual(t, MethodGet, ctx.Method())
|
||||
ctx.Method(MethodPost)
|
||||
utils.AssertEqual(t, MethodPost, ctx.Method())
|
||||
|
||||
ctx.Method("MethodInvalid")
|
||||
utils.AssertEqual(t, MethodPost, ctx.Method())
|
||||
}
|
||||
|
||||
// go test -run Test_Ctx_MultipartForm
|
||||
|
|
Loading…
Reference in New Issue