(t *testing.T)
| 49 | } |
| 50 | |
| 51 | func TestRenderIndentedJSON(t *testing.T) { |
| 52 | w := httptest.NewRecorder() |
| 53 | data := map[string]any{ |
| 54 | "foo": "bar", |
| 55 | "bar": "foo", |
| 56 | } |
| 57 | |
| 58 | err := (IndentedJSON{data}).Render(w) |
| 59 | |
| 60 | require.NoError(t, err) |
| 61 | assert.JSONEq(t, "{\n \"bar\": \"foo\",\n \"foo\": \"bar\"\n}", w.Body.String()) |
| 62 | assert.Equal(t, "application/json; charset=utf-8", w.Header().Get("Content-Type")) |
| 63 | } |
| 64 | |
| 65 | func TestRenderIndentedJSONPanics(t *testing.T) { |
| 66 | w := httptest.NewRecorder() |