mirror of https://github.com/sundowndev/http.git
feat: convert header names to lowercase (#45)
parent
68d2f17ea1
commit
7ad6645d8a
|
@ -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 {
|
||||
|
|
|
@ -12,7 +12,7 @@ let reqCtr = 1
|
|||
export default {
|
||||
computed: {
|
||||
httpSessionId() {
|
||||
return this.$http._defaults.headers.sessionId
|
||||
return this.$http._defaults.headers.sessionid
|
||||
},
|
||||
|
||||
httpEncoding() {
|
||||
|
|
Loading…
Reference in New Issue