1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 18:37:05 +00:00

fix #2158 and more

This commit is contained in:
Gerasimos (Makis) Maropoulos
2023-07-08 02:08:18 +03:00
parent 757e7fe61b
commit 6add1ba49b
79 changed files with 551 additions and 467 deletions

View File

@@ -49,28 +49,28 @@ func TestMethodOverrideWrapper(t *testing.T) {
// Test headers.
e.POST("/path").WithHeader("X-HTTP-Method", iris.MethodDelete).Expect().
Status(iris.StatusOK).Body().Equal(expectedDelResponse)
Status(iris.StatusOK).Body().IsEqual(expectedDelResponse)
e.POST("/path").WithHeader("X-HTTP-Method-Override", iris.MethodDelete).Expect().
Status(iris.StatusOK).Body().Equal(expectedDelResponse)
Status(iris.StatusOK).Body().IsEqual(expectedDelResponse)
e.POST("/path").WithHeader("X-Method-Override", iris.MethodDelete).Expect().
Status(iris.StatusOK).Body().Equal(expectedDelResponse)
Status(iris.StatusOK).Body().IsEqual(expectedDelResponse)
// Test form field value.
e.POST("/path").WithFormField("_method", iris.MethodDelete).Expect().
Status(iris.StatusOK).Body().Equal(expectedDelResponse)
Status(iris.StatusOK).Body().IsEqual(expectedDelResponse)
// Test URL Query (although it's the same as form field in this case).
e.POST("/path").WithQuery("_method", iris.MethodDelete).Expect().
Status(iris.StatusOK).Body().Equal(expectedDelResponse)
Status(iris.StatusOK).Body().IsEqual(expectedDelResponse)
// Test saved original method and
// Test without registered "POST" route.
e.POST("/path2").WithQuery("_method", iris.MethodDelete).Expect().
Status(iris.StatusOK).Body().Equal(expectedDelResponse + iris.MethodPost)
Status(iris.StatusOK).Body().IsEqual(expectedDelResponse + iris.MethodPost)
// Test simple POST request without method override fields.
e.POST("/path").Expect().Status(iris.StatusOK).Body().Equal(expectedPostResponse)
e.POST("/path").Expect().Status(iris.StatusOK).Body().IsEqual(expectedPostResponse)
// Test simple DELETE request.
e.DELETE("/path").Expect().Status(iris.StatusOK).Body().Equal(expectedDelResponse)
e.DELETE("/path").Expect().Status(iris.StatusOK).Body().IsEqual(expectedDelResponse)
}