{"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka/pulls/comments/24487126","id":24487126,"diff_hunk":"@@ -16,46 +18,64 @@ trait CodingDirectives {\n   import MiscDirectives._\n   import RouteDirectives._\n   import CodingDirectives._\n+  import HeaderDirectives._\n \n   // encoding\n \n   /**\n-   * Wraps its inner Route with encoding support using the given Encoder.\n-   */\n-  def encodeResponse(encoder: Encoder): Directive0 =\n-    responseEncodingAccepted(encoder.encoding) &\n-      mapResponse(encoder.encode(_)) &\n-      cancelRejections(classOf[UnacceptedResponseEncodingRejection])\n-\n-  /**\n    * Rejects the request with an UnacceptedResponseEncodingRejection\n    * if the given encoding is not accepted for the response.\n    */\n   def responseEncodingAccepted(encoding: HttpEncoding): Directive0 =\n     extract(_.request.isEncodingAccepted(encoding))\n-      .flatMap(if (_) pass else reject(UnacceptedResponseEncodingRejection(encoding)))\n+      .flatMap(if (_) pass else reject(UnacceptedResponseEncodingRejection(Set(encoding))))\n \n   /**\n-   * Wraps its inner Route with response compression, using the specified\n-   * encoders in the given order of preference.\n-   * If no encoders are specifically given Gzip, Deflate and NoEncoding\n-   * are used in this order, depending on what the client accepts.\n+   * Wraps its inner Route with response encoding, using one of the specified\n+   * encoders negotiated with the encodings the client accepts.\n+   *\n+   * The negotiation logic is defined by http://tools.ietf.org/html/rfc7231#section-5.3.4.\n    */\n-  def compressResponse(encoders: Encoder*): Directive0 =\n-    theseOrDefault(encoders).map(encodeResponse(_)).reduce(_ | _)\n+\n+  def encodeResponseWith(encoders: Encoder*): Directive0 = _encodeResponse(immutable.Seq(encoders: _*))","path":"akka-http/src/main/scala/akka/http/server/directives/CodingDirectives.scala","position":50,"original_position":50,"commit_id":"70e1156fb75258470c01b3544f9ada0a7efaa62f","original_commit_id":"70e1156fb75258470c01b3544f9ada0a7efaa62f","user":{"login":"sirthias","id":135347,"avatar_url":"https://avatars.githubusercontent.com/u/135347?v=3","gravatar_id":"","url":"https://api.github.com/users/sirthias","html_url":"https://github.com/sirthias","followers_url":"https://api.github.com/users/sirthias/followers","following_url":"https://api.github.com/users/sirthias/following{/other_user}","gists_url":"https://api.github.com/users/sirthias/gists{/gist_id}","starred_url":"https://api.github.com/users/sirthias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sirthias/subscriptions","organizations_url":"https://api.github.com/users/sirthias/orgs","repos_url":"https://api.github.com/users/sirthias/repos","events_url":"https://api.github.com/users/sirthias/events{/privacy}","received_events_url":"https://api.github.com/users/sirthias/received_events","type":"User","site_admin":false},"body":"Yes, that'd be better.","created_at":"2015-02-11T11:03:17Z","updated_at":"2015-02-11T11:03:17Z","html_url":"https://github.com/akka/akka/pull/16598#discussion_r24487126","pull_request_url":"https://api.github.com/repos/akka/akka/pulls/16598","_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/24487126"},"html":{"href":"https://github.com/akka/akka/pull/16598#discussion_r24487126"},"pull_request":{"href":"https://api.github.com/repos/akka/akka/pulls/16598"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka/pulls/16598","id":26461487,"html_url":"https://github.com/akka/akka/pull/16598","diff_url":"https://github.com/akka/akka/pull/16598.diff","patch_url":"https://github.com/akka/akka/pull/16598.patch","issue_url":"https://api.github.com/repos/akka/akka/issues/16598","number":16598,"state":"open","locked":false,"title":"!htp #16593 negotiate content encoding","user":{"login":"2beaucoup","id":243903,"avatar_url":"https://avatars.githubusercontent.com/u/243903?v=3","gravatar_id":"","url":"https://api.github.com/users/2beaucoup","html_url":"https://github.com/2beaucoup","followers_url":"https://api.github.com/users/2beaucoup/followers","following_url":"https://api.github.com/users/2beaucoup/following{/other_user}","gists_url":"https://api.github.com/users/2beaucoup/gists{/gist_id}","starred_url":"https://api.github.com/users/2beaucoup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2beaucoup/subscriptions","organizations_url":"https://api.github.com/users/2beaucoup/orgs","repos_url":"https://api.github.com/users/2beaucoup/repos","events_url":"https://api.github.com/users/2beaucoup/events{/privacy}","received_events_url":"https://api.github.com/users/2beaucoup/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-12-22T15:13:29Z","updated_at":"2015-02-11T11:03:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e0ec1e1a1fc15ead94a08be6df19f2404c18606c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka/pulls/16598/commits","review_comments_url":"https://api.github.com/repos/akka/akka/pulls/16598/comments","review_comment_url":"https://api.github.com/repos/akka/akka/pulls/comments/{number}","comments_url":"https://api.github.com/repos/akka/akka/issues/16598/comments","statuses_url":"https://api.github.com/repos/akka/akka/statuses/70e1156fb75258470c01b3544f9ada0a7efaa62f","head":{"label":"2beaucoup:wip-16593-negotiate-encoding","ref":"wip-16593-negotiate-encoding","sha":"70e1156fb75258470c01b3544f9ada0a7efaa62f","user":{"login":"2beaucoup","id":243903,"avatar_url":"https://avatars.githubusercontent.com/u/243903?v=3","gravatar_id":"","url":"https://api.github.com/users/2beaucoup","html_url":"https://github.com/2beaucoup","followers_url":"https://api.github.com/users/2beaucoup/followers","following_url":"https://api.github.com/users/2beaucoup/following{/other_user}","gists_url":"https://api.github.com/users/2beaucoup/gists{/gist_id}","starred_url":"https://api.github.com/users/2beaucoup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2beaucoup/subscriptions","organizations_url":"https://api.github.com/users/2beaucoup/orgs","repos_url":"https://api.github.com/users/2beaucoup/repos","events_url":"https://api.github.com/users/2beaucoup/events{/privacy}","received_events_url":"https://api.github.com/users/2beaucoup/received_events","type":"User","site_admin":false},"repo":{"id":7876496,"name":"akka","full_name":"2beaucoup/akka","owner":{"login":"2beaucoup","id":243903,"avatar_url":"https://avatars.githubusercontent.com/u/243903?v=3","gravatar_id":"","url":"https://api.github.com/users/2beaucoup","html_url":"https://github.com/2beaucoup","followers_url":"https://api.github.com/users/2beaucoup/followers","following_url":"https://api.github.com/users/2beaucoup/following{/other_user}","gists_url":"https://api.github.com/users/2beaucoup/gists{/gist_id}","starred_url":"https://api.github.com/users/2beaucoup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2beaucoup/subscriptions","organizations_url":"https://api.github.com/users/2beaucoup/orgs","repos_url":"https://api.github.com/users/2beaucoup/repos","events_url":"https://api.github.com/users/2beaucoup/events{/privacy}","received_events_url":"https://api.github.com/users/2beaucoup/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/2beaucoup/akka","description":"Akka Project","fork":true,"url":"https://api.github.com/repos/2beaucoup/akka","forks_url":"https://api.github.com/repos/2beaucoup/akka/forks","keys_url":"https://api.github.com/repos/2beaucoup/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/2beaucoup/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/2beaucoup/akka/teams","hooks_url":"https://api.github.com/repos/2beaucoup/akka/hooks","issue_events_url":"https://api.github.com/repos/2beaucoup/akka/issues/events{/number}","events_url":"https://api.github.com/repos/2beaucoup/akka/events","assignees_url":"https://api.github.com/repos/2beaucoup/akka/assignees{/user}","branches_url":"https://api.github.com/repos/2beaucoup/akka/branches{/branch}","tags_url":"https://api.github.com/repos/2beaucoup/akka/tags","blobs_url":"https://api.github.com/repos/2beaucoup/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/2beaucoup/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/2beaucoup/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/2beaucoup/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/2beaucoup/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/2beaucoup/akka/languages","stargazers_url":"https://api.github.com/repos/2beaucoup/akka/stargazers","contributors_url":"https://api.github.com/repos/2beaucoup/akka/contributors","subscribers_url":"https://api.github.com/repos/2beaucoup/akka/subscribers","subscription_url":"https://api.github.com/repos/2beaucoup/akka/subscription","commits_url":"https://api.github.com/repos/2beaucoup/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/2beaucoup/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/2beaucoup/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/2beaucoup/akka/issues/comments/{number}","contents_url":"https://api.github.com/repos/2beaucoup/akka/contents/{+path}","compare_url":"https://api.github.com/repos/2beaucoup/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/2beaucoup/akka/merges","archive_url":"https://api.github.com/repos/2beaucoup/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/2beaucoup/akka/downloads","issues_url":"https://api.github.com/repos/2beaucoup/akka/issues{/number}","pulls_url":"https://api.github.com/repos/2beaucoup/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/2beaucoup/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/2beaucoup/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/2beaucoup/akka/labels{/name}","releases_url":"https://api.github.com/repos/2beaucoup/akka/releases{/id}","created_at":"2013-01-28T18:53:19Z","updated_at":"2014-09-12T10:37:18Z","pushed_at":"2015-02-10T08:19:56Z","git_url":"git://github.com/2beaucoup/akka.git","ssh_url":"git@github.com:2beaucoup/akka.git","clone_url":"https://github.com/2beaucoup/akka.git","svn_url":"https://github.com/2beaucoup/akka","homepage":"http://akka.io","size":155255,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"akka:release-2.3-dev","ref":"release-2.3-dev","sha":"8ce8f1df8f941b1f38c5b301963f682431a3365b","user":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":130013,"name":"akka","full_name":"akka/akka","owner":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/akka","description":"Akka Project","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments/{number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","created_at":"2009-02-16T12:51:54Z","updated_at":"2015-02-11T09:53:58Z","pushed_at":"2015-02-08T19:30:23Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":237810,"stargazers_count":3539,"watchers_count":3539,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1000,"mirror_url":null,"open_issues_count":577,"forks":1000,"open_issues":577,"watchers":3539,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/16598"},"html":{"href":"https://github.com/akka/akka/pull/16598"},"issue":{"href":"https://api.github.com/repos/akka/akka/issues/16598"},"comments":{"href":"https://api.github.com/repos/akka/akka/issues/16598/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka/pulls/16598/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/akka/akka/pulls/16598/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka/statuses/70e1156fb75258470c01b3544f9ada0a7efaa62f"}}}}