removed OriginHeader method in Multipart view 79/40079/2
authorSudhakarReddy <Sudhakar.reddy@amdocs.com>
Thu, 29 Mar 2018 07:36:07 +0000 (13:06 +0530)
committerSudhakarReddy <Sudhakar.reddy@amdocs.com>
Thu, 29 Mar 2018 08:54:22 +0000 (14:24 +0530)
Change-Id: I5ba662e052ddfbcce1247c2cc3b048ab9e64c50b
Issue-ID: MULTICLOUD-180
Signed-off-by: SudhakarReddy <Sudhakar.reddy@amdocs.com>
multivimbroker/multivimbroker/forwarder/views.py
multivimbroker/multivimbroker/pub/utils/restcall.py

index a5dd22c..c66a6f1 100644 (file)
@@ -15,6 +15,7 @@
 
 import os
 import json
+import re
 import tempfile
 from poster.encode import multipart_encode
 from poster.streaminghttp import register_openers
@@ -177,8 +178,12 @@ class MultiPartView(BaseServer):
                 fileObj.file.close()
                 params[key] = open(f.name, 'rb')
             datagen, headers = multipart_encode(params)
+            regex = re.compile('^HTTP_')
+            for key, value in request.META.iteritems():
+                if key.startswith("HTTP_"):
+                    headers[regex.sub('', key).replace('_', '-')] = value
             resp = self.send(vimid, request.path, datagen, "POST",
-                             headers=originHeaders(request))
+                             headers=headers)
         finally:
             for key in params:
                 fileRef = params[key]
index c839f61..046d77c 100644 (file)
@@ -54,7 +54,7 @@ def call_multipart_req(base_url, user, passwd, auth_type, resource, method,
         else:
             ret = [1, resp.read(), resp.code, resp]
     except urllib2.URLError as err:
-        ret = [2, str(err), resp.code, resp]
+        ret = [2, str(err), 500, resp]
     except Exception:
         logger.error(traceback.format_exc())
         logger.error("[%s]ret=%s" % (callid, str(sys.exc_info())))

© 2017 ONAP. Copyright © The Linux Foundation ®. All Rights Reserved.
The Linux Foundation has registered trademarks and uses trademarks.
For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.
Linux is a registered trademark of Linus Torvalds.
Privacy Policy and Terms of Use