Skip to content

Commit 45727eb

Browse files
committed
Returning if the content-type is present else setting content-type as default
1 parent 2b0d381 commit 45727eb

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

package-lock.json

Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GraphRequest.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,14 @@ export class GraphRequest {
314314
this.header("Content-Type", "application/json");
315315
return;
316316
}
317-
let isContentTypePresent = false;
318317
const headerKeys = Object.keys(this._headers);
319318
for (const headerKey of headerKeys) {
320319
if (headerKey.toLowerCase() === "content-type") {
321-
isContentTypePresent = true;
320+
return;
322321
}
323322
}
324323
// Default the content-type to application/json in case the content-type is not present in the header
325-
if (!isContentTypePresent) {
326-
this.header("Content-Type", "application/json");
327-
}
324+
this.header("Content-Type", "application/json");
328325
}
329326

330327
/**

0 commit comments

Comments
 (0)