(t *testing.T)
| 58 | } |
| 59 | |
| 60 | func TestMethodHandler(t *testing.T) { |
| 61 | out := &bytes.Buffer{} |
| 62 | r := &http.Request{ |
| 63 | Method: "POST", |
| 64 | } |
| 65 | h := MethodHandler("method")(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 66 | l := FromRequest(r) |
| 67 | l.Log().Msg("") |
| 68 | })) |
| 69 | h = NewHandler(zerolog.New(out))(h) |
| 70 | h.ServeHTTP(nil, r) |
| 71 | if want, got := `{"method":"POST"}`+"\n", decodeIfBinary(out); want != got { |
| 72 | t.Errorf("Invalid log output, got: %s, want: %s", got, want) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | func TestRequestHandler(t *testing.T) { |
| 77 | out := &bytes.Buffer{} |
nothing calls this directly
no test coverage detected