MCPcopy Index your code
hub / github.com/labstack/echo / TestContextXMLBlob

Function TestContextXMLBlob

context_test.go:374–388  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

372}
373
374func 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
390func TestContextXMLWithEmptyIntent(t *testing.T) {
391 e := New()

Callers

nothing calls this directly

Calls 6

XMLBlobMethod · 0.95
NewFunction · 0.85
NewContextMethod · 0.80
GetMethod · 0.45
HeaderMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…