(t *testing.T)
| 270 | } |
| 271 | |
| 272 | func TestRenderPureJSON(t *testing.T) { |
| 273 | w := httptest.NewRecorder() |
| 274 | data := map[string]any{ |
| 275 | "foo": "bar", |
| 276 | "html": "<b>", |
| 277 | } |
| 278 | err := (PureJSON{data}).Render(w) |
| 279 | require.NoError(t, err) |
| 280 | assert.JSONEq(t, "{\"foo\":\"bar\",\"html\":\"<b>\"}\n", w.Body.String()) |
| 281 | assert.Equal(t, "application/json; charset=utf-8", w.Header().Get("Content-Type")) |
| 282 | } |
| 283 | |
| 284 | type xmlmap map[string]any |
| 285 |