-
-static const char http_html_hdr_200[] = "HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n";
-static const char http_html_hdr_404[] = "HTTP/1.0 404 Not Found\r\nContent-type: text/html\r\n\r\n";
-static const char http_html_hdr_500[] = "HTTP/1.0 500 Internal Server Error\r\nContent-type: text/html\r\n\r\n";
+static struct { const char *key; const char *content; } http_content_type[] =
+{
+ {"", "Content-type: application/json\r\n\r\n"},
+ {"htm", "Content-type: text/html\r\n\r\n"},
+ {"css", "Content-type: text/css\r\n\r\n"},
+ {"js", "Content-type: text/javascript\r\n\r\n"},
+ {"png", "Content-type: image/png\r\n\r\n"},
+ {"jpg", "Content-type: image/jpeg\r\n\r\n"},
+ {"gif", "Content-type: image/gif\r\n\r\n"},
+ {"txt", "Content-type: text/plain\r\n\r\n"},
+};
+
+static const char http_html_hdr_200[] = "HTTP/1.0 200 OK\r\n";
+static const char http_html_hdr_404[] = "HTTP/1.0 404 Not Found\r\n";
+static const char http_html_hdr_500[] = "HTTP/1.0 500 Internal Server Error\r\n";