ningyougang commented on code in PR #5290:
URL: https://github.com/apache/openwhisk/pull/5290#discussion_r929694176
##########
tests/src/test/scala/org/apache/openwhisk/core/controller/test/ConductorsApiTests.scala:
##########
@@ -345,26 +351,39 @@ class ConductorsApiTests extends ControllerTestCommon
with WhiskActionsApi {
case `echo` => // echo action
Future(Right(respond(action, msg, args)))
case `conductor` => // see tests/dat/actions/conductor.js
- val result =
- if (args.fields.get("error") isDefined) args
- else {
- val action = args.fields.get("action") map { action =>
- Map("action" -> action)
- } getOrElse Map.empty
- val state = args.fields.get("state") map { state =>
- Map("state" -> state)
- } getOrElse Map.empty
- val wrappedParams = args.fields.getOrElse("params",
JsObject.empty).asJsObject.fields
- val escapedParams = args.fields - "action" - "state" -
"params"
- val params = Map("params" -> JsObject(wrappedParams ++
escapedParams))
- JsObject(params ++ action ++ state)
+ val result = {
+ args match {
+ case JsObject(fields) =>
+ if (fields.get("error") isDefined) args
+ else {
+ val action = fields.get("action") map { action =>
+ Map("action" -> action)
+ } getOrElse Map.empty
+ val state = fields.get("state") map { state =>
+ Map("state" -> state)
+ } getOrElse Map.empty
+ val wrappedParams = fields.getOrElse("params",
JsObject.empty).asJsObject.fields
+ val escapedParams = fields - "action" - "state" -
"params"
+ val params = Map("params" -> JsObject(wrappedParams ++
escapedParams))
+ JsObject(params ++ action ++ state)
+ }
+ case _ => JsObject.empty
Review Comment:
hm..i am not sure, if want to support, i think we can submit in next pr.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]