wheresrhys / fetch-mock

Mock http requests made using fetch
http://www.wheresrhys.co.uk/fetch-mock/
MIT License
1.26k stars 175 forks source link

Poor experience inspecting based on body #577

Closed wheresrhys closed 1 month ago

wheresrhys commented 4 years ago

these do not work

fetchMock.called({body: myObject})
fetchMock.called('*', {body: myObject})
fetchMock.called('*', {body: JSON.stringify(myObject)})

What does?

JSON.parse(fetchMock.lastCall('*').options.body) ~= myObject

Not a very nice API

moberegger commented 3 years ago

I've been beating my head against this too.

Biggest problem for me is the for some reason the body is wrapped in a promise and I don't understand why.