Skip to content

Commit

Permalink
Merge branch 'master' into extra-fab-serve-error-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
evanderkoogh committed Oct 20, 2020
2 parents 84d3aba + ddd1c1f commit e02a5fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ async function streamResponse(fetch_res: Response, res: ExpressResponse) {
res.set(header, values.length === 1 ? values[0] : values)
})

const shouldSetChunkedTransferEncoding =
!response_headers['content-length'] && !response_headers['transfer-encoding']
const body = fetch_res.body
if (body) {
if (typeof body.getReader === 'function') {
if (!response_headers['transfer-encoding']) res.set('transfer-encoding', 'chunked')
if (shouldSetChunkedTransferEncoding) res.set('transfer-encoding', 'chunked')

const reader = body.getReader()
let x
Expand Down

0 comments on commit e02a5fe

Please sign in to comment.