| 311 | } |
| 312 | |
| 313 | func TestContextJSONBlob(t *testing.T) { |
| 314 | e := New() |
| 315 | rec := httptest.NewRecorder() |
| 316 | req := httptest.NewRequest(http.MethodGet, "/", nil) |
| 317 | c := e.NewContext(req, rec) |
| 318 | |
| 319 | data, err := json.Marshal(user{ID: 1, Name: "Jon Snow"}) |
| 320 | assert.NoError(t, err) |
| 321 | err = c.JSONBlob(http.StatusOK, data) |
| 322 | if assert.NoError(t, err) { |
| 323 | assert.Equal(t, http.StatusOK, rec.Code) |
| 324 | assert.Equal(t, MIMEApplicationJSON, rec.Header().Get(HeaderContentType)) |
| 325 | assert.Equal(t, userJSON, rec.Body.String()) |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | func TestContextJSONPBlob(t *testing.T) { |
| 330 | e := New() |