Humanoid icon indicating copy to clipboard operation
Humanoid copied to clipboard

Fixes invalid body returned for JSON APIs

Open kr-mohak opened this issue 4 years ago • 0 comments

About the fix

This minor fix changes how JSON responses are stringified. Instead of using .toString(), we use JSON.stringify when dataType="json"

Original Issue:

Currently, if I call a JSON REST API with dataType="json", the response object returned by humanoid is as follows:

{
  statusCode: 200,
  statusMessage: 'OK',
  body: '[object Object]'
}

But the expected response would be:

{
  statusCode: 200,
  statusMessage: 'OK',
  body: '{"data": "all the data"}'
}

kr-mohak avatar Jul 01 '21 09:07 kr-mohak