Skip to content

Fix #167 #168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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