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

Function TestResponse_ChangeStatusCodeBeforeWrite

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

Source from the content-addressed store, hash-verified

51}
52
53func TestResponse_ChangeStatusCodeBeforeWrite(t *testing.T) {
54 e := New()
55 rec := httptest.NewRecorder()
56 res := NewResponse(rec, e.Logger)
57
58 res.Before(func() {
59 if 200 < res.Status && res.Status < 300 {
60 res.Status = 200
61 }
62 })
63
64 res.WriteHeader(209)
65
66 assert.Equal(t, http.StatusOK, rec.Code)
67}
68
69func TestResponse_Unwrap(t *testing.T) {
70 e := New()

Callers

nothing calls this directly

Calls 4

BeforeMethod · 0.95
WriteHeaderMethod · 0.95
NewFunction · 0.85
NewResponseFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…