Saturday, 18 March 2017

Why is the body of the node request is always a string?

I am trying to use a npm package to do API GET calls in node. However, for some reasons, no matter what, the body of the request is always a string (instead of an object or array). Anyone know why that is the case and what can I do to stop it from doing that?

Example (this API is supposed to return an array, yet the body is a string): body: '["I call this turf ‘n’ turf. It\'s a 16 oz T-bone and a 24 oz porterhouse. Also, whiskey and a cigar. I am going to consume all of this at the same time because I am a free American."]'



via Chris Wang

No comments:

Post a Comment