Browse Source

server: send JSON as 'application/json' with 'Content-Disposition: inline'

Helge Jung 9 years ago
parent
commit
03afff1d90
1 changed files with 6 additions and 3 deletions
  1. 6 3
      ffstatus/server.py

+ 6 - 3
ffstatus/server.py

@@ -252,7 +252,8 @@ class BatcaveHttpRequestHandler(BaseHTTPRequestHandler):
             return
 
         # dump node data as JSON
-        self.__send_headers('text/json')
+        self.__send_headers('application/json',
+                            extra={'Content-Disposition': 'inline'})
         self.wfile.write(json.dumps(node))
 
     def __respond_nodestatus(self, rawid):
@@ -310,7 +311,8 @@ class BatcaveHttpRequestHandler(BaseHTTPRequestHandler):
             value = len(value)
 
         no_json = isinstance(value, basestring) or isinstance(value, int)
-        self.__send_headers('text/plain' if no_json else 'text/json')
+        self.__send_headers('text/plain' if no_json else 'application/json',
+                            extra={'Content-Disposition': 'inline'})
         self.wfile.write(value if no_json else json.dumps(value))
 
     def __respond_vpn(self, query):
@@ -476,7 +478,8 @@ class BatcaveHttpRequestHandler(BaseHTTPRequestHandler):
                 self.wfile.write('{0};"{1}"\n'.format(isps[isp], isp))
 
         elif outputformat == 'json':
-            self.__send_headers('text/json')
+            self.__send_headers('application/json',
+                                extra={'Content-Disposition': 'inline'})
 
             data = [
                 {