From 56202fc5897ddf9f58ddca0d1b9860b6b77765e8 Mon Sep 17 00:00:00 2001 From: gcalvino Date: Tue, 30 Oct 2018 12:16:43 +0100 Subject: [PATCH] Change content-type header to text/plain for yaml and json files Signed-off-by: gcalvino Change-Id: I5ff3d95d34780410e233f31b8e8a52e198912457 --- osmclient/sol005/nsd.py | 8 +++++--- osmclient/sol005/vnfd.py | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/osmclient/sol005/nsd.py b/osmclient/sol005/nsd.py index 63308d6..6a18828 100644 --- a/osmclient/sol005/nsd.py +++ b/osmclient/sol005/nsd.py @@ -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' diff --git a/osmclient/sol005/vnfd.py b/osmclient/sol005/vnfd.py index b239d57..e939efc 100644 --- a/osmclient/sol005/vnfd.py +++ b/osmclient/sol005/vnfd.py @@ -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 Vnfd(object): @@ -125,8 +126,9 @@ class Vnfd(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' -- 2.25.1