This repository was archived by the owner on Nov 25, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -66,15 +66,15 @@ func NewRouters() Routers {
6666}
6767
6868var NotAllowedHandler = WrapHandlerInCORS (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
69- w .WriteHeader (http .StatusMethodNotAllowed )
7069 w .Header ().Set ("Content-Type" , "application/json" )
70+ w .WriteHeader (http .StatusMethodNotAllowed )
7171 unrecognizedErr , _ := json .Marshal (spec .Unrecognized ("Unrecognized request" )) // nolint:misspell
7272 _ , _ = w .Write (unrecognizedErr ) // nolint:misspell
7373}))
7474
7575var NotFoundCORSHandler = WrapHandlerInCORS (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
76- w .WriteHeader (http .StatusNotFound )
7776 w .Header ().Set ("Content-Type" , "application/json" )
77+ w .WriteHeader (http .StatusNotFound )
7878 unrecognizedErr , _ := json .Marshal (spec .Unrecognized ("Unrecognized request" )) // nolint:misspell
7979 _ , _ = w .Write (unrecognizedErr ) // nolint:misspell
8080}))
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ func TestRoutersError(t *testing.T) {
1717 if rec .Code != http .StatusNotFound {
1818 t .Fatalf ("unexpected status code: %d - %s" , rec .Code , rec .Body .String ())
1919 }
20- if ct := rec .Header () .Get ("Content-Type" ); ct != "application/json" {
20+ if ct := rec .Result (). Header .Get ("Content-Type" ); ct != "application/json" {
2121 t .Fatalf ("unexpected content-type: %s" , ct )
2222 }
2323
@@ -32,7 +32,7 @@ func TestRoutersError(t *testing.T) {
3232 if rec .Code != http .StatusMethodNotAllowed {
3333 t .Fatalf ("unexpected status code: %d - %s" , rec .Code , rec .Body .String ())
3434 }
35- if ct := rec .Header () .Get ("Content-Type" ); ct != "application/json" {
35+ if ct := rec .Result (). Header .Get ("Content-Type" ); ct != "application/json" {
3636 t .Fatalf ("unexpected content-type: %s" , ct )
3737 }
3838}
You can’t perform that action at this time.
0 commit comments