jest-fetch-mock icon indicating copy to clipboard operation
jest-fetch-mock copied to clipboard

How to remove response body? (No "")

Open dav1app opened this issue 1 year ago • 0 comments

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?

dav1app avatar Apr 19 '23 21:04 dav1app