You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by gi...@git.apache.org on 2017/08/31 00:23:55 UTC

[GitHub] rabbah commented on a change in pull request #2676: Change response when entity is empty from 200 to 204.

rabbah commented on a change in pull request #2676: Change response when entity is empty from 200 to 204.
URL: https://github.com/apache/incubator-openwhisk/pull/2676#discussion_r136221317
 
 

 ##########
 File path: tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala
 ##########
 @@ -770,6 +805,74 @@ trait WebActionsApiTests extends ControllerTestCommon with BeforeAndAfterEach wi
                             responseAs[JsObject] shouldBe JsObject("field" -> "value".toJson)
                         }
                     }
+
+                    // omit status code and headers
+                    allowedMethods.foreach { m =>
+                        invocationsAllowed += 1
+                        actionResult = Some(JsObject(
+                            "body" -> Base64.getEncoder.encodeToString {
+                                JsObject("field" -> "value".toJson).compactPrint.getBytes
+                            }.toJson))
+
+                        m(s"$testRoutePath/$path") ~> Route.seal(routes(creds)) ~> check {
+                            status should be(OK)
+                            responseAs[String] shouldBe actionResult.get.fields("body").convertTo[String]
+                            //??? it appears akka-http is ignoring the character set
+                            if (false) contentType shouldBe MediaTypes.`text/html`.withCharset(HttpCharsets.`UTF-8`)
+                        }
+                    }
+
+                    // omit headers only
+                    allowedMethods.foreach { m =>
+                        invocationsAllowed += 1
+                        actionResult = Some(JsObject(
+                            webApiDirectives.statusCode -> Created.intValue.toJson,
+                            "body" -> Base64.getEncoder.encodeToString {
+                                JsObject("field" -> "value".toJson).compactPrint.getBytes
+                            }.toJson))
+
+                        m(s"$testRoutePath/$path") ~> Route.seal(routes(creds)) ~> check {
+                            status should be(Created)
+                            responseAs[String] shouldBe actionResult.get.fields("body").convertTo[String]
+                            //??? it appears akka-http is ignoring the character set
+                            if (false) contentType shouldBe MediaTypes.`text/html`.withCharset(HttpCharsets.`UTF-8`)
 
 Review comment:
   @dubeejw any insights on this?
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services