(t *testing.T)
| 380 | } |
| 381 | |
| 382 | func TestEventHTML(t *testing.T) { |
| 383 | scenarios := []testResponseWriteScenario[string]{ |
| 384 | { |
| 385 | name: "no explicit content-type", |
| 386 | status: 234, |
| 387 | headers: nil, |
| 388 | body: "test", |
| 389 | expectedStatus: 234, |
| 390 | expectedHeaders: map[string]string{"content-type": "text/html; charset=utf-8"}, |
| 391 | expectedBody: "test", |
| 392 | }, |
| 393 | { |
| 394 | name: "with explicit content-type", |
| 395 | status: 234, |
| 396 | headers: map[string]string{"content-type": "text/test"}, |
| 397 | body: "test", |
| 398 | expectedStatus: 234, |
| 399 | expectedHeaders: map[string]string{"content-type": "text/test"}, |
| 400 | expectedBody: "test", |
| 401 | }, |
| 402 | } |
| 403 | |
| 404 | for _, s := range scenarios { |
| 405 | testEventResponseWrite(t, s, func(e *router.Event) error { |
| 406 | return e.HTML(s.status, s.body) |
| 407 | }) |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | func TestEventJSON(t *testing.T) { |
| 412 | body := map[string]any{"a": 123, "b": 456, "c": "test"} |
nothing calls this directly
no test coverage detected
searching dependent graphs…