jest-fetch-mock
jest-fetch-mock copied to clipboard
How to remove response body? (No "")
Version: "jest-fetch-mock": "^3.0.3", Node: v18.12.1
fetchMock.mockResponseOnce(null, { status: 400 }) // Returns ""
fetchMock.mockResponseOnce(undefined, { status: 400 }) // Returns ""
fetchMock.mockResponseOnce(() => new Promise((resolve, reject) => reject ({ status: 400}))) // Returns ""
I've also tried to get content-length header ( headers.get('content-length')
) , but it turns out it doesn't mock this property.
How can one get no response body at all? Am I missing something from the docs?