Skip to content

Commit 5d09690

Browse files
committed
Update cors test
go-chi/cors was updated to allow blank origins.
1 parent 6b4cc98 commit 5d09690

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

api/httpmw/cors_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,7 @@ func TestCors(t *testing.T) {
107107
// OPTIONS should echo back the request method and headers (if there
108108
// is an origin header set) and we should never get to our handler as
109109
// the middleware short-circuits with a 200.
110-
if method == http.MethodOptions && test.origin == "" {
111-
require.Equal(t, "", rw.Header().Get(httpmw.AccessControlAllowMethodsHeader))
112-
require.Equal(t, "", rw.Header().Get(httpmw.AccessControlAllowHeadersHeader))
113-
require.Equal(t, http.StatusOK, rw.Code)
114-
} else if method == http.MethodOptions {
110+
if method == http.MethodOptions && test.origin != "" {
115111
require.Equal(t, http.MethodGet, rw.Header().Get(httpmw.AccessControlAllowMethodsHeader))
116112
require.Equal(t, test.allowedHeaders, rw.Header().Get(httpmw.AccessControlAllowHeadersHeader))
117113
require.Equal(t, http.StatusOK, rw.Code)

0 commit comments

Comments
 (0)