Added json -> application/json mapping in mime_types.cc in httpserver module to 
make it return
correct application/json response header instead of text/plain. This makes it 
compliant with Swagger
specs of the APIs as well as makes browser-side Javascript to automatically 
parse responses to JSON.

Fixes #833.

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>

---
 modules/httpserver/mime_types.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/httpserver/mime_types.cc b/modules/httpserver/mime_types.cc
index 48e9b68..08d532b 100644
--- a/modules/httpserver/mime_types.cc
+++ b/modules/httpserver/mime_types.cc
@@ -30,6 +30,7 @@ struct mapping {
     { "txt",  "text/plain" },
     { "ico",  "image/x-icon" },
     { "bin",  "application/octet-stream" },
+    { "json",  "application/json" },
 };
 
 std::string extension_to_type(const std::string& extension)
-- 
2.7.4

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to