Change JSON MIME type to application/json (#311)

This commit is contained in:
Merlin Schumacher
2018-07-24 20:13:14 +02:00
committed by Me No Dev
parent 1078e9166b
commit fc71230a31
4 changed files with 5 additions and 5 deletions

View File

@ -717,7 +717,7 @@ This way of sending Json is great for when the result is below 4KB
#include "ArduinoJson.h"
AsyncResponseStream *response = request->beginResponseStream("text/json");
AsyncResponseStream *response = request->beginResponseStream("application/json");
DynamicJsonBuffer jsonBuffer;
JsonObject &root = jsonBuffer.createObject();
root["heap"] = ESP.getFreeHeap();
@ -1126,7 +1126,7 @@ server.on("/scan", HTTP_GET, [](AsyncWebServerRequest *request){
}
}
json += "]";
request->send(200, "text/json", json);
request->send(200, "application/json", json);
json = String();
});
```

View File

@ -57,7 +57,7 @@ class AsyncJsonResponse: public AsyncAbstractResponse {
public:
AsyncJsonResponse(bool isArray=false): _isValid{false} {
_code = 200;
_contentType = "text/json";
_contentType = "application/json";
if(isArray)
_root = _jsonBuffer.createArray();
else

View File

@ -477,7 +477,7 @@ void SPIFFSEditor::handleRequest(AsyncWebServerRequest *request){
dir.close();
#endif
output += "]";
request->send(200, "text/json", output);
request->send(200, "application/json", output);
output = String();
}
else if(request->hasParam("edit") || request->hasParam("download")){

View File

@ -483,7 +483,7 @@ void AsyncFileResponse::_setContentType(const String& path){
if (path.endsWith(".html")) _contentType = "text/html";
else if (path.endsWith(".htm")) _contentType = "text/html";
else if (path.endsWith(".css")) _contentType = "text/css";
else if (path.endsWith(".json")) _contentType = "text/json";
else if (path.endsWith(".json")) _contentType = "application/json";
else if (path.endsWith(".js")) _contentType = "application/javascript";
else if (path.endsWith(".png")) _contentType = "image/png";
else if (path.endsWith(".gif")) _contentType = "image/gif";