openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From csantan...@apache.org
Subject [incubator-openwhisk] branch master updated: Loosen formdata check. (#2637)
Date Thu, 17 Aug 2017 17:54:37 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 7697746  Loosen formdata check. (#2637)
7697746 is described below

commit 769774669d64ba73b2ee2ee47e5a177c962cdaa7
Author: rodric rabbah <rodric@gmail.com>
AuthorDate: Thu Aug 17 13:54:34 2017 -0400

    Loosen formdata check. (#2637)
---
 .../main/scala/whisk/core/controller/WebActions.scala |  2 +-
 .../core/controller/test/WebActionsApiTests.scala     | 19 ++++++++++++-------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/core/controller/src/main/scala/whisk/core/controller/WebActions.scala b/core/controller/src/main/scala/whisk/core/controller/WebActions.scala
index 4d5e006..c963863 100644
--- a/core/controller/src/main/scala/whisk/core/controller/WebActions.scala
+++ b/core/controller/src/main/scala/whisk/core/controller/WebActions.scala
@@ -532,7 +532,7 @@ trait WhiskWebActionsApi
                         process(Some(body), isRawHttpAction)
                     }
 
-                case HttpEntity.Strict(ContentType(MediaTypes.`application/x-www-form-urlencoded`,
Some(HttpCharsets.`UTF-8`)), _) if !isRawHttpAction =>
+                case HttpEntity.Strict(ContentType(MediaTypes.`application/x-www-form-urlencoded`,
_), _) if !isRawHttpAction =>
                     entity(as[FormData]) { form =>
                         val body = form.fields.toMap.toJson.asJsObject
                         process(Some(body), isRawHttpAction)
diff --git a/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala b/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala
index d23ebc1..79ca5a0 100644
--- a/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala
+++ b/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala
@@ -157,12 +157,12 @@ trait WebActionsApiTests extends ControllerTestCommon with BeforeAndAfterEach
wi
 
     behavior of "Web actions API"
 
-    var failActionLookup = false                        // toggle to cause action lookup
to fail
-    var failActivation = 0                              // toggle to cause action to fail
-    var failThrottleForSubject: Option[Subject] = None  // toggle to cause throttle to fail
for subject
+    var failActionLookup = false // toggle to cause action lookup to fail
+    var failActivation = 0 // toggle to cause action to fail
+    var failThrottleForSubject: Option[Subject] = None // toggle to cause throttle to fail
for subject
     var actionResult: Option[JsObject] = None
-    var requireAuthentication = false                   // toggle require-whisk-auth annotation
on action
-    var customOptions = true                            // toogle web-custom-options annotation
on action
+    var requireAuthentication = false // toggle require-whisk-auth annotation on action
+    var customOptions = true // toogle web-custom-options annotation on action
     var invocationCount = 0
     var invocationsAllowed = 0
 
@@ -969,9 +969,14 @@ trait WebActionsApiTests extends ControllerTestCommon with BeforeAndAfterEach
wi
                 foreach { path =>
 
                     val form = FormData(Map("field1" -> "value1", "field2" -> "value2"))
-                    invocationsAllowed += 1
+                    invocationsAllowed += 2
 
-                    Post(s"$testRoutePath/$path", form) ~> Route.seal(routes(creds)) ~>
check {
+                    Post(s"$testRoutePath/$path", form.toEntity) ~> Route.seal(routes(creds))
~> check {
+                        status should be(OK)
+                        responseAs[String] should (be("value1") or be("value2"))
+                    }
+
+                    Post(s"$testRoutePath/$path", form.toEntity(HttpCharsets.`US-ASCII`))
~> Route.seal(routes(creds)) ~> check {
                         status should be(OK)
                         responseAs[String] should (be("value1") or be("value2"))
                     }

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <commits@openwhisk.apache.org>'].

Mime
View raw message