When mocking a response with MockAgent
errors are different from a real request
#1546
Labels
bug
Something isn't working
Bug Description
When mocking a response with
MockAgent
errors are different from a real request. For example, if you try to getbody.json()
from a non-JSON body,MockAgent
will throwTypeError: this[kAbort] is not a function
while real request will returnSyntaxError: Unexpected token < in JSON at position 0
Reproducible By
The following code will throw
But if you remove mocking, then the result will be
Expected Behavior
Both real and mocked responses should return the same error in the situation described above.
Environment
The text was updated successfully, but these errors were encountered: