File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
packages/core/src/http-adapter Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments