Change content-type header to text/plain for yaml and json files
[osm/osmclient.git] / osmclient / sol005 / nsd.py
index 63308d6..6a18828 100644 (file)
@@ -23,8 +23,9 @@ from osmclient.common.exceptions import ClientException
 from osmclient.common import utils
 import json
 import magic
+from os.path import basename
 #from os import stat
-#from os.path import basename
+
 
 class Nsd(object):
 
@@ -126,8 +127,9 @@ class Nsd(object):
             raise ClientException(
                      "failed to guess MIME type for file '{}'".format(filename))
         headers= self._client._headers
-        if mime_type in ['application/yaml', 'text/plain']:
-            headers['Content-Type'] = 'application/yaml'
+        headers['Content-Filename'] = basename(filename)
+        if mime_type in ['application/yaml', 'text/plain', 'application/json']:
+            headers['Content-Type'] = 'text/plain'
         elif mime_type in ['application/gzip', 'application/x-gzip']:
             headers['Content-Type'] = 'application/gzip'
             #headers['Content-Type'] = 'application/binary'