rabbah commented on a change in pull request #2218: Port Controller from Spray
to Akka
URL:
https://github.com/apache/incubator-openwhisk/pull/2218#discussion_r132814387
##########
File path:
core/controller/src/main/scala/whisk/core/controller/WebActions.scala
##########
@@ -502,25 +505,26 @@ trait WhiskWebActionsApi
case Empty =>
process(None, isRawHttpAction)
- case NonEmpty(ContentType(`application/json`, _), json) if
!isRawHttpAction =>
+ case HttpEntity.Strict(ContentTypes.`application/json`, _) if
!isRawHttpAction =>
entity(as[JsObject]) { body =>
process(Some(body), isRawHttpAction)
}
- case NonEmpty(ContentType(`application/x-www-form-urlencoded`,
_), form) if !isRawHttpAction =>
+ case
HttpEntity.Strict(ContentType(MediaTypes.`application/x-www-form-urlencoded`,
Some(HttpCharsets.`UTF-8`)), _) if !isRawHttpAction =>
entity(as[FormData]) { form =>
val body = form.fields.toMap.toJson.asJsObject
process(Some(body), isRawHttpAction)
}
- case NonEmpty(contentType, data) =>
- if (contentType.mediaType.binary) {
-
Try(JsString(Base64.getEncoder.encodeToString(data.toByteArray))) match {
+ case HttpEntity.Strict(contentType, data) =>
+ // application/json is not a binary type in Akka, but is
binary in Spray
Review comment:
https://github.com/apache/incubator-openwhisk/issues/2606
----------------------------------------------------------------
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