(b *testing.B)
| 147 | } |
| 148 | |
| 149 | func BenchmarkServer_LogRequest_WithTrace(b *testing.B) { |
| 150 | s := &Server{} |
| 151 | |
| 152 | extra := new(ExtraLogFields) |
| 153 | ctx := context.WithValue(context.Background(), ExtraLogFieldsCtxKey, extra) |
| 154 | extra.Add(zap.String("traceID", "1234567890abcdef")) |
| 155 | extra.Add(zap.String("spanID", "12345678")) |
| 156 | |
| 157 | req := httptest.NewRequest(http.MethodGet, "/", nil).WithContext(ctx) |
| 158 | rec := httptest.NewRecorder() |
| 159 | wrec := NewResponseRecorder(rec, nil, nil) |
| 160 | |
| 161 | duration := 50 * time.Millisecond |
| 162 | repl := NewTestReplacer(req) |
| 163 | bodyReader := &lengthReader{Source: req.Body} |
| 164 | |
| 165 | buf := io.Discard |
| 166 | accLog := testLogger(buf.Write) |
| 167 | |
| 168 | for b.Loop() { |
| 169 | s.logRequest(accLog, req, wrec, &duration, repl, bodyReader, false) |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | func TestServer_TrustedRealClientIP_NoTrustedHeaders(t *testing.T) { |
| 174 | req := httptest.NewRequest("GET", "/", nil) |
nothing calls this directly
no test coverage detected