(t *testing.T)
| 183 | } |
| 184 | |
| 185 | func TestMiddlewareAbortHandlersChainAndNext(t *testing.T) { |
| 186 | signature := "" |
| 187 | router := New() |
| 188 | router.Use(func(c *Context) { |
| 189 | signature += "A" |
| 190 | c.Next() |
| 191 | c.AbortWithStatus(http.StatusGone) |
| 192 | signature += "B" |
| 193 | }) |
| 194 | router.GET("/", func(c *Context) { |
| 195 | signature += "C" |
| 196 | c.Next() |
| 197 | }) |
| 198 | // RUN |
| 199 | w := PerformRequest(router, http.MethodGet, "/") |
| 200 | |
| 201 | // TEST |
| 202 | assert.Equal(t, http.StatusGone, w.Code) |
| 203 | assert.Equal(t, "ACB", signature) |
| 204 | } |
| 205 | |
| 206 | // TestMiddlewareFailHandlersChain - ensure that Fail interrupt used middleware in fifo order as |
| 207 | // as well as Abort |
nothing calls this directly
no test coverage detected