This is an automated email from the ASF dual-hosted git repository.

mrutkowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-runtime-docker.git


The following commit(s) were added to refs/heads/master by this push:
     new 950ccf0  Fix bug in knative raw handler
     new f18fa01  Merge pull request #83 from pwplusnick/raw_fix
950ccf0 is described below

commit 950ccf0f6e59e8219acd523bb9f92525a48bfa1f
Author: Will Plusnick <[email protected]>
AuthorDate: Thu Feb 27 10:15:47 2020 -0600

    Fix bug in knative raw handler
---
 core/actionProxy/owplatform/knative.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/core/actionProxy/owplatform/knative.py 
b/core/actionProxy/owplatform/knative.py
index fe89334..23ff832 100644
--- a/core/actionProxy/owplatform/knative.py
+++ b/core/actionProxy/owplatform/knative.py
@@ -108,7 +108,7 @@ def preProcessHTTPContext(msg, valueData):
             tmpBody = msg.get('value', {})
             removeInitData(tmpBody)
             bodyStr = str(tmpBody)
-            valueData['__ow_body'] = base64.b64encode(bodyStr)
+            valueData['__ow_body'] = base64.b64encode(bodyStr.encode())
         valueData['__ow_query'] = flask.request.query_string
 
     namespace = ''
@@ -116,7 +116,7 @@ def preProcessHTTPContext(msg, valueData):
         namespace = os.getenv('__OW_NAMESPACE')
     valueData['__ow_user'] = namespace
     valueData['__ow_method'] = flask.request.method
-    valueData['__ow_headers'] = flask.request.headers
+    valueData['__ow_headers'] = { k: v for k, v in 
flask.request.headers.items() }
     valueData['__ow_path'] = ''
 
 def preProcessActivationData(activationData):
@@ -239,21 +239,18 @@ class KnativeImpl:
                 message['init'] = createInitDataFromEnvironment()
                 dedicated_runtime = True
 
+            preProcessRequest(message)
             if hasInitData(message) and hasActivationData(message) and not 
dedicated_runtime:
-                preProcessRequest(message)
                 self.initCode(message)
                 removeInitData(message)
                 response = self.runCode(message)
                 response = postProcessResponse(request_headers, response)
             elif hasInitData(message) and not dedicated_runtime:
-                preProcessRequest(message)
                 response = self.initCode(message)
             elif hasActivationData(message) and not dedicated_runtime:
-                preProcessRequest(message)
                 response = self.runCode(message)
                 response = postProcessResponse(request_headers, response)
             else:
-                preProcessRequest(message)
                 # This is for the case when it is a dedicated runtime, but has 
not yet been
                 # initialized from the environment
                 if dedicated_runtime and self.proxy.initialized is False:

Reply via email to