pl-api: Do not set content type when body is not set

Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
mkljczk
2025-03-07 16:20:41 +01:00
parent 29ec032b3f
commit 1062fd61f0
4 changed files with 7 additions and 7 deletions

View File

@ -55,7 +55,7 @@ function request<T = any>(this: Pick<PlApiClient, 'accessToken' | 'baseURL'>, in
const headers = new Headers();
if (this.accessToken) headers.set('Authorization', `Bearer ${this.accessToken}`);
if (contentType !== '') headers.set('Content-Type', contentType);
if (contentType !== '' && body) headers.set('Content-Type', contentType);
if (idempotencyKey) headers.set('Idempotency-Key', contentType);
body = body && contentType === '' ? serialize(body, { indices: true }) : JSON.stringify(body);