dubeejw commented on a change in pull request #2218: Port Controller from Spray 
to Akka
URL: 
https://github.com/apache/incubator-openwhisk/pull/2218#discussion_r130400123
 
 

 ##########
 File path: common/scala/src/main/scala/whisk/http/BasicHttpService.scala
 ##########
 @@ -86,39 +86,57 @@ trait BasicHttpService extends HttpService with 
TransactionCounter {
      */
     def loglevelForRoute(route: String): Logging.LogLevel = Logging.InfoLevel
 
+    /** Rejection handler to terminate connection on a bad request. Delegates 
to Akka handler. */
+    val prioritizeRejections = recoverRejections { rejections =>
+        val priorityRejection = rejections.find {
+            case rejection: UnacceptedResponseContentTypeRejection => true
+            case _ => false
+        }
+
+        priorityRejection.map(rejection => 
Rejected(Seq(rejection))).getOrElse(Rejected(rejections))
+    }
+
+    val toStrict = mapInnerRoute { innerRoute =>
 
 Review comment:
   Looks like `toStrictEntity` will work. As for as the timeout goes, the 
directive will fail if the stream doesn't complete in that allotted time.
   
   Ran into an error when creating an action with a zip file greater than 1 mb. 
This is the error message `Substream Source cannot be materialized more than 
once` There seems to be a bug in akka-http causing the problem, but 
`toStrictEntity` is being used as a work around right now. Found this info 
about the error: https://github.com/akka/akka-http/issues/73.
   
   https://github.com/akka/akka-http/issues/73
 
----------------------------------------------------------------
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