apify-client-js icon indicating copy to clipboard operation
apify-client-js copied to clipboard

`serializeRequest` performs `JSON.stringify` on a `Buffer`

Open szmarczak opened this issue 3 years ago • 1 comments

https://github.com/apify/apify-client-js/blob/5093b8f98425af8c829478e8df5aeee1d007c283/src/interceptors.ts#L34 https://github.com/apify/apify-client-js/blob/5093b8f98425af8c829478e8df5aeee1d007c283/src/interceptors.ts#L49-L50 https://github.com/apify/apify-client-js/blob/5093b8f98425af8c829478e8df5aeee1d007c283/src/interceptors.ts#L68-L72

I was wondering why I was receiving {"type":"Buffer","data":[...]} instead of actual data... This breaks .call(buffer, { contentType: 'application/json' }).

szmarczak avatar Sep 26 '22 05:09 szmarczak

Passing a string does not work either because axios does this:

https://github.com/axios/axios/blob/892c241773e7dda78a969ac1faa9b365e24f6cc8/lib/defaults/index.js#L119

szmarczak avatar Sep 26 '22 05:09 szmarczak