mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 18:07:01 +00:00
fix #2158 and more
This commit is contained in:
@@ -12,14 +12,14 @@ func TestDependencyInjectionBasic_Middleware(t *testing.T) {
|
||||
e := httptest.New(t, app)
|
||||
e.POST("/42").WithJSON(testInput{Email: "my_email"}).Expect().
|
||||
Status(httptest.StatusOK).
|
||||
JSON().Equal(testOutput{ID: 42, Name: "my_email"})
|
||||
JSON().IsEqual(testOutput{ID: 42, Name: "my_email"})
|
||||
|
||||
// it should stop the execution at the middleware and return the middleware's status code,
|
||||
// because the error is `ErrStopExecution`.
|
||||
e.POST("/42").WithJSON(testInput{Email: "invalid"}).Expect().
|
||||
Status(httptest.StatusAccepted).Body().Empty()
|
||||
Status(httptest.StatusAccepted).Body().IsEmpty()
|
||||
|
||||
// it should stop the execution at the middleware and return the error's text.
|
||||
e.POST("/42").WithJSON(testInput{Email: "error"}).Expect().
|
||||
Status(httptest.StatusConflict).Body().Equal("my_error")
|
||||
Status(httptest.StatusConflict).Body().IsEqual("my_error")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user