Skip to content

Commit 7af1de7

Browse files
committed
test: 💍 added headers test
1 parent e98e620 commit 7af1de7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/core/__tests__/features/client/client.utils.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ describe("Client [ Utils ]", () => {
151151

152152
describe("When using headerMapper", () => {
153153
it("should assign default headers with headers mapper", async () => {
154-
const defaultHeaders = { "Content-Type": "application/json" };
154+
const defaultHeaders = {};
155155
const headers = client.adapter.unstable_headerMapper(request, undefined);
156156

157157
expect(headers).toEqual(defaultHeaders);
@@ -169,6 +169,14 @@ describe("Client [ Utils ]", () => {
169169
const formDataRequest = request.setHeaders(defaultHeaders);
170170
const headers = client.adapter.unstable_headerMapper(formDataRequest, undefined);
171171

172+
expect(headers).toEqual(defaultHeaders);
173+
});
174+
it("should add content type header for object payload", async () => {
175+
const defaultHeaders = { "Content-Type": "application/json" };
176+
const data = { data: [] } as any;
177+
const formDataRequest = request.setPayload(data);
178+
const headers = client.adapter.unstable_headerMapper(formDataRequest, undefined);
179+
172180
expect(headers).toEqual(defaultHeaders);
173181
});
174182
});

0 commit comments

Comments
 (0)