MCPcopy
hub / github.com/labstack/echo / TestContextHTMLBlob

Function TestContextHTMLBlob

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

Source from the content-addressed store, hash-verified

206}
207
208func TestContextHTMLBlob(t *testing.T) {
209 rec := httptest.NewRecorder()
210 req := httptest.NewRequest(http.MethodGet, "/", nil)
211 c := NewContext(req, rec)
212
213 err := c.HTMLBlob(http.StatusOK, []byte("Hi, Jon Snow"))
214 if assert.NoError(t, err) {
215 assert.Equal(t, http.StatusOK, rec.Code)
216 assert.Equal(t, MIMETextHTMLCharsetUTF8, rec.Header().Get(HeaderContentType))
217 assert.Equal(t, "Hi, Jon Snow", rec.Body.String())
218 }
219}
220
221func TestContextJSON(t *testing.T) {
222 e := New()

Callers

nothing calls this directly

Calls 5

HTMLBlobMethod · 0.95
NewContextFunction · 0.85
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…