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
Record & replay binary file response correctly #1067
Conversation
eed00b5
to
1f077e3
Compare
1f077e3
to
8c7d60f
Compare
@n30n0v could you have a look at this? Any thoughts? I wish I could avoid the addition of the new flag but I don’t see a way around it |
a5dc32a
to
08e96d2
Compare
An alternatively could be to prefix the hex-encoded string with something like I also realised that this is only testing the response case, not the request case, I'll extend the test & implementation to cover a binary file upload, too |
I've updated the test to also record a binary upload but that seems to work just fine without any extra handling I'll squash the PR commits once it's good to merge |
6955622
to
2a91075
Compare
Okay this is ready for review. @n30n0v @ierceg In summary, The only alternative I can think of is to prefix the hex string value of |
I'm super exited about this pr! Thank you! |
Thanks for the review @simlu 👍 I’ll move forward and merge that in |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue and add a reference to this one if it’s related. Thank you! |
The way nock currently implements the loading of previously recorded fixtures does not support proper binary responses, as nock cannot differentiate between a binary file encoded as hex string and a simple string. To work around that I've added a new flag to fixtures (
nockDef
):responseIsBinary
.I could not find a better workaround for it, but this works.
closes #1021, closes #1001, closes #524