dubeejw 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_r137332449
 
 

 ##########
 File path: 
tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala
 ##########
 @@ -699,20 +699,36 @@ trait WebActionsApiTests extends ControllerTestCommon 
with BeforeAndAfterEach wi
         it should s"handle http web action and provide defaults (auth? 
${creds.isDefined})" in {
             implicit val tid = transid()
 
+            def confirmEmptyResponse() = {
+                status should be(NoContent)
+                response.entity shouldBe HttpEntity.Empty
+                withClue(headers) {
+                    headers.length shouldBe 0
+                }
+            }
+
             Seq(s"$systemId/proxy/export_c.http").
                 foreach { path =>
-                    allowedMethods.foreach { m =>
-                        invocationsAllowed += 1
-                        actionResult = Some(JsObject())
+                    Set(JsObject(), JsObject("body" -> "".toJson), 
JsObject("body" -> JsNull)).
+                        foreach { bodyResult =>
+                            allowedMethods.foreach { m =>
+                                invocationsAllowed += 2
+                                actionResult = Some(bodyResult)
+
+                                m(s"$testRoutePath/$path") ~> 
Route.seal(routes(creds)) ~> check {
+                                    withClue(s"failed for: $bodyResult") {
+                                        confirmEmptyResponse()
+                                    }
+                                }
 
-                        m(s"$testRoutePath/$path") ~> 
Route.seal(routes(creds)) ~> check {
-                            status should be(OK)
-                            response.entity shouldBe HttpEntity.Empty
-                            withClue(headers) {
-                                headers.length shouldBe 0
+                                // repeat with accept header, which should be 
ignored for content-negotiation
+                                m(s"$testRoutePath/$path") ~> 
addHeader("Accept", "application/json") ~> Route.seal(routes(creds)) ~> check {
 
 Review comment:
   Looks like we established a pattern of using 
```MediaTypes.`application/json`.value``` instead of just using 
`application/json`. Six other of the same references below.
 
----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to