Because the Cloudant Promises plugin always stringifies response body (unlike the underlying Nano relax() method), Non-UTF-able binary responses (e.g. PDF attachment data) are converted to Strings and corrupted in the process.
It is still possible to access the underlying Buffer data by supplying a callback (bypassing the plugin handler).
1. Steps to reproduce and the simplest code sample possible to demonstrate the issue
Cloudant Promises plugin behaves consistently with the underlying nanorelax() and getAtt methods: getAtt internally sets request parameter dontParse: true for attachment requests, and this param is respected by the underlying request/response agent.
3. What actually happened
Cloudant's own request handler promisification JSON.stringify()s all responses, damaging non-UTFable data
Bug Description
Because the Cloudant Promises plugin always stringifies response body (unlike the underlying Nano
relax()
method), Non-UTF-able binary responses (e.g. PDF attachment data) are converted to Strings and corrupted in the process.It is still possible to access the underlying Buffer data by supplying a callback (bypassing the plugin handler).
1. Steps to reproduce and the simplest code sample possible to demonstrate the issue
2. What you expected to happen
Cloudant Promises plugin behaves consistently with the underlying
nano
relax()
andgetAtt
methods: getAtt internally sets request parameterdontParse: true
for attachment requests, and this param is respected by the underlying request/response agent.3. What actually happened
Cloudant's own request handler promisification
JSON.stringify()
s all responses, damaging non-UTFable dataEnvironment details