Skip to content
Snippets Groups Projects
Commit b5de2ddc authored by Cyril Danilevski's avatar Cyril Danilevski :scooter:
Browse files

Set correct mime-type for json data

parent 562f55e0
No related branches found
No related tags found
No related merge requests found
Pipeline #167689 passed
......@@ -91,7 +91,7 @@ void identify() {
message += "\n}";
restServer.send(418, "text/json", message);
restServer.send(418, "application/json", message);
}
void panel() {
......@@ -117,7 +117,7 @@ void notFound() {
}
message += "\n}\n}";
restServer.send(404, "text/json", message);
restServer.send(404, "application/json", message);
Serial.println(message);
}
......@@ -134,7 +134,8 @@ enum {
void sendSNMP() {
if (PINS.ramping) {
restServer.send(403, "text/json", "{\"success\": 0, \"reason\": \"ramping ongoing\"}");
restServer.send(403, "application/json",
"{\"success\": 0, \"reason\": \"ramping ongoing\"}");
return;
}
uint8_t output = NONE;
......@@ -180,21 +181,23 @@ void sendSNMP() {
http_msg += "\n}";
restServer.send(success ? 200 : 406, "text/json", http_msg);
restServer.send(success ? 200 : 406, "application/json", http_msg);
}
void getMpodStatus() {
if (PINS.ramping) {
restServer.send(403, "text/json", "{\"success\": 0, \"reason\": \"ramping ongoing\"}");
restServer.send(403, "application/json",
"{\"success\": 0, \"reason\": \"ramping ongoing\"}");
return;
}
restServer.send(200, "text/json", pproc.toJSON());
restServer.send(200, "application/json", pproc.toJSON());
}
void powerGroup() {
if (PINS.ramping) {
restServer.send(403, "text/json", "{\"success\": 0, \"reason\": \"ramping ongoing\"}");
restServer.send(403, "application/json",
"{\"success\": 0, \"reason\": \"ramping ongoing\"}");
return;
}
String output;
......@@ -247,12 +250,13 @@ void powerGroup() {
}
http_msg += "\n}";
restServer.send(success ? 200 : 406, "text/json", http_msg);
restServer.send(success ? 200 : 406, "application/json", http_msg);
}
void powerAllOff() {
if (PINS.ramping) {
restServer.send(403, "text/json", "{\"success\": 0, \"reason\": \"ramping ongoing\"}");
restServer.send(403, "application/json",
"{\"success\": 0, \"reason\": \"ramping ongoing\"}");
return;
}
String group;
......@@ -290,7 +294,7 @@ void powerAllOff() {
// }
http_msg += "\n}";
restServer.send(success ? 200 : 406, "text/json", http_msg);
restServer.send(success ? 200 : 406, "application/json", http_msg);
}
void pollMPODChannel() {
......@@ -328,5 +332,5 @@ void pollMPODChannel() {
http_msg += ret;
http_msg += "}";
restServer.send(channel ? 200 : 406, "text/json", http_msg);
restServer.send(channel ? 200 : 406, "application/json", http_msg);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment