Skip to content

Commit

Permalink
fixing content-type header bug in 204 response parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-rodgers committed Jun 3, 2024
1 parent 74f1783 commit cc1e8ba
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/graph/batching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,6 @@ function parseResponse(graphResponse: IGraphBatchResponse): ParsedGraphResponse
// 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 @@ -397,7 +395,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

0 comments on commit cc1e8ba

Please sign in to comment.