forked from Mirrors/jsonapi
Add additional test for method not found
This commit is contained in:
parent
c036316c9d
commit
081fb8a5c2
|
@ -100,3 +100,19 @@ func TestHttpErrorWhenHeaderDoesNotMatch(t *testing.T) {
|
||||||
t.Fatal("expected Unsupported Media Type staus error")
|
t.Fatal("expected Unsupported Media Type staus error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestHttpErrorWhenMethodDoesNotMatch(t *testing.T) {
|
||||||
|
r, err := http.NewRequest(http.MethodPatch, "/blogs", nil)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
r.Header.Set(headerAccept, jsonapi.MediaType)
|
||||||
|
|
||||||
|
rr := httptest.NewRecorder()
|
||||||
|
handler := &ExampleHandler{}
|
||||||
|
handler.ServeHTTP(rr, r)
|
||||||
|
|
||||||
|
if rr.Code != http.StatusNotFound {
|
||||||
|
t.Fatal("expected HTTP Status Not Found status error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue