From 2e8d5671d77c000a0a6c0859e83bcfb5e4e5189b Mon Sep 17 00:00:00 2001 From: Patrick Rodgers Date: Mon, 3 Jun 2024 10:28:30 -0400 Subject: [PATCH] fixing content-type header bug in 204 response parsing --- packages/graph/batching.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/graph/batching.ts b/packages/graph/batching.ts index fd85bd9bc..c43158ee2 100644 --- a/packages/graph/batching.ts +++ b/packages/graph/batching.ts @@ -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 }; @@ -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)