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

Function TestContextXMLPretty

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

Source from the content-addressed store, hash-verified

358}
359
360func TestContextXMLPretty(t *testing.T) {
361 e := New()
362 rec := httptest.NewRecorder()
363 req := httptest.NewRequest(http.MethodGet, "/", nil)
364 c := e.NewContext(req, rec)
365
366 err := c.XMLPretty(http.StatusOK, user{ID: 1, Name: "Jon Snow"}, " ")
367 if assert.NoError(t, err) {
368 assert.Equal(t, http.StatusOK, rec.Code)
369 assert.Equal(t, MIMEApplicationXMLCharsetUTF8, rec.Header().Get(HeaderContentType))
370 assert.Equal(t, xml.Header+userXMLPretty, rec.Body.String())
371 }
372}
373
374func TestContextXMLBlob(t *testing.T) {
375 e := New()

Callers

nothing calls this directly

Calls 6

XMLPrettyMethod · 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…