Skip to content

Commit

Permalink
added test case for undefined handling of init.body
Browse files Browse the repository at this point in the history
  • Loading branch information
hogpilot committed Mar 17, 2021
1 parent 08f5a18 commit e82f3fe
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,19 @@ test('handles json body init options', async function (test) {
test.deepEqual(axiosBody.headers['content-type'], expectedBody.headers['content-type']);
});

test('handles undefined body in init options', async function (test) {
const init = {
method: 'POST',
body: undefined
};
const { expectedResponse, axiosResponse } = await dualFetch(`${TEST_URL_ROOT}/body`, init);

const expectedBody = await expectedResponse.json();
const axiosBody = await axiosResponse.json();

test.deepEqual(axiosBody.body, expectedBody.body);
});

test('returns the expected response on a multipart request', async function (test) {
const data = new FormData();
data.append('key', 'value');
Expand Down

0 comments on commit e82f3fe

Please sign in to comment.