{"action":"created","comment":{"url":"https://api.github.com/repos/playframework/playframework/pulls/comments/83683129","pull_request_review_id":4510440,"id":83683129,"diff_hunk":"@@ -99,6 +134,61 @@ trait AssetsSpec extends PlaySpecification\n       success\n     }\n \n+    \"serve a brotli compressed asset\" in withServer { client =>\n+      val result = await(client.url(\"/encoding.js\")\n+        .withHeaders(ACCEPT_ENCODING -> \"br\")\n+        .get())\n+\n+      result.header(VARY) must beSome(ACCEPT_ENCODING)\n+      result.header(CONTENT_ENCODING) must beSome(\"br\")\n+      val ahcResult: org.asynchttpclient.Response = result.underlying.asInstanceOf[org.asynchttpclient.Response]\n+      val bytes = ahcResult.getResponseBodyAsBytes\n+      bytes.length must_=== 66\n+      success\n+    }\n+\n+    \"serve a gzip compressed asset when brotli and gzip are available but only gzip is requested\" in withServer { client =>\n+      val result = await(client.url(\"/encoding.js\")\n+        .withHeaders(ACCEPT_ENCODING -> \"gzip\")\n+        .get())\n+\n+      result.header(VARY) must beSome(ACCEPT_ENCODING)\n+      // this check is disabled, because the underlying http client does strip the content-encoding header.\n+      // to prevent this, we would have to pass a DefaultAsyncHttpClientConfig which sets\n+      // org.asynchttpclient.DefaultAsyncHttpClientConfig.keepEncodingHeader to true\n+      //      result.header(CONTENT_ENCODING) must beSome(\"gzip\")\n+      val ahcResult: org.asynchttpclient.Response = result.underlying.asInstanceOf[org.asynchttpclient.Response]\n+      val bytes = ahcResult.getResponseBodyAsBytes\n+      // 107 is the length of the uncompressed message in encoding.js.gz .. as the http client transparently\n+      bytes.length must_=== 107\n+      success\n+    }\n+\n+    \"serve a plain asset when brotli is available but not requested\" in withServer { client =>\n+      val result = await(client.url(\"/encoding.js\")\n+        .get())\n+\n+      result.header(VARY) must beSome(ACCEPT_ENCODING)\n+      result.header(CONTENT_ENCODING) must beNone\n+      val ahcResult: org.asynchttpclient.Response = result.underlying.asInstanceOf[org.asynchttpclient.Response]\n+      val bytes = ahcResult.getResponseBodyAsBytes\n+      bytes.length must_=== 105\n+      success\n+    }\n+\n+    \"serve a brotli compressed asset when brotli and gzip are requested\" in withServer { client =>\n+      val result = await(client.url(\"/encoding.js\")\n+        .withHeaders(ACCEPT_ENCODING -> \"gzip,br\")\n+        .get())\n+\n+      result.header(VARY) must beSome(ACCEPT_ENCODING)\n+      result.header(CONTENT_ENCODING) must beSome(\"br\")\n+      val ahcResult: org.asynchttpclient.Response = result.underlying.asInstanceOf[org.asynchttpclient.Response]\n+      val bytes = ahcResult.getResponseBodyAsBytes","path":"framework/src/play-integration-test/src/test/scala/play/it/http/assets/AssetsSpec.scala","position":64,"original_position":106,"commit_id":"d781b7b9e3a6ef28282f0ecbf50d635327628698","original_commit_id":"d781b7b9e3a6ef28282f0ecbf50d635327628698","user":{"login":"schmitch","id":1641401,"avatar_url":"https://avatars.githubusercontent.com/u/1641401?v=3","gravatar_id":"","url":"https://api.github.com/users/schmitch","html_url":"https://github.com/schmitch","followers_url":"https://api.github.com/users/schmitch/followers","following_url":"https://api.github.com/users/schmitch/following{/other_user}","gists_url":"https://api.github.com/users/schmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/schmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schmitch/subscriptions","organizations_url":"https://api.github.com/users/schmitch/orgs","repos_url":"https://api.github.com/users/schmitch/repos","events_url":"https://api.github.com/users/schmitch/events{/privacy}","received_events_url":"https://api.github.com/users/schmitch/received_events","type":"User","site_admin":false},"body":"as above","created_at":"2016-10-17T16:36:41Z","updated_at":"2016-10-17T16:38:44Z","html_url":"https://github.com/playframework/playframework/pull/6552#discussion_r83683129","pull_request_url":"https://api.github.com/repos/playframework/playframework/pulls/6552","_links":{"self":{"href":"https://api.github.com/repos/playframework/playframework/pulls/comments/83683129"},"html":{"href":"https://github.com/playframework/playframework/pull/6552#discussion_r83683129"},"pull_request":{"href":"https://api.github.com/repos/playframework/playframework/pulls/6552"}}},"pull_request":{"url":"https://api.github.com/repos/playframework/playframework/pulls/6552","id":85039513,"html_url":"https://github.com/playframework/playframework/pull/6552","diff_url":"https://github.com/playframework/playframework/pull/6552.diff","patch_url":"https://github.com/playframework/playframework/pull/6552.patch","issue_url":"https://api.github.com/repos/playframework/playframework/issues/6552","number":6552,"state":"open","locked":false,"title":"Assets-Controller bug fixes (see description): fixes #6144","user":{"login":"domdorn","id":100349,"avatar_url":"https://avatars.githubusercontent.com/u/100349?v=3","gravatar_id":"","url":"https://api.github.com/users/domdorn","html_url":"https://github.com/domdorn","followers_url":"https://api.github.com/users/domdorn/followers","following_url":"https://api.github.com/users/domdorn/following{/other_user}","gists_url":"https://api.github.com/users/domdorn/gists{/gist_id}","starred_url":"https://api.github.com/users/domdorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domdorn/subscriptions","organizations_url":"https://api.github.com/users/domdorn/orgs","repos_url":"https://api.github.com/users/domdorn/repos","events_url":"https://api.github.com/users/domdorn/events{/privacy}","received_events_url":"https://api.github.com/users/domdorn/received_events","type":"User","site_admin":false},"body":"## Purpose\r\nThe assets controller has a few flaws in its current implementation. \r\nThis PR is supposed to fix those flaws and adds new tests to further harden the\r\nAssets-Controller implementation\r\n\r\nThis commit fixes the following: \r\n\r\n- try to infer the ETAG/Digest from the filename if no digest file exists\r\n -> 6f7dc7a4eb8d1b529ab33e9ddbd7ea220fc01308-vendor.js will have ETAG 6f7dc7a4eb8d1b529ab33e9ddbd7ea220fc01308 infered from its name. \r\n\r\n- correctly calculate the GZIP url also if a digested version exists\r\n -> previously, if a digest file existed, the incorrect gzip version was used. \r\n\r\n- correctly infer digest from filename \r\n -> previously the filename itself was used incorrectly, e.g. main.js digest was itself \"main.js\" instead of \"\"\r\n- If digested file is requested and found, serve it instead of barefile\r\n -> if we have 6f7dc7a4eb8d1b529ab33e9ddbd7ea220fc01308-main.js serve it instead of main.js\r\n- if a file with a different digest (e.g. from a previous version of the assets) is requested, check if it is available and serve it eventually\r\n- if a asset is requested without a digest (e.g. just \"vendor.js\"), see if we have a digest for it and serve the digested version with correct ETAG","created_at":"2016-09-13T12:34:28Z","updated_at":"2016-10-17T16:38:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b012d1c38c477a18e90cf92cf0ddd174f4e32cd2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/playframework/playframework/pulls/6552/commits","review_comments_url":"https://api.github.com/repos/playframework/playframework/pulls/6552/comments","review_comment_url":"https://api.github.com/repos/playframework/playframework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/playframework/playframework/issues/6552/comments","statuses_url":"https://api.github.com/repos/playframework/playframework/statuses/d781b7b9e3a6ef28282f0ecbf50d635327628698","head":{"label":"domdorn:patch-3","ref":"patch-3","sha":"d781b7b9e3a6ef28282f0ecbf50d635327628698","user":{"login":"domdorn","id":100349,"avatar_url":"https://avatars.githubusercontent.com/u/100349?v=3","gravatar_id":"","url":"https://api.github.com/users/domdorn","html_url":"https://github.com/domdorn","followers_url":"https://api.github.com/users/domdorn/followers","following_url":"https://api.github.com/users/domdorn/following{/other_user}","gists_url":"https://api.github.com/users/domdorn/gists{/gist_id}","starred_url":"https://api.github.com/users/domdorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domdorn/subscriptions","organizations_url":"https://api.github.com/users/domdorn/orgs","repos_url":"https://api.github.com/users/domdorn/repos","events_url":"https://api.github.com/users/domdorn/events{/privacy}","received_events_url":"https://api.github.com/users/domdorn/received_events","type":"User","site_admin":false},"repo":{"id":58527037,"name":"playframework","full_name":"domdorn/playframework","owner":{"login":"domdorn","id":100349,"avatar_url":"https://avatars.githubusercontent.com/u/100349?v=3","gravatar_id":"","url":"https://api.github.com/users/domdorn","html_url":"https://github.com/domdorn","followers_url":"https://api.github.com/users/domdorn/followers","following_url":"https://api.github.com/users/domdorn/following{/other_user}","gists_url":"https://api.github.com/users/domdorn/gists{/gist_id}","starred_url":"https://api.github.com/users/domdorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domdorn/subscriptions","organizations_url":"https://api.github.com/users/domdorn/orgs","repos_url":"https://api.github.com/users/domdorn/repos","events_url":"https://api.github.com/users/domdorn/events{/privacy}","received_events_url":"https://api.github.com/users/domdorn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/domdorn/playframework","description":"Play Framework","fork":true,"url":"https://api.github.com/repos/domdorn/playframework","forks_url":"https://api.github.com/repos/domdorn/playframework/forks","keys_url":"https://api.github.com/repos/domdorn/playframework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/domdorn/playframework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/domdorn/playframework/teams","hooks_url":"https://api.github.com/repos/domdorn/playframework/hooks","issue_events_url":"https://api.github.com/repos/domdorn/playframework/issues/events{/number}","events_url":"https://api.github.com/repos/domdorn/playframework/events","assignees_url":"https://api.github.com/repos/domdorn/playframework/assignees{/user}","branches_url":"https://api.github.com/repos/domdorn/playframework/branches{/branch}","tags_url":"https://api.github.com/repos/domdorn/playframework/tags","blobs_url":"https://api.github.com/repos/domdorn/playframework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/domdorn/playframework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/domdorn/playframework/git/refs{/sha}","trees_url":"https://api.github.com/repos/domdorn/playframework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/domdorn/playframework/statuses/{sha}","languages_url":"https://api.github.com/repos/domdorn/playframework/languages","stargazers_url":"https://api.github.com/repos/domdorn/playframework/stargazers","contributors_url":"https://api.github.com/repos/domdorn/playframework/contributors","subscribers_url":"https://api.github.com/repos/domdorn/playframework/subscribers","subscription_url":"https://api.github.com/repos/domdorn/playframework/subscription","commits_url":"https://api.github.com/repos/domdorn/playframework/commits{/sha}","git_commits_url":"https://api.github.com/repos/domdorn/playframework/git/commits{/sha}","comments_url":"https://api.github.com/repos/domdorn/playframework/comments{/number}","issue_comment_url":"https://api.github.com/repos/domdorn/playframework/issues/comments{/number}","contents_url":"https://api.github.com/repos/domdorn/playframework/contents/{+path}","compare_url":"https://api.github.com/repos/domdorn/playframework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/domdorn/playframework/merges","archive_url":"https://api.github.com/repos/domdorn/playframework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/domdorn/playframework/downloads","issues_url":"https://api.github.com/repos/domdorn/playframework/issues{/number}","pulls_url":"https://api.github.com/repos/domdorn/playframework/pulls{/number}","milestones_url":"https://api.github.com/repos/domdorn/playframework/milestones{/number}","notifications_url":"https://api.github.com/repos/domdorn/playframework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/domdorn/playframework/labels{/name}","releases_url":"https://api.github.com/repos/domdorn/playframework/releases{/id}","deployments_url":"https://api.github.com/repos/domdorn/playframework/deployments","created_at":"2016-05-11T08:24:22Z","updated_at":"2016-05-11T08:24:31Z","pushed_at":"2016-10-17T15:48:50Z","git_url":"git://github.com/domdorn/playframework.git","ssh_url":"git@github.com:domdorn/playframework.git","clone_url":"https://github.com/domdorn/playframework.git","svn_url":"https://github.com/domdorn/playframework","homepage":"http://www.playframework.com/","size":83882,"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":"playframework:master","ref":"master","sha":"7d03e41b3de259b9a5f697ed73c3e9cb4f077ab6","user":{"login":"playframework","id":319107,"avatar_url":"https://avatars.githubusercontent.com/u/319107?v=3","gravatar_id":"","url":"https://api.github.com/users/playframework","html_url":"https://github.com/playframework","followers_url":"https://api.github.com/users/playframework/followers","following_url":"https://api.github.com/users/playframework/following{/other_user}","gists_url":"https://api.github.com/users/playframework/gists{/gist_id}","starred_url":"https://api.github.com/users/playframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/playframework/subscriptions","organizations_url":"https://api.github.com/users/playframework/orgs","repos_url":"https://api.github.com/users/playframework/repos","events_url":"https://api.github.com/users/playframework/events{/privacy}","received_events_url":"https://api.github.com/users/playframework/received_events","type":"Organization","site_admin":false},"repo":{"id":2340549,"name":"playframework","full_name":"playframework/playframework","owner":{"login":"playframework","id":319107,"avatar_url":"https://avatars.githubusercontent.com/u/319107?v=3","gravatar_id":"","url":"https://api.github.com/users/playframework","html_url":"https://github.com/playframework","followers_url":"https://api.github.com/users/playframework/followers","following_url":"https://api.github.com/users/playframework/following{/other_user}","gists_url":"https://api.github.com/users/playframework/gists{/gist_id}","starred_url":"https://api.github.com/users/playframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/playframework/subscriptions","organizations_url":"https://api.github.com/users/playframework/orgs","repos_url":"https://api.github.com/users/playframework/repos","events_url":"https://api.github.com/users/playframework/events{/privacy}","received_events_url":"https://api.github.com/users/playframework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/playframework/playframework","description":"Play Framework","fork":false,"url":"https://api.github.com/repos/playframework/playframework","forks_url":"https://api.github.com/repos/playframework/playframework/forks","keys_url":"https://api.github.com/repos/playframework/playframework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/playframework/playframework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/playframework/playframework/teams","hooks_url":"https://api.github.com/repos/playframework/playframework/hooks","issue_events_url":"https://api.github.com/repos/playframework/playframework/issues/events{/number}","events_url":"https://api.github.com/repos/playframework/playframework/events","assignees_url":"https://api.github.com/repos/playframework/playframework/assignees{/user}","branches_url":"https://api.github.com/repos/playframework/playframework/branches{/branch}","tags_url":"https://api.github.com/repos/playframework/playframework/tags","blobs_url":"https://api.github.com/repos/playframework/playframework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/playframework/playframework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/playframework/playframework/git/refs{/sha}","trees_url":"https://api.github.com/repos/playframework/playframework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/playframework/playframework/statuses/{sha}","languages_url":"https://api.github.com/repos/playframework/playframework/languages","stargazers_url":"https://api.github.com/repos/playframework/playframework/stargazers","contributors_url":"https://api.github.com/repos/playframework/playframework/contributors","subscribers_url":"https://api.github.com/repos/playframework/playframework/subscribers","subscription_url":"https://api.github.com/repos/playframework/playframework/subscription","commits_url":"https://api.github.com/repos/playframework/playframework/commits{/sha}","git_commits_url":"https://api.github.com/repos/playframework/playframework/git/commits{/sha}","comments_url":"https://api.github.com/repos/playframework/playframework/comments{/number}","issue_comment_url":"https://api.github.com/repos/playframework/playframework/issues/comments{/number}","contents_url":"https://api.github.com/repos/playframework/playframework/contents/{+path}","compare_url":"https://api.github.com/repos/playframework/playframework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/playframework/playframework/merges","archive_url":"https://api.github.com/repos/playframework/playframework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/playframework/playframework/downloads","issues_url":"https://api.github.com/repos/playframework/playframework/issues{/number}","pulls_url":"https://api.github.com/repos/playframework/playframework/pulls{/number}","milestones_url":"https://api.github.com/repos/playframework/playframework/milestones{/number}","notifications_url":"https://api.github.com/repos/playframework/playframework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/playframework/playframework/labels{/name}","releases_url":"https://api.github.com/repos/playframework/playframework/releases{/id}","deployments_url":"https://api.github.com/repos/playframework/playframework/deployments","created_at":"2011-09-07T09:24:08Z","updated_at":"2016-10-17T16:01:49Z","pushed_at":"2016-10-17T15:48:55Z","git_url":"git://github.com/playframework/playframework.git","ssh_url":"git@github.com:playframework/playframework.git","clone_url":"https://github.com/playframework/playframework.git","svn_url":"https://github.com/playframework/playframework","homepage":"http://www.playframework.com/","size":96300,"stargazers_count":8499,"watchers_count":8499,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2933,"mirror_url":null,"open_issues_count":265,"forks":2933,"open_issues":265,"watchers":8499,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/playframework/playframework/pulls/6552"},"html":{"href":"https://github.com/playframework/playframework/pull/6552"},"issue":{"href":"https://api.github.com/repos/playframework/playframework/issues/6552"},"comments":{"href":"https://api.github.com/repos/playframework/playframework/issues/6552/comments"},"review_comments":{"href":"https://api.github.com/repos/playframework/playframework/pulls/6552/comments"},"review_comment":{"href":"https://api.github.com/repos/playframework/playframework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/playframework/playframework/pulls/6552/commits"},"statuses":{"href":"https://api.github.com/repos/playframework/playframework/statuses/d781b7b9e3a6ef28282f0ecbf50d635327628698"}}}}
{"actor":{"display_login":"schmitch"}}