mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 11:25:50 -06:00
perf(gateway): avoid single-chunk request body copy (#127783)
Amp-Thread-ID: https://ampcode.com/threads/T-01a021f5-984a-7628-a30c-491c166ff247 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
committed by
GitHub
parent
80beef6ff7
commit
15569b210e
@@ -434,7 +434,13 @@ export async function readRequestBodyWithLimit(
|
||||
|
||||
const onEnd = () => {
|
||||
ended = true;
|
||||
finish(() => resolve(Buffer.concat(chunks).toString(encoding)));
|
||||
finish(() =>
|
||||
resolve(
|
||||
chunks.length === 1
|
||||
? chunks[0]!.toString(encoding)
|
||||
: Buffer.concat(chunks).toString(encoding),
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
const onError = (error: Error) => {
|
||||
|
||||
Reference in New Issue
Block a user