Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing content-type header bug in 204 response parsing #3052

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/graph/batching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ function parseResponse(graphResponse: IGraphBatchResponse): ParsedGraphResponse
// we create the request id by adding 1 to the index, so we place the response by subtracting one to match
// the array of requests and make it easier to map them by index
const responseId = parseInt(response.id, 10) - 1;
const contentType = response.headers["Content-Type"];
const { status, statusText, headers, body } = response;
const init = { status, statusText, headers };

Expand All @@ -395,7 +394,7 @@ function parseResponse(graphResponse: IGraphBatchResponse): ParsedGraphResponse
// eslint-disable-next-line @typescript-eslint/dot-notation
parsedResponses[responseId] = new Response(jsS({ location: headers["Location"] || "" }), init);

} else if (status === 200 && /^image[\\|/]/i.test(contentType)) {
} else if (status === 200 && /^image[\\|/]/i.test(headers["Content-Type"] || "")) {

// this handles the case where image content is returned as base 64 data in the batch body, such as /me/photos/$value (https://github.com/pnp/pnpjs/issues/2825)

Expand Down
Loading