-
Notifications
You must be signed in to change notification settings - Fork 87
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
Uncaught exception when canceling a request while sending body #120
Comments
After further inspection, the unhandled rejection originates from the
In cases where the Side note: I realized that mocha is incorrectly surfacing unhandled rejection. The handled rejections are currently silenced by mocha, which isn't ideal. There is a whole thread discussing this issue mochajs/mocha#2640. That said it's unclear to me whether or not the mocha team will attempt to fix this. In the meantime, I would recommend rethrowing the unhandled promise rejection to force tests to fail. |
Good find! I think it would be reasonable to fix this by just catching the error while recording, and storing only the data we did receive in that case (dropping/truncating the body on a best-efforts basis). For request recording I think that's OK, we don't want/need to be too strict, and although this is an error it should give us a perfectly usable representation of received data, which might well be useful to have in tests. If you're running into this yourself, do you want to take a look? Covering this explicitly en route with a test for this case would be helpful too.
Sure, I'd be happy with that as an addition to the test setup, seems like a good idea 👍. I'm sure I've seen issues with failed unhandled rejections with Mocha elsewhere though, where that was failing some of Mockttp's tests... But I can't confirm that, and it would certainly be good to explicitly ensure that that happens. |
Yes, I am on it. |
Observation
Mockttp throws the following uncaught exception when canceling a client HTTP request while sending body:
Repro steps:
Version
14
,16
,18
3.6.1
The text was updated successfully, but these errors were encountered: