Skip to content

Commit b563b6e

Browse files
1 parent c8bab34 commit b563b6e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/fts-http/src/handler.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ async function getParams(
157157
)
158158
}
159159

160-
return getBody(context)
160+
return getBody(context, debug)
161161
}
162162
} else {
163163
let params: any = {}
@@ -225,7 +225,7 @@ async function getParams(
225225
limit: BODY_SIZE_LIMIT
226226
})
227227
} else {
228-
const body = await getBody(context)
228+
const body = await getBody(context, debug)
229229
return JSON.parse(body.toString('utf8'))
230230
}
231231
} else {
@@ -240,14 +240,20 @@ async function getParams(
240240
}
241241
}
242242

243-
async function getBody(context: HttpContext): Promise<Buffer> {
243+
async function getBody(context: HttpContext, debug: boolean): Promise<Buffer> {
244244
const opts: any = {}
245245
const len = context.req.headers['content-length']
246246
const encoding = context.req.headers['content-encoding'] || 'identity'
247247
if (len && encoding === 'identity') {
248248
opts.length = +len
249249
opts.limit = BODY_SIZE_LIMIT
250250
}
251+
252+
if (debug) {
253+
console.log(opts)
254+
console.log(context.req.headers)
255+
}
256+
251257
return (raw(inflate(context.req), opts) as unknown) as Promise<Buffer>
252258
}
253259

0 commit comments

Comments
 (0)