in server/src/main/scala/org/apache/livy/server/JsonServlet.scala [87:103]
override protected def renderResponseBody(actionResult: Any): Unit = {
val result = actionResult match {
case ActionResult(status, ResponseMessage(msg), headers) if format == "json" =>
ActionResult(status, toJson(Map("msg" -> msg)), headers)
case ActionResult(status, body, headers) if format == "json" =>
ActionResult(status, toJson(body), headers)
case str: String if format == "json" =>
// This should be changed when we implement LIVY-54. For now, just create a dummy
// JSON object when a raw string is being returned.
toJson(Map("msg" -> str))
case other if format == "json" =>
toJson(other)
case other =>
other
}
super.renderResponseBody(result)
}