Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove response body? (No "") #245

Open
dav1app opened this issue Apr 19, 2023 · 0 comments
Open

How to remove response body? (No "") #245

dav1app opened this issue Apr 19, 2023 · 0 comments

Comments

@dav1app
Copy link

dav1app commented Apr 19, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant