wxiaoguang
819aed35bf
Make route middleware/handler mockable ( #25766 )
...
To mock a handler:
```go
web.RouteMock(web.MockAfterMiddlewares, func(ctx *context.Context) {
// ...
})
defer web.RouteMockReset()
```
It helps:
* Test the middleware's behavior (assert the ctx.Data, etc)
* Mock the middleware's behavior (prepare some context data for handler)
* Mock the handler's response for some test cases, especially for some
integration tests and e2e tests.
2023-07-09 12:25:53 +00:00
..
2023-07-07 19:22:03 +00:00
2023-07-09 11:58:06 +00:00
2022-11-27 18:20:29 +00:00
2023-04-12 18:16:45 +08:00
2023-04-12 18:16:45 +08:00
2023-07-04 12:43:38 +00:00
2023-07-04 18:36:08 +00:00
2023-07-04 18:36:08 +00:00
2023-07-04 18:36:08 +00:00
2022-11-27 18:20:29 +00:00
2023-07-09 11:58:06 +00:00
2023-04-17 11:37:23 +08:00
2023-07-07 05:31:56 +00:00
2023-06-29 16:29:48 +00:00
2023-07-07 05:31:56 +00:00
2022-11-27 18:20:29 +00:00
2023-07-09 11:58:06 +00:00
2023-02-15 21:37:34 +08:00
2023-07-04 18:36:08 +00:00
2023-01-29 09:49:51 -06:00
2023-03-14 16:09:01 -04:00
2022-11-27 18:20:29 +00:00
2023-07-04 18:36:08 +00:00
2023-07-07 05:31:56 +00:00
2023-07-07 05:31:56 +00:00
2023-07-07 17:10:13 +00:00
2023-07-04 18:36:08 +00:00
2023-07-04 18:36:08 +00:00
2023-04-10 16:44:02 +08:00
2023-05-21 22:35:11 +00:00
2023-06-28 08:02:06 +02:00
2023-07-04 18:36:08 +00:00
2022-11-27 18:20:29 +00:00
2023-06-03 22:03:41 +08:00
2023-07-04 18:36:08 +00:00
2023-05-26 07:31:55 +00:00
2023-07-09 11:58:06 +00:00
2023-06-26 06:59:15 +00:00
2023-04-12 18:16:45 +08:00
2023-07-04 18:36:08 +00:00
2023-04-22 17:56:27 -04:00
2022-11-27 18:20:29 +00:00
2023-07-04 18:36:08 +00:00
2023-07-07 05:31:56 +00:00
2023-02-11 08:39:50 +08:00
2022-11-27 18:20:29 +00:00
2023-05-13 16:04:57 +02:00
2023-07-09 11:58:06 +00:00
2022-11-27 18:20:29 +00:00
2023-01-31 10:08:05 +01:00
2022-11-27 18:20:29 +00:00
2023-06-30 17:03:05 +08:00
2023-05-07 19:29:43 +08:00
2023-07-04 18:36:08 +00:00
2023-07-04 18:36:08 +00:00
2022-12-30 23:31:00 +08:00
2023-06-21 13:50:26 +08:00
2023-07-04 18:36:08 +00:00
2023-07-04 18:36:08 +00:00
2023-07-04 18:36:08 +00:00
2022-11-27 18:20:29 +00:00
2022-11-27 18:20:29 +00:00
2023-07-04 18:36:08 +00:00
2023-07-04 18:36:08 +00:00
2023-07-04 18:36:08 +00:00
2023-05-03 19:53:43 -04:00
2023-07-04 18:36:08 +00:00
2023-02-05 15:29:03 +08:00
2023-03-07 22:40:41 -05:00
2022-11-27 18:20:29 +00:00
2022-11-27 18:20:29 +00:00
2022-11-27 18:20:29 +00:00
2022-11-27 18:20:29 +00:00
2023-07-07 05:31:56 +00:00
2023-07-04 18:36:08 +00:00
2023-07-09 12:25:53 +00:00
2023-05-24 22:06:27 -04:00