Skip to content

Commit 6814099

Browse files
authored
[Chore] Avoid Manually Setting Request Content Length (#1266)
* chore(sdk-client-v3): remove request content-length header - remove user-specified request content-lenght header * chore(changeset): release changeset - add release changeset
1 parent 6d813e2 commit 6814099

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

.changeset/flat-cows-double.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@commercetools/ts-client': patch
3+
---
4+
5+
remove content-length headers and allow underlying client to calculate conent length

packages/sdk-client-v3/src/middleware/auth-middleware/auth-request-executor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ export async function executeRequest(options: ExecuteRequestOptions) {
6868
...request.headers,
6969
Authorization: `Basic ${basicAuth}`,
7070
'Content-Type': 'application/x-www-form-urlencoded',
71-
'Content-Length': byteLength(body),
7271
},
7372
httpClient,
7473
httpClientOptions,

packages/sdk-client-v3/src/middleware/create-http-middleware.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,6 @@ export default function createHttpMiddleware(
186186
? request.body
187187
: JSON.stringify(request.body || undefined)
188188

189-
if (body && (typeof body === 'string' || isBuffer(body))) {
190-
requestHeader['Content-Length'] = byteLength(body)
191-
}
192-
193189
const clientOptions: HttpClientOptions = {
194190
enableRetry,
195191
retryConfig,

0 commit comments

Comments
 (0)