Skip to content

Commit 33bae0e

Browse files
Update index.ts
1 parent c453025 commit 33bae0e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ export class TempMail {
1717
private async makeRequest(url: string, post_data?: any, method?: "POST" | "GET" | "DELETE"): Promise<any> {
1818

1919
let headers = {
20-
"User-Agent": "TempMailJS/4.1.0"
20+
"User-Agent": "TempMailJS/4.3.0"
2121
};
2222

2323
//if the user is a TempMail Plus subscriber, add the credentials here
2424
if(this.api_key) {
2525
headers["Authorization"] = "Bearer " + this.api_key;
2626
}
27+
28+
if(method && method === "POST" && post_data) {
29+
headers["Content-Type"] = "application/json";
30+
}
2731

2832
const raw = await fetch(BASE_URL + url, {
2933
headers,

0 commit comments

Comments
 (0)