Skip to content

Commit a2f33cc

Browse files
authored
Consistency
1. Headers should be lowercase. 2. No need for the auth variable anymore. 3. Make sure omitted password is treated as an empty string.
1 parent 3f97176 commit a2f33cc

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/util/request.web.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ export default function (baseUrl, options) {
4545
}
4646

4747
return function request ({method, url, headers, body}, cb) {
48-
const auth = typeof username === 'string' ? {username, password} : {}
49-
50-
if (auth.username !== undefined && headers['Authorization'] === undefined) {
51-
headers['Authorization'] = 'Basic ' + window.btoa(auth.username + ':' + auth.password)
48+
if (typeof username === 'string' && !headers.authorization) {
49+
headers.authorizaton = 'Basic ' + window.btoa(username + ':' + (password || ''))
5250
}
5351

5452
const urlParts = {

0 commit comments

Comments
 (0)