(t *testing.T)
| 216 | } |
| 217 | |
| 218 | func TestCustomHeaderHandler(t *testing.T) { |
| 219 | out := &bytes.Buffer{} |
| 220 | r := &http.Request{ |
| 221 | Header: http.Header{ |
| 222 | "X-Request-Id": []string{"514bbe5bb5251c92bd07a9846f4a1ab6"}, |
| 223 | }, |
| 224 | } |
| 225 | h := CustomHeaderHandler("reqID", "X-Request-Id")(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 226 | l := FromRequest(r) |
| 227 | l.Log().Msg("") |
| 228 | })) |
| 229 | h = NewHandler(zerolog.New(out))(h) |
| 230 | h.ServeHTTP(nil, r) |
| 231 | if want, got := `{"reqID":"514bbe5bb5251c92bd07a9846f4a1ab6"}`+"\n", decodeIfBinary(out); want != got { |
| 232 | t.Errorf("Invalid log output, got: %s, want: %s", got, want) |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | func TestEtagHandler(t *testing.T) { |
| 237 | out := &bytes.Buffer{} |
nothing calls this directly
no test coverage detected