(t *testing.T)
| 227 | } |
| 228 | |
| 229 | func TestMiddlewareWrite(t *testing.T) { |
| 230 | router := New() |
| 231 | router.Use(func(c *Context) { |
| 232 | c.String(http.StatusBadRequest, "hola\n") |
| 233 | }) |
| 234 | router.Use(func(c *Context) { |
| 235 | c.XML(http.StatusBadRequest, H{"foo": "bar"}) |
| 236 | }) |
| 237 | router.Use(func(c *Context) { |
| 238 | c.JSON(http.StatusBadRequest, H{"foo": "bar"}) |
| 239 | }) |
| 240 | router.GET("/", func(c *Context) { |
| 241 | c.JSON(http.StatusBadRequest, H{"foo": "bar"}) |
| 242 | }, func(c *Context) { |
| 243 | c.Render(http.StatusBadRequest, sse.Event{ |
| 244 | Event: "test", |
| 245 | Data: "message", |
| 246 | }) |
| 247 | }) |
| 248 | |
| 249 | w := PerformRequest(router, http.MethodGet, "/") |
| 250 | |
| 251 | assert.Equal(t, http.StatusBadRequest, w.Code) |
| 252 | assert.Equal(t, strings.ReplaceAll("hola\n<map><foo>bar</foo></map>{\"foo\":\"bar\"}{\"foo\":\"bar\"}event:test\ndata:message\n\n", " ", ""), strings.ReplaceAll(w.Body.String(), " ", "")) |
| 253 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…