mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-21 23:43:08 +08:00
fix(edit-monitor): store headers as JSON
This commit is contained in:
@@ -285,8 +285,8 @@ export default {
|
||||
Body: "Body",
|
||||
Headers: "Headers",
|
||||
PushUrl: "Push URL",
|
||||
HeadersInvalidFormat: "Headers do not have a valid format: \"key: value <new line> key: value <new line>...\"",
|
||||
HeadersInvalidFormat: "The request headers are not valid JSON: ",
|
||||
BodyInvalidFormat: "The request body is not valid JSON: ",
|
||||
BodyPlaceholder: "{\n\t\"id\": 124357,\n\t\"username\": \"admin\",\n\t\"password\": \"myAdminPassword\"\n}",
|
||||
HeadersPlaceholder: "Authorization: Bearer abc123\nContent-Type: application/json",
|
||||
HeadersPlaceholder: "{\n\t\"Authorization\": \"Bearer abc123\",\n\t\"Content-Type\": \"application/json\"\n}",
|
||||
};
|
||||
|
@@ -202,8 +202,8 @@ export default {
|
||||
Body: "Body",
|
||||
Headers: "Headers",
|
||||
PushUrl: "Push URL",
|
||||
HeadersInvalidFormat: "Headers hebben een incorrect formaat: \"key: waarde <new line> key: waarde <new line>...\"",
|
||||
HeadersInvalidFormat: "The request headers is geen geldige JSON: ",
|
||||
BodyInvalidFormat: "De request body is geen geldige JSON: ",
|
||||
BodyPlaceholder: "{\n\t\"id\": 124357,\n\t\"gebruikersnaam\": \"admin\",\n\t\"wachtwoord\": \"mijnAdminWachtwoord\"\n}",
|
||||
HeadersPlaceholder: "Authorization: Bearer abc123\nContent-Type: application/json",
|
||||
HeadersPlaceholder: "{\n\t\"Authorization\": \"Bearer abc123\",\n\t\"Content-Type\": \"application/json\"\n}",
|
||||
};
|
||||
|
@@ -442,8 +442,10 @@ export default {
|
||||
}
|
||||
}
|
||||
if (this.monitor.headers) {
|
||||
if (!/^([^:]+:.*)([\s]+[^:]+:.*)*$/g.test(this.monitor.headers)) {
|
||||
toast.error(this.$t("HeadersInvalidFormat"));
|
||||
try {
|
||||
JSON.parse(this.monitor.headers);
|
||||
} catch (err) {
|
||||
toast.error(this.$t("HeadersInvalidFormat") + err.message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user