Fix mimetype handling in the simle server. Also added a few misisng ones.

This commit is contained in:
Relintai 2022-08-22 14:37:40 +02:00
parent d505f3e59f
commit 2ef28475cd

View File

@ -179,7 +179,7 @@ void HTTPServerConnection::send_file(Ref<WebServerRequest> request, const String
String ctype; String ctype;
String req_ext = p_file_path.get_extension(); String req_ext = p_file_path.get_extension();
if (!_http_server->mimes.has(req_ext)) { if (_http_server->mimes.has(req_ext)) {
ctype = _http_server->mimes[req_ext]; ctype = _http_server->mimes[req_ext];
} else { } else {
ctype = "text/plain"; ctype = "text/plain";
@ -385,7 +385,10 @@ HTTPServerSimple::HTTPServerSimple() {
mimes["pck"] = "application/octet-stream"; mimes["pck"] = "application/octet-stream";
mimes["png"] = "image/png"; mimes["png"] = "image/png";
mimes["svg"] = "image/svg"; mimes["svg"] = "image/svg";
mimes["jpg"] = "image/jpeg";
mimes["jpeg"] = "image/jpeg";
mimes["wasm"] = "application/wasm"; mimes["wasm"] = "application/wasm";
mimes["css"] = "text/css";
server.instance(); server.instance();
stop(); stop();