Signed-off-by: gcalvino <guillermo.calvinosanchez@altran.com>
Change-Id: I5ff3d95d34780410e233f31b8e8a52e198912457
from osmclient.common import utils
import json
import magic
from osmclient.common import utils
import json
import magic
+from os.path import basename
-#from os.path import basename
raise ClientException(
"failed to guess MIME type for file '{}'".format(filename))
headers= self._client._headers
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'
elif mime_type in ['application/gzip', 'application/x-gzip']:
headers['Content-Type'] = 'application/gzip'
#headers['Content-Type'] = 'application/binary'
from osmclient.common import utils
import json
import magic
from osmclient.common import utils
import json
import magic
+from os.path import basename
-#from os.path import basename
raise ClientException(
"failed to guess MIME type for file '{}'".format(filename))
headers= self._client._headers
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'
elif mime_type in ['application/gzip', 'application/x-gzip']:
headers['Content-Type'] = 'application/gzip'
#headers['Content-Type'] = 'application/binary'