feat: convert header names to lowercase (#45)

master
Pim 2019-05-21 23:20:04 +02:00 committed by Pooya Parsa
parent 68d2f17ea1
commit 7ad6645d8a
2 changed files with 10 additions and 1 deletions

View File

@ -2,6 +2,9 @@ import KY from 'ky-universal'
class HTTP {
constructor(defaults, ky = KY) {
const headers = defaults.headers
delete defaults.headers
this._defaults = {
hooks: {},
headers: {},
@ -9,9 +12,15 @@ class HTTP {
...defaults
}
this._ky = ky
for (const name in headers) {
this.setHeader(name, headers[name])
}
}
setHeader(name, value) {
name = name.toLowerCase()
if (!value) {
delete this._defaults.headers[name];
} else {

View File

@ -12,7 +12,7 @@ let reqCtr = 1
export default {
computed: {
httpSessionId() {
return this.$http._defaults.headers.sessionId
return this.$http._defaults.headers.sessionid
},
httpEncoding() {