Skip to content

Commit

Permalink
fix: http parser set response (#545)
Browse files Browse the repository at this point in the history
  • Loading branch information
echosoar committed Jul 20, 2020
1 parent a0cdf69 commit 74a854d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/serverless-http-parser/src/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ export const response = {
* @api public
*/
set(field, val?) {
if (val) {
if (val !== undefined) {
if (Array.isArray(val))
val = val.map(v => (typeof v === 'string' ? v : String(v)));
else if (typeof val !== 'string') val = String(val);
this.res.setHeader(field, val);
} else {
} else if (typeof field !== 'string') {
for (const key in field) {
this.set(key, field[key]);
}
Expand Down

0 comments on commit 74a854d

Please sign in to comment.