Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1e60250

Browse files
Bump github.com/go-chi/cors from 1.2.1 to 1.2.2
1.2.2 changes how blank origins are handled; a test was updated accordingly.
1 parent 01619ee commit 1e60250

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
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)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.24.0
55
require (
66
cdr.dev/slog v1.6.1
77
github.com/go-chi/chi/v5 v5.2.3
8-
github.com/go-chi/cors v1.2.1
8+
github.com/go-chi/cors v1.2.2
99
github.com/go-chi/httprate v0.15.0
1010
github.com/google/uuid v1.6.0
1111
github.com/lithammer/fuzzysearch v1.1.8

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
1818
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1919
github.com/go-chi/chi/v5 v5.2.3 h1:WQIt9uxdsAbgIYgid+BpYc+liqQZGMHRaUwp0JUcvdE=
2020
github.com/go-chi/chi/v5 v5.2.3/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops=
21-
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
22-
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
21+
github.com/go-chi/cors v1.2.2 h1:Jmey33TE+b+rB7fT8MUy1u0I4L+NARQlK6LhzKPSyQE=
22+
github.com/go-chi/cors v1.2.2/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
2323
github.com/go-chi/httprate v0.15.0 h1:j54xcWV9KGmPf/X4H32/aTH+wBlrvxL7P+SdnRqxh5g=
2424
github.com/go-chi/httprate v0.15.0/go.mod h1:rzGHhVrsBn3IMLYDOZQsSU4fJNWcjui4fWKJcCId1R4=
2525
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=

0 commit comments

Comments
 (0)