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-cli.git

commit 1a30433803b86520c663bc09d2ee76c6f9bd38bf
Author: Ben Browning <ben...@gmail.com>
AuthorDate: Sat Aug 5 16:14:52 2017 -0400

    Support multiple response header values in raw web actions (#2577)
    
    This change allows multiple response header values to be set in raw
    web actions by using a JSON array as the header value. For example:
    
    ```
    function main() {
      return {
        headers: {
          "Set-Cookie": ["a=b", "c=d"]
        },
        code: 200
      }
    }
    ```
---
 .../whisk/core/cli/test/WskWebActionsTests.scala   | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala 
b/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala
index be6ae04..8fee896 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskWebActionsTests.scala
@@ -27,6 +27,7 @@ import org.scalatest.BeforeAndAfterAll
 import org.scalatest.junit.JUnitRunner
 
 import com.jayway.restassured.RestAssured
+import com.jayway.restassured.response.Header
 
 import common.TestHelpers
 import common.TestCLIUtils
@@ -296,4 +297,26 @@ trait WskWebActionsTests
             response.statusCode shouldBe 406
             response.body.asString should include("Resource representation is 
only available with these Content-Types:\\ntext/html")
     }
+
+    it should "support multiple response header values" in 
withAssetCleaner(wskprops) {
+        (wp, assetHelper) =>
+            val name = "webaction"
+            val file = 
Some(TestUtils.getTestActionFilename("multipleHeaders.js"))
+            val host = getServiceURL()
+            val url = host + 
s"$testRoutePath/$namespace/default/webaction.http"
+
+            assetHelper.withCleaner(wsk.action, name) {
+                (action, _) =>
+                    action.create(name, file, web = Some("true"), annotations 
= Map("web-custom-options" -> true.toJson))
+            }
+
+            val response = RestAssured.given().config(sslconfig).options(url)
+
+            response.statusCode shouldBe 200
+            val cookieHeaders = response.headers.getList("Set-Cookie")
+            cookieHeaders should contain allOf (
+                new Header("Set-Cookie", "a=b"),
+                new Header("Set-Cookie", "c=d")
+            )
+    }
 }

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

Reply via email to