Skip to content

Commit 248cb32

Browse files
committed
Update Bearer replacement to be case insensitive.
1 parent 4456785 commit 248cb32

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/execute/swagger2/build-request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function applySecurities({request, securities = {}, operation = {}, spec}
8484
}
8585
}
8686
else if (type === 'oauth2' && accessToken) {
87-
tokenType = (!tokenType || tokenType === 'bearer') ? 'Bearer' : tokenType
87+
tokenType = (!tokenType || tokenType.toLowerCase() === 'bearer') ? 'Bearer' : tokenType
8888
result.headers.authorization = `${tokenType} ${accessToken}`
8989
}
9090
}

test/index-authorizations.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ describe('(instance) #execute', function () {
175175
})
176176
})
177177

178-
it('should uppercase the `bearer` token_type', function () {
178+
it('should replace any occurrence of `bearer` with `Bearer`', function () {
179179
const spec = {
180180
securityDefinitions: {
181181
testBearer: {
@@ -195,7 +195,7 @@ describe('(instance) #execute', function () {
195195
const authorizations = {
196196
testBearer: {
197197
token: {
198-
token_type: 'bearer',
198+
token_type: 'BeArEr',
199199
access_token: 'one two'
200200
}
201201
}

0 commit comments

Comments
 (0)