GitHub PullRequestReviewCommentEvent at 2014-06-11 17:10:38
Repository: scala-commons
Actor: mlaflamm
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/wajam/scala-commons/pulls/comments/13661029","id":13661029,"diff_hunk":"@@ -0,0 +1,45 @@\n+package com.wajam.asyncclient\n+\n+import com.ning.http.client.{FluentCaseInsensitiveStringsMap, Response}\n+\n+trait Headers {\n+  def getValue(key: String): Option[String]\n+\n+  def getValues(key: String): Iterable[String]\n+\n+  def toMap: Map[String, Iterable[String]]\n+}\n+\n+object Headers {\n+  def apply(response: Response): Headers = ResponseHeaders(response.getHeaders)\n+\n+  def apply(headers: Map[String, String]) = new Headers {\n+    def getValue(key: String): Option[String] = headers.get(key)\n+\n+    def getValues(key: String): Iterable[String] = headers.get(key).map(List(_)).getOrElse(Nil)\n+\n+    lazy val toMap: Map[String, Iterable[String]] = headers.map { case (k, v) => (k, List(v)) }\n+  }\n+\n+  val Empty = new Headers {\n+    def getValue(key: String): Option[String] = None\n+\n+    def getValues(key: String): Iterable[String] = Nil\n+\n+    def toMap: Map[String, Iterable[String]] = Map.empty()\n+  }\n+\n+  private case class ResponseHeaders(headers: FluentCaseInsensitiveStringsMap) extends Headers {\n+    import scala.collection.JavaConversions._\n+\n+    def getValue(key: String): Option[String] = Option(headers.getFirstValue(key))\n+\n+    def getValues(key: String): Iterable[String] = {\n+      Option[Iterable[String]](headers.get(key)).getOrElse(Nil)","path":"commons-asyncclient/src/main/scala/com/wajam/asyncclient/Headers.scala","position":38,"original_position":38,"commit_id":"b0137302f4c342da71c5cc67ef4f84020138977a","original_commit_id":"91239ac57dd60bd156199a3101be2a4c35bd46c9","user":{"login":"mlaflamm","id":269187,"avatar_url":"https://avatars.githubusercontent.com/u/269187?","gravatar_id":"8f8efe5f0b65ef96ef5266b835d92105","url":"https://api.github.com/users/mlaflamm","html_url":"https://github.com/mlaflamm","followers_url":"https://api.github.com/users/mlaflamm/followers","following_url":"https://api.github.com/users/mlaflamm/following{/other_user}","gists_url":"https://api.github.com/users/mlaflamm/gists{/gist_id}","starred_url":"https://api.github.com/users/mlaflamm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlaflamm/subscriptions","organizations_url":"https://api.github.com/users/mlaflamm/orgs","repos_url":"https://api.github.com/users/mlaflamm/repos","events_url":"https://api.github.com/users/mlaflamm/events{/privacy}","received_events_url":"https://api.github.com/users/mlaflamm/received_events","type":"User","site_admin":false},"body":"Idem","created_at":"2014-06-11T17:10:38Z","updated_at":"2014-06-11T17:10:38Z","html_url":"https://github.com/wajam/scala-commons/pull/60#discussion_r13661029","pull_request_url":"https://api.github.com/repos/wajam/scala-commons/pulls/60","_links":{"self":{"href":"https://api.github.com/repos/wajam/scala-commons/pulls/comments/13661029"},"html":{"href":"https://github.com/wajam/scala-commons/pull/60#discussion_r13661029"},"pull_request":{"href":"https://api.github.com/repos/wajam/scala-commons/pulls/60"}}},"pull_request":{"url":"https://api.github.com/repos/wajam/scala-commons/pulls/60","id":16960731,"html_url":"https://github.com/wajam/scala-commons/pull/60","diff_url":"https://github.com/wajam/scala-commons/pull/60.diff","patch_url":"https://github.com/wajam/scala-commons/pull/60.patch","issue_url":"https://api.github.com/repos/wajam/scala-commons/issues/60","number":60,"state":"open","title":"Support headers in Json response","user":{"login":"mlaflamm","id":269187,"avatar_url":"https://avatars.githubusercontent.com/u/269187?","gravatar_id":"8f8efe5f0b65ef96ef5266b835d92105","url":"https://api.github.com/users/mlaflamm","html_url":"https://github.com/mlaflamm","followers_url":"https://api.github.com/users/mlaflamm/followers","following_url":"https://api.github.com/users/mlaflamm/following{/other_user}","gists_url":"https://api.github.com/users/mlaflamm/gists{/gist_id}","starred_url":"https://api.github.com/users/mlaflamm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlaflamm/subscriptions","organizations_url":"https://api.github.com/users/mlaflamm/orgs","repos_url":"https://api.github.com/users/mlaflamm/repos","events_url":"https://api.github.com/users/mlaflamm/events{/privacy}","received_events_url":"https://api.github.com/users/mlaflamm/received_events","type":"User","site_admin":false},"body":"Also reduced the memory footprint of the Json responses by not including the original Json string and the Json4s object when not required.","created_at":"2014-06-10T19:40:23Z","updated_at":"2014-06-11T17:10:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2709fbe08797c7b9479b1af0eca1f0a88f5fd3e8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wajam/scala-commons/pulls/60/commits","review_comments_url":"https://api.github.com/repos/wajam/scala-commons/pulls/60/comments","review_comment_url":"https://api.github.com/repos/wajam/scala-commons/pulls/comments/{number}","comments_url":"https://api.github.com/repos/wajam/scala-commons/issues/60/comments","statuses_url":"https://api.github.com/repos/wajam/scala-commons/statuses/b0137302f4c342da71c5cc67ef4f84020138977a","head":{"label":"wajam:manu-asyncclient-response-headers","ref":"manu-asyncclient-response-headers","sha":"b0137302f4c342da71c5cc67ef4f84020138977a","user":{"login":"wajam","id":651188,"avatar_url":"https://avatars.githubusercontent.com/u/651188?","gravatar_id":"cbf935467db71dfdc7248c534c723049","url":"https://api.github.com/users/wajam","html_url":"https://github.com/wajam","followers_url":"https://api.github.com/users/wajam/followers","following_url":"https://api.github.com/users/wajam/following{/other_user}","gists_url":"https://api.github.com/users/wajam/gists{/gist_id}","starred_url":"https://api.github.com/users/wajam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wajam/subscriptions","organizations_url":"https://api.github.com/users/wajam/orgs","repos_url":"https://api.github.com/users/wajam/repos","events_url":"https://api.github.com/users/wajam/events{/privacy}","received_events_url":"https://api.github.com/users/wajam/received_events","type":"Organization","site_admin":false},"repo":{"id":12952521,"name":"scala-commons","full_name":"wajam/scala-commons","owner":{"login":"wajam","id":651188,"avatar_url":"https://avatars.githubusercontent.com/u/651188?","gravatar_id":"cbf935467db71dfdc7248c534c723049","url":"https://api.github.com/users/wajam","html_url":"https://github.com/wajam","followers_url":"https://api.github.com/users/wajam/followers","following_url":"https://api.github.com/users/wajam/following{/other_user}","gists_url":"https://api.github.com/users/wajam/gists{/gist_id}","starred_url":"https://api.github.com/users/wajam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wajam/subscriptions","organizations_url":"https://api.github.com/users/wajam/orgs","repos_url":"https://api.github.com/users/wajam/repos","events_url":"https://api.github.com/users/wajam/events{/privacy}","received_events_url":"https://api.github.com/users/wajam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wajam/scala-commons","description":"","fork":false,"url":"https://api.github.com/repos/wajam/scala-commons","forks_url":"https://api.github.com/repos/wajam/scala-commons/forks","keys_url":"https://api.github.com/repos/wajam/scala-commons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wajam/scala-commons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wajam/scala-commons/teams","hooks_url":"https://api.github.com/repos/wajam/scala-commons/hooks","issue_events_url":"https://api.github.com/repos/wajam/scala-commons/issues/events{/number}","events_url":"https://api.github.com/repos/wajam/scala-commons/events","assignees_url":"https://api.github.com/repos/wajam/scala-commons/assignees{/user}","branches_url":"https://api.github.com/repos/wajam/scala-commons/branches{/branch}","tags_url":"https://api.github.com/repos/wajam/scala-commons/tags","blobs_url":"https://api.github.com/repos/wajam/scala-commons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wajam/scala-commons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wajam/scala-commons/git/refs{/sha}","trees_url":"https://api.github.com/repos/wajam/scala-commons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wajam/scala-commons/statuses/{sha}","languages_url":"https://api.github.com/repos/wajam/scala-commons/languages","stargazers_url":"https://api.github.com/repos/wajam/scala-commons/stargazers","contributors_url":"https://api.github.com/repos/wajam/scala-commons/contributors","subscribers_url":"https://api.github.com/repos/wajam/scala-commons/subscribers","subscription_url":"https://api.github.com/repos/wajam/scala-commons/subscription","commits_url":"https://api.github.com/repos/wajam/scala-commons/commits{/sha}","git_commits_url":"https://api.github.com/repos/wajam/scala-commons/git/commits{/sha}","comments_url":"https://api.github.com/repos/wajam/scala-commons/comments{/number}","issue_comment_url":"https://api.github.com/repos/wajam/scala-commons/issues/comments/{number}","contents_url":"https://api.github.com/repos/wajam/scala-commons/contents/{+path}","compare_url":"https://api.github.com/repos/wajam/scala-commons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wajam/scala-commons/merges","archive_url":"https://api.github.com/repos/wajam/scala-commons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wajam/scala-commons/downloads","issues_url":"https://api.github.com/repos/wajam/scala-commons/issues{/number}","pulls_url":"https://api.github.com/repos/wajam/scala-commons/pulls{/number}","milestones_url":"https://api.github.com/repos/wajam/scala-commons/milestones{/number}","notifications_url":"https://api.github.com/repos/wajam/scala-commons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wajam/scala-commons/labels{/name}","releases_url":"https://api.github.com/repos/wajam/scala-commons/releases{/id}","created_at":"2013-09-19T15:48:59Z","updated_at":"2014-06-11T17:10:06Z","pushed_at":"2014-06-11T17:10:08Z","git_url":"git://github.com/wajam/scala-commons.git","ssh_url":"git@github.com:wajam/scala-commons.git","clone_url":"https://github.com/wajam/scala-commons.git","svn_url":"https://github.com/wajam/scala-commons","homepage":null,"size":2628,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"wajam:master","ref":"master","sha":"2746be346125e0dec0f3e813abade03bf1cbfb86","user":{"login":"wajam","id":651188,"avatar_url":"https://avatars.githubusercontent.com/u/651188?","gravatar_id":"cbf935467db71dfdc7248c534c723049","url":"https://api.github.com/users/wajam","html_url":"https://github.com/wajam","followers_url":"https://api.github.com/users/wajam/followers","following_url":"https://api.github.com/users/wajam/following{/other_user}","gists_url":"https://api.github.com/users/wajam/gists{/gist_id}","starred_url":"https://api.github.com/users/wajam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wajam/subscriptions","organizations_url":"https://api.github.com/users/wajam/orgs","repos_url":"https://api.github.com/users/wajam/repos","events_url":"https://api.github.com/users/wajam/events{/privacy}","received_events_url":"https://api.github.com/users/wajam/received_events","type":"Organization","site_admin":false},"repo":{"id":12952521,"name":"scala-commons","full_name":"wajam/scala-commons","owner":{"login":"wajam","id":651188,"avatar_url":"https://avatars.githubusercontent.com/u/651188?","gravatar_id":"cbf935467db71dfdc7248c534c723049","url":"https://api.github.com/users/wajam","html_url":"https://github.com/wajam","followers_url":"https://api.github.com/users/wajam/followers","following_url":"https://api.github.com/users/wajam/following{/other_user}","gists_url":"https://api.github.com/users/wajam/gists{/gist_id}","starred_url":"https://api.github.com/users/wajam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wajam/subscriptions","organizations_url":"https://api.github.com/users/wajam/orgs","repos_url":"https://api.github.com/users/wajam/repos","events_url":"https://api.github.com/users/wajam/events{/privacy}","received_events_url":"https://api.github.com/users/wajam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wajam/scala-commons","description":"","fork":false,"url":"https://api.github.com/repos/wajam/scala-commons","forks_url":"https://api.github.com/repos/wajam/scala-commons/forks","keys_url":"https://api.github.com/repos/wajam/scala-commons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wajam/scala-commons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wajam/scala-commons/teams","hooks_url":"https://api.github.com/repos/wajam/scala-commons/hooks","issue_events_url":"https://api.github.com/repos/wajam/scala-commons/issues/events{/number}","events_url":"https://api.github.com/repos/wajam/scala-commons/events","assignees_url":"https://api.github.com/repos/wajam/scala-commons/assignees{/user}","branches_url":"https://api.github.com/repos/wajam/scala-commons/branches{/branch}","tags_url":"https://api.github.com/repos/wajam/scala-commons/tags","blobs_url":"https://api.github.com/repos/wajam/scala-commons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wajam/scala-commons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wajam/scala-commons/git/refs{/sha}","trees_url":"https://api.github.com/repos/wajam/scala-commons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wajam/scala-commons/statuses/{sha}","languages_url":"https://api.github.com/repos/wajam/scala-commons/languages","stargazers_url":"https://api.github.com/repos/wajam/scala-commons/stargazers","contributors_url":"https://api.github.com/repos/wajam/scala-commons/contributors","subscribers_url":"https://api.github.com/repos/wajam/scala-commons/subscribers","subscription_url":"https://api.github.com/repos/wajam/scala-commons/subscription","commits_url":"https://api.github.com/repos/wajam/scala-commons/commits{/sha}","git_commits_url":"https://api.github.com/repos/wajam/scala-commons/git/commits{/sha}","comments_url":"https://api.github.com/repos/wajam/scala-commons/comments{/number}","issue_comment_url":"https://api.github.com/repos/wajam/scala-commons/issues/comments/{number}","contents_url":"https://api.github.com/repos/wajam/scala-commons/contents/{+path}","compare_url":"https://api.github.com/repos/wajam/scala-commons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wajam/scala-commons/merges","archive_url":"https://api.github.com/repos/wajam/scala-commons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wajam/scala-commons/downloads","issues_url":"https://api.github.com/repos/wajam/scala-commons/issues{/number}","pulls_url":"https://api.github.com/repos/wajam/scala-commons/pulls{/number}","milestones_url":"https://api.github.com/repos/wajam/scala-commons/milestones{/number}","notifications_url":"https://api.github.com/repos/wajam/scala-commons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wajam/scala-commons/labels{/name}","releases_url":"https://api.github.com/repos/wajam/scala-commons/releases{/id}","created_at":"2013-09-19T15:48:59Z","updated_at":"2014-06-11T17:10:06Z","pushed_at":"2014-06-11T17:10:08Z","git_url":"git://github.com/wajam/scala-commons.git","ssh_url":"git@github.com:wajam/scala-commons.git","clone_url":"https://github.com/wajam/scala-commons.git","svn_url":"https://github.com/wajam/scala-commons","homepage":null,"size":2628,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wajam/scala-commons/pulls/60"},"html":{"href":"https://github.com/wajam/scala-commons/pull/60"},"issue":{"href":"https://api.github.com/repos/wajam/scala-commons/issues/60"},"comments":{"href":"https://api.github.com/repos/wajam/scala-commons/issues/60/comments"},"review_comments":{"href":"https://api.github.com/repos/wajam/scala-commons/pulls/60/comments"},"review_comment":{"href":"https://api.github.com/repos/wajam/scala-commons/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/wajam/scala-commons/pulls/60/commits"},"statuses":{"href":"https://api.github.com/repos/wajam/scala-commons/statuses/b0137302f4c342da71c5cc67ef4f84020138977a"}}}}