Skip to content

Commit 8dce0d8

Browse files
committed
Fix inconsistency between security 'scheme' and OAI3 specs.
scheme should be case insensitive OAI/OpenAPI-Specification#1876 https://tools.ietf.org/html/rfc7235#section-2.1
1 parent 7ca4c00 commit 8dce0d8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/execute/oas3/build-request.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,18 @@ export function applySecurities({request, securities = {}, operation = {}, spec}
147147
}
148148
}
149149
else if (type === 'http') {
150-
if (schema.scheme === 'basic') {
150+
let scheme = schema.scheme;
151+
if (scheme) {
152+
scheme = scheme.toLowerCase()
153+
}
154+
155+
if (scheme === 'basic') {
151156
const {username, password} = value
152157
const encoded = btoa(`${username}:${password}`)
153158
result.headers.Authorization = `Basic ${encoded}`
154159
}
155160

156-
if (schema.scheme === 'bearer') {
161+
if (scheme === 'bearer') {
157162
result.headers.Authorization = `Bearer ${value}`
158163
}
159164
}

0 commit comments

Comments
 (0)