MCPcopy
hub / github.com/qustavo/httplab / TestResponseWrite

Function TestResponseWrite

response_test.go:62–79  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

60}
61
62func TestResponseWrite(t *testing.T) {
63 rec := httptest.NewRecorder()
64 resp := &Response{
65 Status: 201,
66 Headers: http.Header{
67 "X-Foo": []string{"bar"},
68 },
69 Body: Body{
70 Input: []byte("Hello, World"),
71 },
72 }
73
74 resp.Write(rec)
75
76 assert.Equal(t, resp.Status, rec.Code)
77 assert.Equal(t, resp.Headers.Get("X-Foo"), rec.Header().Get("X-Foo"))
78 assert.Equal(t, resp.Body.Payload(), rec.Body.Bytes())
79}
80
81func TestResponsesList(t *testing.T) {
82 rl := NewResponsesList()

Callers

nothing calls this directly

Calls 3

WriteMethod · 0.95
PayloadMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected