MCPcopy
hub / github.com/dunglas/mercure / TestAuthorizeMultipleAuthorizationHeader

Function TestAuthorizeMultipleAuthorizationHeader

authorization_test.go:148–170  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

146}
147
148func TestAuthorizeMultipleAuthorizationHeader(t *testing.T) {
149 t.Parallel()
150
151 for _, testdata := range authTestData {
152 t.Run(testdata.algorithm, func(t *testing.T) {
153 t.Parallel()
154
155 if testdata.certificate != "" {
156 t.SkipNow()
157 }
158
159 r, _ := http.NewRequest(http.MethodGet, defaultHubURL, nil)
160 r.Header.Add("Authorization", testdata.validEmpty)
161 r.Header.Add("Authorization", testdata.validEmpty)
162
163 h := createDummy(t, WithSubscriberJWT([]byte{}, testdata.algorithm))
164
165 claims, err := h.authorize(r, false)
166 require.EqualError(t, err, `invalid "Authorization" HTTP header`)
167 require.Nil(t, claims)
168 })
169 }
170}
171
172func TestAuthorizeAuthorizationHeaderTooShort(t *testing.T) {
173 t.Parallel()

Callers

nothing calls this directly

Calls 4

createDummyFunction · 0.85
WithSubscriberJWTFunction · 0.85
AddMethod · 0.80
authorizeMethod · 0.80

Tested by

no test coverage detected