Skip to content

Commit

Permalink
fix: ensure response header value is string type (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
etamity authored Oct 14, 2021
1 parent e2235bb commit cb4b0e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions __tests__/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ describe.each(EACH_MATRIX)('%s:%s: integration tests', (eventSourceName, framewo
const expectedResponse = makeResponse({
eventSourceName,
multiValueHeaders: {
'content-length': [151],
'content-length': ['151'],
'content-security-policy': ["default-src 'none'"],
'content-type': ['text/html; charset=utf-8'],
'x-content-type-options': ['nosniff']
Expand Down Expand Up @@ -223,7 +223,7 @@ describe.each(EACH_MATRIX)('%s:%s: integration tests', (eventSourceName, framewo
multiValueHeaders: {
'accept-ranges': ['bytes'],
'cache-control': ['public, max-age=0'],
'content-length': [15933],
'content-length': ['15933'],
'content-type': ['image/png']
},
isBase64Encoded: true
Expand Down
2 changes: 1 addition & 1 deletion src/event-sources/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function getMultiValueHeaders ({ headers }) {
const multiValueHeaders = {}

Object.entries(headers).forEach(([headerKey, headerValue]) => {
const headerArray = Array.isArray(headerValue) ? headerValue : [headerValue]
const headerArray = Array.isArray(headerValue) ? headerValue.map(String) : [String(headerValue)]

multiValueHeaders[headerKey.toLowerCase()] = headerArray
})
Expand Down

0 comments on commit cb4b0e8

Please sign in to comment.