Bug Report
Prerequisites
Description
I'm attempting to use the batching api to get a response for both the /me and the /me/photo/$value endpoint. However, using the .json() method on the me response throws an exception. In contrast, the .blob() on the photo response works. Alternatively, I've been able to get the json of me by going directly to the body of the response, which is no different that making the fetch response myself.
Console Errors: [Is there any console error]
Uncaught (in promise) SyntaxError: Unexpected token o in JSON at position 1
Steps to Reproduce
let photoRequest = new Request('/me/photo/$value', {
method: 'GET'
});
let meRequest = new Request('/me', {
method: 'GET'
});
let batchRequestContent = new BatchRequestContent([
{
request: photoRequest,
id: '1'
},
{
request: meRequest,
id: '2'
}
]);
let content = await batchRequestContent.getContent();
let response = await this.client
.api('$batch')
.post(content);
let batchResponse = new BatchResponseContent(response);
let responses = batchResponse.getResponses();
// this works
let blob = await responses.get('1').blob();
// this throws exception
// Uncaught (in promise) SyntaxError: Unexpected token o in JSON at position 1
let me = await responses.get('2').json();
// alternative that works
let me = response.responses[0].body
Expected behavior: [What you expected to happen]
I expect .json() to work or have documentation for the recommended way to access the response json
Actual behavior: [What actually happened]
.json() throws an exception
Additional context
I've found the batching docs are missing the final example of how to retrieve the content of each request.
Bug Report
Prerequisites
Description
I'm attempting to use the batching api to get a response for both the
/meand the/me/photo/$valueendpoint. However, using the.json()method on the me response throws an exception. In contrast, the.blob()on the photo response works. Alternatively, I've been able to get the json of me by going directly to the body of the response, which is no different that making the fetch response myself.Console Errors: [Is there any console error]
Steps to Reproduce
Expected behavior: [What you expected to happen]
I expect
.json()to work or have documentation for the recommended way to access the response jsonActual behavior: [What actually happened]
.json()throws an exceptionAdditional context
I've found the batching docs are missing the final example of how to retrieve the content of each request.