-
-
Notifications
You must be signed in to change notification settings - Fork 737
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
Octet-stream response bodies should be decoded to a hex Buffer #1021
Comments
Hey @kevinburke can you check if #1067 fixes your problem? |
Apologies but I've since moved on from that engagement and probably won't have time to test :( best of luck! A way to test would probably be to start with the JSON I put up above, read it back into memory, and verify the length of the buffer in memory matches the Content-Length header. |
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! |
I have a server that responds with binary data and an octet-stream header:
The response is a Buffer, so nock converts it to hex before storing in a file. I've truncated the response here and above, but it should be enough to get the idea.
When reading back from the file, I expect it to be converted back into a Buffer via Buffer.from(response.body, 'hex'). Instead it gets converted into a normal Buffer, e.g. the first byte is 'f', the second byte is '0', instead of one byte
0xf0
.I can work around this for the time being by setting
Content-Encoding: identity
, which triggers the right nock logic. But it would seem preferable to e.g. read theapplication/octet-stream
response header and try to convert from hex based on that.The text was updated successfully, but these errors were encountered: