Skip to content

Commit e4f53af

Browse files
committed
fix: 🐛 lint
1 parent 15d2dc6 commit e4f53af

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/core/src/http-adapter/http-adapter.server.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,14 @@ export const getAdapter = () =>
7272
const payloadAsAny = payload as unknown;
7373
const isString = typeof payloadAsAny === "string";
7474
const isBuffer = Buffer.isBuffer(payloadAsAny);
75-
const contentLength = isString
76-
? Buffer.byteLength(payloadAsAny)
77-
: isBuffer
78-
? payloadAsAny.length
79-
: Buffer.byteLength(JSON.stringify(payloadAsAny));
75+
let contentLength: number;
76+
if (isString) {
77+
contentLength = Buffer.byteLength(payloadAsAny);
78+
} else if (isBuffer) {
79+
contentLength = payloadAsAny.length;
80+
} else {
81+
contentLength = Buffer.byteLength(JSON.stringify(payloadAsAny));
82+
}
8083
options.headers["Content-Length"] = contentLength;
8184
}
8285

0 commit comments

Comments
 (0)