When I test the endpoint on Mashape, it works perfectly. However, running the same Node sample code from within the node environment produces an error response with ‘Invalid Request’ body.
Why is this ? Is there something I am doing wrongly?
Partecipa alla discussione - aggiungi un commento di seguito:
The response is binary data, so you can’t decode it as a string. you have to save the bytes from the response to a file.
Thanks yogthos. I got a fix sometime later from the mashape team.
There’s yet another issue which i’m sure you can answer. When i get the response from the endpoint, it comes in a format ready to be saved as per the headr field ‘Content-disposition: filename=document.pdf’.
Can you please tell what encoding is used to the response? I have tried ‘base64’, ‘utf8’ as well as ‘ascii’.
Looking forward to your response.
Thaks
I’m not really familiar with Node myself, but you might want to compare the request generated by node to the test request using
curl
. You have to make sure you’re including your mashape key header and so on.