mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-26 17:01:05 -06:00
content-type change
This commit is contained in:
parent
5809088f27
commit
6537f4fe74
@ -249,28 +249,18 @@ class Monitor extends BeanModel {
|
||||
|
||||
log.debug("monitor", `[${this.name}] Prepare Options for axios`);
|
||||
|
||||
|
||||
|
||||
// Check if this.headers already contains a content-type header set by the user; if so, don't inject one
|
||||
let contentTypeUserDefinedHeader = this.headers.find(function(header) {
|
||||
return header[0].toLowerCase() == "content-type";
|
||||
});
|
||||
|
||||
let contentType = contentTypeUserDefinedHeader ?
|
||||
contentTypeUserDefinedHeader[1] :
|
||||
null;
|
||||
|
||||
let contentType = null;
|
||||
let bodyValue = null;
|
||||
|
||||
if (this.body && !this.httpBodyEncoding || this.httpBodyEncoding === "json") {
|
||||
bodyValue = JSON.parse(this.body);
|
||||
contentType = contentType ? contentType : "application/json";
|
||||
contentType = "application/json";
|
||||
} else if (this.body && (this.httpBodyEncoding === "xml")) {
|
||||
bodyValue = this.body;
|
||||
contentType = contentType ? contentType : "text/xml";
|
||||
contentType = "text/xml";
|
||||
} else if (this.body && (this.httpBodyEncoding === "form")) {
|
||||
bodyValue = this.body;
|
||||
contentType = contentType ? contentType : "application/x-www-form-urlencoded";
|
||||
contentType = "application/x-www-form-urlencoded";
|
||||
}
|
||||
|
||||
const options = {
|
||||
|
Loading…
Reference in New Issue
Block a user