mirror of
https://github.com/kataras/iris.git
synced 2025-12-19 02:47:04 +00:00
fix #2158 and more
This commit is contained in:
@@ -124,7 +124,7 @@ func TestControllerHandle(t *testing.T) {
|
||||
e := httptest.New(t, app)
|
||||
|
||||
// test the index, is not part of the current package's implementation but do it.
|
||||
e.GET("/").Expect().Status(httptest.StatusOK).Body().Equal("index")
|
||||
e.GET("/").Expect().Status(httptest.StatusOK).Body().IsEqual("index")
|
||||
|
||||
// the important things now.
|
||||
|
||||
@@ -133,30 +133,30 @@ func TestControllerHandle(t *testing.T) {
|
||||
// (which is the function's receiver, if any, in this case the *testController in go).
|
||||
expectedReqField := "this is a request field filled by this url param"
|
||||
e.GET("/histatic").WithQuery("reqfield", expectedReqField).Expect().Status(httptest.StatusOK).
|
||||
Body().Equal(expectedReqField)
|
||||
Body().IsEqual(expectedReqField)
|
||||
// this test makes sure that the binded values of the controller is handled correctly
|
||||
// and can be used in a user-defined, dynamic "mvc handler".
|
||||
e.GET("/hiservice").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("service: hi")
|
||||
Body().IsEqual("service: hi")
|
||||
e.GET("/hiservice/value").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("service: hi with param: value")
|
||||
Body().IsEqual("service: hi with param: value")
|
||||
// this worked with a temporary variadic on the resolvemethodfunc which is not
|
||||
// correct design, I should split the path and params with the rest of implementation
|
||||
// in order a simple template.Src can be given.
|
||||
e.GET("/hiparam/value").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("value")
|
||||
Body().IsEqual("value")
|
||||
e.GET("/hiparamempyinput/value").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("empty in but served with ctx.Params.Get('ps')=value")
|
||||
Body().IsEqual("empty in but served with ctx.Params.Get('ps')=value")
|
||||
e.GET("/custom/value1").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("value1")
|
||||
Body().IsEqual("value1")
|
||||
e.GET("/custom2/value2").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("value2")
|
||||
Body().IsEqual("value2")
|
||||
e.GET("/custom3/value1/value2").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("value1value2")
|
||||
Body().IsEqual("value1value2")
|
||||
e.GET("/custom3/value1").Expect().Status(httptest.StatusNotFound)
|
||||
|
||||
e.GET("/hi/param/empty/input/with/ctx/value").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("empty in but served with ctx.Params.Get('param2')= value == id == value")
|
||||
Body().IsEqual("empty in but served with ctx.Params.Get('param2')= value == id == value")
|
||||
}
|
||||
|
||||
type testControllerHandleWithDynamicPathPrefix struct {
|
||||
@@ -173,7 +173,7 @@ func TestControllerHandleWithDynamicPathPrefix(t *testing.T) {
|
||||
New(app.Party("/api/data/{model:string}/{action:string}")).Handle(new(testControllerHandleWithDynamicPathPrefix))
|
||||
e := httptest.New(t, app)
|
||||
e.GET("/api/data/mymodel/myaction/myid").Expect().Status(httptest.StatusOK).
|
||||
Body().Equal("mymodelmyactionmyid")
|
||||
Body().IsEqual("mymodelmyactionmyid")
|
||||
}
|
||||
|
||||
type testControllerGetBy struct{}
|
||||
@@ -195,7 +195,7 @@ func TestControllerGetByWithAllowMethods(t *testing.T) {
|
||||
|
||||
e := httptest.New(t, app)
|
||||
e.GET("/project/42").Expect().Status(httptest.StatusOK).
|
||||
JSON().Equal(&testCustomStruct{Age: 42, Name: "name"})
|
||||
JSON().IsEqual(&testCustomStruct{Age: 42, Name: "name"})
|
||||
e.POST("/project/42").Expect().Status(httptest.StatusOK)
|
||||
e.PUT("/project/42").Expect().Status(httptest.StatusMethodNotAllowed)
|
||||
}
|
||||
|
||||
@@ -74,32 +74,32 @@ func TestControllerMethodResult(t *testing.T) {
|
||||
e := httptest.New(t, app)
|
||||
|
||||
e.GET("/").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("Hello World!")
|
||||
Body().IsEqual("Hello World!")
|
||||
|
||||
e.GET("/with/status").Expect().Status(iris.StatusNotFound).
|
||||
Body().Equal("This page doesn't exist")
|
||||
Body().IsEqual("This page doesn't exist")
|
||||
|
||||
e.GET("/json").Expect().Status(iris.StatusOK).
|
||||
JSON().Equal(iris.Map{
|
||||
JSON().IsEqual(iris.Map{
|
||||
"name": "Iris",
|
||||
"age": 2,
|
||||
})
|
||||
|
||||
e.GET("/json").WithQuery("err", true).Expect().
|
||||
Status(iris.StatusBadRequest).
|
||||
Body().Equal("error here")
|
||||
Body().IsEqual("error here")
|
||||
|
||||
e.GET("/thing/with/try/1").Expect().
|
||||
Status(iris.StatusOK).
|
||||
Body().Equal("thing 1")
|
||||
Body().IsEqual("thing 1")
|
||||
// failure because of index exceed the slice
|
||||
e.GET("/thing/with/try/3").Expect().
|
||||
Status(iris.StatusNotFound).
|
||||
Body().Equal("thing does not exist")
|
||||
Body().IsEqual("thing does not exist")
|
||||
|
||||
e.GET("/thing/with/try/default/3").Expect().
|
||||
Status(iris.StatusBadRequest).
|
||||
Body().Equal("Bad Request")
|
||||
Body().IsEqual("Bad Request")
|
||||
}
|
||||
|
||||
type testControllerMethodResultTypes struct {
|
||||
@@ -178,49 +178,49 @@ func TestControllerMethodResultTypes(t *testing.T) {
|
||||
e := httptest.New(t, app)
|
||||
|
||||
e.GET("/text").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("text")
|
||||
Body().IsEqual("text")
|
||||
|
||||
e.GET("/status").Expect().Status(iris.StatusBadGateway)
|
||||
|
||||
e.GET("/text/with/status/ok").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("OK")
|
||||
Body().IsEqual("OK")
|
||||
|
||||
e.GET("/status/with/text/not/ok/first/second").Expect().Status(iris.StatusForbidden).
|
||||
Body().Equal("NOT_OK_firstsecond")
|
||||
Body().IsEqual("NOT_OK_firstsecond")
|
||||
// Author's note: <-- if that fails means that the last binder called for both input args,
|
||||
// see path_param_binder.go
|
||||
|
||||
e.GET("/text/and/content/type").Expect().Status(iris.StatusOK).
|
||||
ContentType("text/html", "utf-8").
|
||||
Body().Equal("<b>text</b>")
|
||||
Body().IsEqual("<b>text</b>")
|
||||
|
||||
e.GET("/custom/response").Expect().Status(iris.StatusOK).
|
||||
ContentType("text/html", "utf-8").
|
||||
Body().Equal("<b>text</b>")
|
||||
Body().IsEqual("<b>text</b>")
|
||||
e.GET("/custom/response/with/status/ok").Expect().Status(iris.StatusOK).
|
||||
ContentType("text/html", "utf-8").
|
||||
Body().Equal("<b>OK</b>")
|
||||
Body().IsEqual("<b>OK</b>")
|
||||
e.GET("/custom/response/with/status/not/ok").Expect().Status(iris.StatusInternalServerError).
|
||||
ContentType("text/html", "utf-8").
|
||||
Body().Equal("<b>internal server error</b>")
|
||||
Body().IsEqual("<b>internal server error</b>")
|
||||
|
||||
expectedResultFromCustomStruct := map[string]interface{}{
|
||||
"name": "Iris",
|
||||
"age": 2,
|
||||
}
|
||||
e.GET("/custom/struct").Expect().Status(iris.StatusOK).
|
||||
JSON().Equal(expectedResultFromCustomStruct)
|
||||
JSON().IsEqual(expectedResultFromCustomStruct)
|
||||
e.GET("/custom/struct/with/status/not/ok").Expect().Status(iris.StatusInternalServerError).
|
||||
JSON().Equal(expectedResultFromCustomStruct)
|
||||
JSON().IsEqual(expectedResultFromCustomStruct)
|
||||
e.GET("/custom/struct/with/content/type").Expect().Status(iris.StatusOK).
|
||||
ContentType("text/xml", "utf-8")
|
||||
e.GET("/custom/struct/with/error").Expect().Status(iris.StatusOK).
|
||||
JSON().Equal(expectedResultFromCustomStruct)
|
||||
JSON().IsEqual(expectedResultFromCustomStruct)
|
||||
e.GET("/custom/struct/with/error").WithQuery("err", true).Expect().
|
||||
Status(iris.StatusBadRequest). // the default status code if error is not nil
|
||||
// the content should be not JSON it should be the status code's text
|
||||
// it will fire the error's text
|
||||
Body().Equal("omit return of testCustomStruct and fire error")
|
||||
Body().IsEqual("omit return of testCustomStruct and fire error")
|
||||
}
|
||||
|
||||
type testControllerViewResultRespectCtxViewData struct {
|
||||
|
||||
@@ -28,23 +28,23 @@ func TestControllerOverlap(t *testing.T) {
|
||||
}
|
||||
|
||||
e := httptest.New(t, app)
|
||||
e.GET("/user").Expect().Status(httptest.StatusUnauthorized).Body().Equal("unauth")
|
||||
e.GET("/user").Expect().Status(httptest.StatusUnauthorized).Body().IsEqual("unauth")
|
||||
// Test raw stop execution with a status code sent on the controller's method.
|
||||
e.GET("/user/with/status/on/method").Expect().Status(httptest.StatusBadRequest).Body().Equal("unauth")
|
||||
e.GET("/user/with/status/on/method").Expect().Status(httptest.StatusBadRequest).Body().IsEqual("unauth")
|
||||
// Test stop execution with status but last code sent through the controller's method.
|
||||
e.GET("/user/with/status/on/method/too").Expect().Status(httptest.StatusInternalServerError).Body().Equal("unauth")
|
||||
e.GET("/user/with/status/on/method/too").Expect().Status(httptest.StatusInternalServerError).Body().IsEqual("unauth")
|
||||
// Test raw stop execution and no status code sent on controller's method (should be OK).
|
||||
e.GET("/user/with/no/status").Expect().Status(httptest.StatusOK).Body().Equal("unauth")
|
||||
e.GET("/user/with/no/status").Expect().Status(httptest.StatusOK).Body().IsEqual("unauth")
|
||||
|
||||
// Test authenticated request.
|
||||
e.GET("/user").WithQuery("id", 42).Expect().Status(httptest.StatusOK).Body().Equal("auth: 42")
|
||||
e.GET("/user").WithQuery("id", 42).Expect().Status(httptest.StatusOK).Body().IsEqual("auth: 42")
|
||||
|
||||
// Test HandleHTTPError method accepts a not found and returns a 404
|
||||
// from a shared controller and overlapped, the url parameter matters because this method was overlapped.
|
||||
e.GET("/user/notfound").Expect().Status(httptest.StatusBadRequest).
|
||||
Body().Equal("error: *mvc_test.UnauthenticatedUserController: from: 404 to: 400")
|
||||
Body().IsEqual("error: *mvc_test.UnauthenticatedUserController: from: 404 to: 400")
|
||||
e.GET("/user/notfound").WithQuery("id", 42).Expect().Status(httptest.StatusBadRequest).
|
||||
Body().Equal("error: *mvc_test.AuthenticatedUserController: from: 404 to: 400")
|
||||
Body().IsEqual("error: *mvc_test.AuthenticatedUserController: from: 404 to: 400")
|
||||
}
|
||||
|
||||
type AuthenticatedTest uint64
|
||||
|
||||
@@ -82,13 +82,13 @@ func TestControllerMethodFuncs(t *testing.T) {
|
||||
for _, method := range router.AllMethods {
|
||||
|
||||
e.Request(method, "/").Expect().Status(iris.StatusOK).
|
||||
Body().Equal(method)
|
||||
Body().IsEqual(method)
|
||||
|
||||
e.Request(method, "/all").Expect().Status(iris.StatusOK).
|
||||
Body().Equal(method)
|
||||
Body().IsEqual(method)
|
||||
|
||||
e.Request(method, "/any").Expect().Status(iris.StatusOK).
|
||||
Body().Equal(method)
|
||||
Body().IsEqual(method)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,9 +137,9 @@ func TestControllerBeginAndEndRequestFunc(t *testing.T) {
|
||||
|
||||
for _, username := range usernames {
|
||||
e.GET("/profile/" + username).Expect().Status(iris.StatusOK).
|
||||
Body().Equal(username + doneResponse)
|
||||
Body().IsEqual(username + doneResponse)
|
||||
e.POST("/profile/" + username).Expect().Status(iris.StatusOK).
|
||||
Body().Equal(username + doneResponse)
|
||||
Body().IsEqual(username + doneResponse)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,17 +178,17 @@ func TestControllerBeginAndEndRequestFuncBindMiddleware(t *testing.T) {
|
||||
getEx := e.GET("/profile/" + username).Expect()
|
||||
if allow {
|
||||
getEx.Status(iris.StatusOK).
|
||||
Body().Equal(username + doneResponse)
|
||||
Body().IsEqual(username + doneResponse)
|
||||
} else {
|
||||
getEx.Status(iris.StatusForbidden).Body().Equal("forbidden")
|
||||
getEx.Status(iris.StatusForbidden).Body().IsEqual("forbidden")
|
||||
}
|
||||
|
||||
postEx := e.POST("/profile/" + username).Expect()
|
||||
if allow {
|
||||
postEx.Status(iris.StatusOK).
|
||||
Body().Equal(username + doneResponse)
|
||||
Body().IsEqual(username + doneResponse)
|
||||
} else {
|
||||
postEx.Status(iris.StatusForbidden).Body().Equal("forbidden")
|
||||
postEx.Status(iris.StatusForbidden).Body().IsEqual("forbidden")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -251,7 +251,7 @@ func TestControllerEndRequestAwareness(t *testing.T) {
|
||||
|
||||
for _, username := range usernames {
|
||||
e.GET("/era/" + username).Expect().Status(iris.StatusOK).
|
||||
Body().Equal(username + username + "2")
|
||||
Body().IsEqual(username + username + "2")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,17 +315,17 @@ func TestControllerDependencies(t *testing.T) {
|
||||
e := httptest.New(t, app)
|
||||
expected := t1 + t2
|
||||
e.GET("/").Expect().Status(iris.StatusOK).
|
||||
Body().Equal(expected)
|
||||
Body().IsEqual(expected)
|
||||
e.GET("/ctx").Expect().Status(iris.StatusContinue)
|
||||
|
||||
e.GET("/deep").Expect().Status(iris.StatusOK).
|
||||
Body().Equal(expected)
|
||||
Body().IsEqual(expected)
|
||||
|
||||
e.POST("/deep").WithJSON(iris.Map{"name": "kataras"}).Expect().Status(iris.StatusOK).
|
||||
Body().Equal("kataras")
|
||||
Body().IsEqual("kataras")
|
||||
|
||||
e.POST("/deep").Expect().Status(iris.StatusBadRequest).
|
||||
Body().Equal("EOF")
|
||||
Body().IsEqual("EOF")
|
||||
}
|
||||
|
||||
type testCtrl0 struct {
|
||||
@@ -381,7 +381,7 @@ func TestControllerInsideControllerRecursively(t *testing.T) {
|
||||
|
||||
e := httptest.New(t, app)
|
||||
e.GET("/user/" + username).Expect().
|
||||
Status(iris.StatusOK).Body().Equal(expected)
|
||||
Status(iris.StatusOK).Body().IsEqual(expected)
|
||||
}
|
||||
|
||||
type testControllerRelPathFromFunc struct{}
|
||||
@@ -421,47 +421,47 @@ func TestControllerRelPathFromFunc(t *testing.T) {
|
||||
|
||||
e := httptest.New(t, app)
|
||||
e.GET("/").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/")
|
||||
Body().IsEqual("GET:/")
|
||||
|
||||
e.GET("/18446744073709551615").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/18446744073709551615")
|
||||
Body().IsEqual("GET:/18446744073709551615")
|
||||
e.GET("/uint8/ratio/255").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/uint8/ratio/255")
|
||||
Body().IsEqual("GET:/uint8/ratio/255")
|
||||
e.GET("/uint8/ratio/256").Expect().Status(iris.StatusNotFound)
|
||||
e.GET("/int64/ratio/-42").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/int64/ratio/-42")
|
||||
Body().IsEqual("GET:/int64/ratio/-42")
|
||||
e.GET("/something/true").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/something/true")
|
||||
Body().IsEqual("GET:/something/true")
|
||||
e.GET("/something/false").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/something/false")
|
||||
Body().IsEqual("GET:/something/false")
|
||||
e.GET("/something/truee").Expect().Status(iris.StatusNotFound)
|
||||
e.GET("/something/falsee").Expect().Status(iris.StatusNotFound)
|
||||
e.GET("/something/kataras/42").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/something/kataras/42")
|
||||
Body().IsEqual("GET:/something/kataras/42")
|
||||
e.GET("/something/new/kataras/42").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/something/new/kataras/42")
|
||||
Body().IsEqual("GET:/something/new/kataras/42")
|
||||
e.GET("/something/true/else/this/42").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/something/true/else/this/42")
|
||||
Body().IsEqual("GET:/something/true/else/this/42")
|
||||
|
||||
e.GET("/login").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/login")
|
||||
Body().IsEqual("GET:/login")
|
||||
e.POST("/login").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("POST:/login")
|
||||
Body().IsEqual("POST:/login")
|
||||
e.GET("/admin/login").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/admin/login")
|
||||
Body().IsEqual("GET:/admin/login")
|
||||
e.PUT("/something/into/this").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("PUT:/something/into/this")
|
||||
Body().IsEqual("PUT:/something/into/this")
|
||||
e.GET("/42").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/42")
|
||||
Body().IsEqual("GET:/42")
|
||||
e.GET("/anything/here").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/anything/here")
|
||||
Body().IsEqual("GET:/anything/here")
|
||||
|
||||
e.GET("/location/x").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/location/x")
|
||||
Body().IsEqual("GET:/location/x")
|
||||
e.GET("/location/x/y").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/location/x/y")
|
||||
Body().IsEqual("GET:/location/x/y")
|
||||
e.GET("/location/z/42").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("GET:/location/z/42")
|
||||
Body().IsEqual("GET:/location/z/42")
|
||||
}
|
||||
|
||||
type testControllerActivateListener struct {
|
||||
@@ -502,16 +502,16 @@ func TestControllerActivateListener(t *testing.T) {
|
||||
|
||||
e := httptest.New(t, app)
|
||||
e.GET("/").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("overrides the dependency but not the field")
|
||||
Body().IsEqual("overrides the dependency but not the field")
|
||||
e.GET("/me/tos-read").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("MeTOSRead")
|
||||
Body().IsEqual("MeTOSRead")
|
||||
e.POST("/me/tos-read").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("MeTOSRead")
|
||||
Body().IsEqual("MeTOSRead")
|
||||
|
||||
e.GET("/manual").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("overrides the dependency but not the field")
|
||||
Body().IsEqual("overrides the dependency but not the field")
|
||||
e.GET("/manual2").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("my manual title")
|
||||
Body().IsEqual("my manual title")
|
||||
}
|
||||
|
||||
type testControllerNotCreateNewDueManuallySettingAllFields struct {
|
||||
@@ -550,7 +550,7 @@ func TestControllerNotCreateNewDueManuallySettingAllFields(t *testing.T) {
|
||||
|
||||
e := httptest.New(t, app)
|
||||
e.GET("/").Expect().Status(iris.StatusOK).
|
||||
Body().Equal("my title")
|
||||
Body().IsEqual("my title")
|
||||
}
|
||||
|
||||
type testControllerRequestScopedDependencies struct {
|
||||
@@ -594,11 +594,11 @@ func TestControllerRequestScopedDependencies(t *testing.T) {
|
||||
|
||||
e := httptest.New(t, app)
|
||||
e.GET("/").WithQuery("name", "kataras").WithQuery("age", 27).
|
||||
Expect().Status(httptest.StatusOK).JSON().Equal(&testCustomStruct{
|
||||
Expect().Status(httptest.StatusOK).JSON().IsEqual(&testCustomStruct{
|
||||
Name: "kataras",
|
||||
Age: 27,
|
||||
})
|
||||
e.GET("/custom/context").Expect().Status(httptest.StatusOK).Body().Equal("test")
|
||||
e.GET("/custom/context").Expect().Status(httptest.StatusOK).Body().IsEqual("test")
|
||||
}
|
||||
|
||||
type (
|
||||
@@ -637,7 +637,7 @@ func TestControllersInsideControllerDeep(t *testing.T) {
|
||||
m.Handle(new(FinalController))
|
||||
|
||||
e := httptest.New(t, app)
|
||||
e.GET("/something").Expect().Status(httptest.StatusOK).Body().Equal("foo bar")
|
||||
e.GET("/something").Expect().Status(httptest.StatusOK).Body().IsEqual("foo bar")
|
||||
}
|
||||
|
||||
type testApplicationDependency struct {
|
||||
@@ -657,8 +657,8 @@ func TestApplicationDependency(t *testing.T) {
|
||||
m2.Handle(new(testApplicationDependency))
|
||||
|
||||
e := httptest.New(t, app)
|
||||
e.GET("/").Expect().Status(httptest.StatusOK).Body().Equal("app1")
|
||||
e.GET("/other").Expect().Status(httptest.StatusOK).Body().Equal("app2")
|
||||
e.GET("/").Expect().Status(httptest.StatusOK).Body().IsEqual("app1")
|
||||
e.GET("/other").Expect().Status(httptest.StatusOK).Body().IsEqual("app2")
|
||||
}
|
||||
|
||||
type testControllerMethodHandlerBindStruct struct{}
|
||||
@@ -701,11 +701,11 @@ func TestControllerMethodHandlerBindStruct(t *testing.T) {
|
||||
manyData := []bindStructData{data, {"john doe"}}
|
||||
|
||||
e := httptest.New(t, app)
|
||||
e.GET("/data").WithQueryObject(data).Expect().Status(httptest.StatusOK).JSON().Equal(data)
|
||||
e.PATCH("/data").WithJSON(data).Expect().Status(httptest.StatusOK).JSON().Equal(data)
|
||||
e.POST("/data/42/slice").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().Equal(manyData)
|
||||
e.POST("/data/42/slicetype").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().Equal(manyData)
|
||||
e.POST("/data/42/slicetypeptr").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().Equal(manyData)
|
||||
e.GET("/data").WithQueryObject(data).Expect().Status(httptest.StatusOK).JSON().IsEqual(data)
|
||||
e.PATCH("/data").WithJSON(data).Expect().Status(httptest.StatusOK).JSON().IsEqual(data)
|
||||
e.POST("/data/42/slice").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().IsEqual(manyData)
|
||||
e.POST("/data/42/slicetype").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().IsEqual(manyData)
|
||||
e.POST("/data/42/slicetypeptr").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().IsEqual(manyData)
|
||||
// more tests inside the hero package itself.
|
||||
}
|
||||
|
||||
@@ -721,7 +721,7 @@ func TestErrorHandlerContinue(t *testing.T) {
|
||||
WithFormField("username", "makis").
|
||||
WithFormField("age", "27").
|
||||
WithFormField("unknown", "continue").
|
||||
Expect().Status(httptest.StatusOK).Body().Equal("makis is 27 years old\n")
|
||||
Expect().Status(httptest.StatusOK).Body().IsEqual("makis is 27 years old\n")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user