Skip to content

Commit cb4b0e8

Browse files
authored
fix: ensure response header value is string type (#474)
1 parent e2235bb commit cb4b0e8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

__tests__/integration.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ describe.each(EACH_MATRIX)('%s:%s: integration tests', (eventSourceName, framewo
168168
const expectedResponse = makeResponse({
169169
eventSourceName,
170170
multiValueHeaders: {
171-
'content-length': [151],
171+
'content-length': ['151'],
172172
'content-security-policy': ["default-src 'none'"],
173173
'content-type': ['text/html; charset=utf-8'],
174174
'x-content-type-options': ['nosniff']
@@ -223,7 +223,7 @@ describe.each(EACH_MATRIX)('%s:%s: integration tests', (eventSourceName, framewo
223223
multiValueHeaders: {
224224
'accept-ranges': ['bytes'],
225225
'cache-control': ['public, max-age=0'],
226-
'content-length': [15933],
226+
'content-length': ['15933'],
227227
'content-type': ['image/png']
228228
},
229229
isBase64Encoded: true

src/event-sources/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function getMultiValueHeaders ({ headers }) {
5959
const multiValueHeaders = {}
6060

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

6464
multiValueHeaders[headerKey.toLowerCase()] = headerArray
6565
})

0 commit comments

Comments
 (0)