Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Klein authored Feb 4, 2021
1 parent 0b753d8 commit ddf9566
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class RESPONSE {

// Adds a header field
header(key,value,append) {
let _key = key.toLowerCase() // store as lowercase
let _key = key; // store as lowercase
let _values = value ? (Array.isArray(value) ? value : [value]) : ['']
this._headers[_key] = append ?
this.hasHeader(_key) ? this._headers[_key].concat(_values) : _values
Expand All @@ -79,9 +79,9 @@ class RESPONSE {
Object.keys(this._headers).reduce((headers,key) =>
Object.assign(headers, { [key]: this._headers[key].toString() })
,{}) // return all headers
return asArr ? this._headers[key.toLowerCase()]
: this._headers[key.toLowerCase()] ?
this._headers[key.toLowerCase()].toString() : undefined
return asArr ? this._headers[key]
: this._headers[key] ?
this._headers[key].toString() : undefined
}

getHeaders() {
Expand All @@ -90,7 +90,7 @@ class RESPONSE {

// Removes a header field
removeHeader(key) {
delete this._headers[key.toLowerCase()]
delete this._headers[key]
return this
}

Expand Down

0 comments on commit ddf9566

Please sign in to comment.