Skip to content

Commit f26c60a

Browse files
committed
minor onResponse hook refactoring
1 parent 02be716 commit f26c60a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const toArray = require('stream-to-array')
77
const defaultProxyHandler = (req, res, url, proxy, proxyOpts) => proxy(req, res, url, proxyOpts)
88
const DEFAULT_METHODS = require('restana/libs/methods').filter(method => method !== 'all')
99
const send = require('@polka/send-type')
10+
const TRANSFER_ENCODING_HEADER_NAME = 'transfer-encoding'
1011

1112
const gateway = (opts) => {
1213
opts = Object.assign({
@@ -103,7 +104,6 @@ const handler = (route, proxy, proxyHandler) => async (req, res, next) => {
103104

104105
const onRequestNoOp = (req, res) => { }
105106
const onResponse = async (req, res, stream) => {
106-
const TRANSFER_ENCODING_HEADER_NAME = 'transfer-encoding'
107107
const chunked = stream.headers[TRANSFER_ENCODING_HEADER_NAME]
108108
? stream.headers[TRANSFER_ENCODING_HEADER_NAME].endsWith('chunked')
109109
: false

0 commit comments

Comments
 (0)