You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
letphotoRequest=newRequest('/me/photo/$value',{method: 'GET'});letmeRequest=newRequest('/me',{method: 'GET'});letbatchRequestContent=newBatchRequestContent([{request: photoRequest,id: '1'},{request: meRequest,id: '2'}]);letcontent=awaitbatchRequestContent.getContent();letresponse=awaitthis.client.api('$batch').post(content);letbatchResponse=newBatchResponseContent(response);letresponses=batchResponse.getResponses();// this worksletblob=awaitresponses.get('1').blob();// this throws exception// Uncaught (in promise) SyntaxError: Unexpected token o in JSON at position 1letme=awaitresponses.get('2').json();// alternative that worksletme=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.
The text was updated successfully, but these errors were encountered:
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]
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.
The text was updated successfully, but these errors were encountered: