The boundary separator can be extracted from the Content-Type response header.
The response body should be split based on that.
Per response body, the initial Content-Type and Content-Transfer-Encoding headers should be stripped out.
The remaining HTTP headers should be parsed and checked ( e.g req.status >= 200) && (req.status < 300 )
If the response type is application/json the body should then be parsed by JSON.parse.
Given I want to select multiple gets in a batch operation ( and I have PR #24 ) I receive the error
Uncaught SyntaxError: Unexpected number in JSON at position 1
What I expect is an array which contains the result of each inner response body.
Steps to reproduce:
It appears xrm-webapi attempts to parse the entire response as JSON when first it should split and extract each individual response body first.
Example response from CRM that is passed to
JSON.parse
The boundary separator can be extracted from the
Content-Type
response header. The response body should be split based on that. Per response body, the initialContent-Type
andContent-Transfer-Encoding
headers should be stripped out. The remaining HTTP headers should be parsed and checked ( e.greq.status >= 200) && (req.status < 300
) If the response type isapplication/json
the body should then be parsed by JSON.parse.