MCPcopy
hub / github.com/uber-go/zap / TestAtomicLevelServeHTTPBrokenWriter

Function TestAtomicLevelServeHTTPBrokenWriter

http_handler_test.go:196–210  ·  http_handler_test.go::TestAtomicLevelServeHTTPBrokenWriter
(t *testing.T)

Source from the content-addressed store, hash-verified

194}
195
196func TestAtomicLevelServeHTTPBrokenWriter(t *testing.T) {
197 t.Parallel()
198
199 lvl := zap.NewAtomicLevel()
200
201 request, err := http.NewRequest(http.MethodGet, "http://localhost:1234/log/level", nil)
202 require.NoError(t, err, "Error constructing request.")
203
204 recorder := httptest.NewRecorder()
205 lvl.ServeHTTP(&brokenHTTPResponseWriter{
206 ResponseWriter: recorder,
207 }, request)
208
209 assert.Equal(t, http.StatusInternalServerError, recorder.Code, "Unexpected status code.")
210}
211
212type brokenHTTPResponseWriter struct {
213 http.ResponseWriter

Callers

nothing calls this directly

Calls 2

ServeHTTPMethod · 0.95
NewAtomicLevelFunction · 0.92

Tested by

no test coverage detected