| 372 | } |
| 373 | |
| 374 | func TestContextXMLBlob(t *testing.T) { |
| 375 | e := New() |
| 376 | rec := httptest.NewRecorder() |
| 377 | req := httptest.NewRequest(http.MethodGet, "/", nil) |
| 378 | c := e.NewContext(req, rec) |
| 379 | |
| 380 | data, err := xml.Marshal(user{ID: 1, Name: "Jon Snow"}) |
| 381 | assert.NoError(t, err) |
| 382 | err = c.XMLBlob(http.StatusOK, data) |
| 383 | if assert.NoError(t, err) { |
| 384 | assert.Equal(t, http.StatusOK, rec.Code) |
| 385 | assert.Equal(t, MIMEApplicationXMLCharsetUTF8, rec.Header().Get(HeaderContentType)) |
| 386 | assert.Equal(t, xml.Header+userXML, rec.Body.String()) |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | func TestContextXMLWithEmptyIntent(t *testing.T) { |
| 391 | e := New() |