(t *testing.T)
| 102 | } |
| 103 | |
| 104 | func TestErrorHandlerFunc(t *testing.T) { |
| 105 | m := fakeServer{} |
| 106 | |
| 107 | h := HandlerWithOptions(&m, ChiServerOptions{ |
| 108 | ErrorHandlerFunc: func(w http.ResponseWriter, r *http.Request, err error) { |
| 109 | w.Header().Set("Content-Type", "application/json") |
| 110 | var requiredParamError *RequiredParamError |
| 111 | assert.True(t, errors.As(err, &requiredParamError)) |
| 112 | }, |
| 113 | }) |
| 114 | |
| 115 | s := httptest.NewServer(h) |
| 116 | defer s.Close() |
| 117 | |
| 118 | req, err := http.DefaultClient.Get(s.URL + "/get-with-args") |
| 119 | assert.Nil(t, err) |
| 120 | assert.Equal(t, "application/json", req.Header.Get("Content-Type")) |
| 121 | } |
| 122 | |
| 123 | func TestErrorHandlerFuncBackwardsCompatible(t *testing.T) { |
| 124 | m := fakeServer{} |
nothing calls this directly
no test coverage detected