GitHub PullRequestReviewCommentEvent at 2014-05-28 03:04:59
Repository: framework
Actor: farmdawgnation
Payload: {"comment":{"url":"https://api.github.com/repos/lift/framework/pulls/comments/13114126","id":13114126,"diff_hunk":"@@ -984,9 +984,29 @@ class Req(val path: ParsePath,\n       sid <- httpRequest.sessionId\n     } yield sid\n \n-  lazy val json: Box[JsonAST.JValue] = \n-    if (!json_?) Empty\n-    else try {\n+  /**\n+   * The JValue representation of this Req's body, if the body is JSON-parsable\n+   * AND the content-type of the request is JSON. Returns a Failure if\n+   * the request is not considered a JSON request (see json_?), or if\n+   * there was an error parsing the JSON.\n+   *\n+   * If you want to forcibly evaluate the request body as JSON, ignoring\n+   * content type, see bodyAsJson.\n+   */\n+  lazy val json: Box[JsonAST.JValue] = {\n+    if (!json_?) {\n+      Failure(\"Cannot parse non-JSON request as JSON; please check content-type.\")\n+    } else {\n+      bodyAsJson\n+    }\n+  }\n+\n+  /**\n+   * Forcibly tries to parse the request body as JSON. Does not perform any\n+   * content type checks, unlike the json method.\n+   */\n+  lazy val bodyAsJson: Box[JsonAST.JValue] = {","path":"web/webkit/src/main/scala/net/liftweb/http/Req.scala","position":28,"original_position":28,"commit_id":"db6b23c2c9846f70f5b51615b6363ff983420f87","original_commit_id":"db6b23c2c9846f70f5b51615b6363ff983420f87","user":{"login":"farmdawgnation","id":620189,"avatar_url":"https://avatars.githubusercontent.com/u/620189?","gravatar_id":"6aaa707270e134bb72a4c2852f088e22","url":"https://api.github.com/users/farmdawgnation","html_url":"https://github.com/farmdawgnation","followers_url":"https://api.github.com/users/farmdawgnation/followers","following_url":"https://api.github.com/users/farmdawgnation/following{/other_user}","gists_url":"https://api.github.com/users/farmdawgnation/gists{/gist_id}","starred_url":"https://api.github.com/users/farmdawgnation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/farmdawgnation/subscriptions","organizations_url":"https://api.github.com/users/farmdawgnation/orgs","repos_url":"https://api.github.com/users/farmdawgnation/repos","events_url":"https://api.github.com/users/farmdawgnation/events{/privacy}","received_events_url":"https://api.github.com/users/farmdawgnation/received_events","type":"User","site_admin":false},"body":"Perhaps this is more aptly named `bodyAsJosn_!`?","created_at":"2014-05-28T03:04:59Z","updated_at":"2014-05-28T03:04:59Z","html_url":"https://github.com/lift/framework/pull/1522#discussion_r13114126","pull_request_url":"https://api.github.com/repos/lift/framework/pulls/1522","_links":{"self":{"href":"https://api.github.com/repos/lift/framework/pulls/comments/13114126"},"html":{"href":"https://github.com/lift/framework/pull/1522#discussion_r13114126"},"pull_request":{"href":"https://api.github.com/repos/lift/framework/pulls/1522"}}}}