{"action":"opened","number":454,"pull_request":{"url":"https://api.github.com/repos/gopherjs/gopherjs/pulls/454","id":69282800,"html_url":"https://github.com/gopherjs/gopherjs/pull/454","diff_url":"https://github.com/gopherjs/gopherjs/pull/454.diff","patch_url":"https://github.com/gopherjs/gopherjs/pull/454.patch","issue_url":"https://api.github.com/repos/gopherjs/gopherjs/issues/454","number":454,"state":"open","locked":false,"title":"WIP: compiler/natives/net/http: Implement http.RoundTripper on Fetch API.","user":{"login":"shurcooL","id":1924134,"avatar_url":"https://avatars.githubusercontent.com/u/1924134?v=3","gravatar_id":"","url":"https://api.github.com/users/shurcooL","html_url":"https://github.com/shurcooL","followers_url":"https://api.github.com/users/shurcooL/followers","following_url":"https://api.github.com/users/shurcooL/following{/other_user}","gists_url":"https://api.github.com/users/shurcooL/gists{/gist_id}","starred_url":"https://api.github.com/users/shurcooL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shurcooL/subscriptions","organizations_url":"https://api.github.com/users/shurcooL/orgs","repos_url":"https://api.github.com/users/shurcooL/repos","events_url":"https://api.github.com/users/shurcooL/events{/privacy}","received_events_url":"https://api.github.com/users/shurcooL/received_events","type":"User","site_admin":false},"body":"This is a WIP PR in order to get initial review comments, to communicate and avoid duplicate efforts. Known TODOs are listed in code.\r\n\r\nThe motivation to use Fetch API is because it's lower level, and allows\r\nimplementing an http.RoundTripper more efficiently (less conversions\r\nbetween strings and []byte). It also supports streaming body responses\r\nefficiently.\r\n\r\nReferences:\r\n\r\n- https://fetch.spec.whatwg.org/\r\n- https://streams.spec.whatwg.org/\r\n- http://caniuse.com/#search=Fetch\r\n\r\nTested in stable channel of Chrome, latest Safari, Firefox (developer\r\nedition).\r\n\r\nDynamically determine which of XHR, Fetch APIs are available and\r\ngracefully fallback to the best available API.\r\n\r\nHere's a quick demo, using a local instance of https://http2.golang.org/reqinfo and https://http2.golang.org/clockstream endpoints. I've asked @bradfitz if it's possible to enable CORS on http2.golang.org itself, and if so, you could try this out in a playground.\r\n\r\n```Go\r\nfunc stream() error {\r\n\tresp, err := http.Get(\"https://localhost:4430/clockstream\")\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\tdefer resp.Body.Close()\r\n\tgoon.Dump(resp)\r\n\t_, err = io.Copy(os.Stdout, resp.Body)\r\n\treturn err\r\n}\r\n```\r\n\r\nResult: http://virtivia.com:27080/15kvcw9ib4f2u.mov","created_at":"2016-05-08T23:13:02Z","updated_at":"2016-05-08T23:13:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gopherjs/gopherjs/pulls/454/commits","review_comments_url":"https://api.github.com/repos/gopherjs/gopherjs/pulls/454/comments","review_comment_url":"https://api.github.com/repos/gopherjs/gopherjs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gopherjs/gopherjs/issues/454/comments","statuses_url":"https://api.github.com/repos/gopherjs/gopherjs/statuses/52c8b9ecb32c6269e84b7653f9da26d9eace0c24","head":{"label":"gopherjs:fetch-transport","ref":"fetch-transport","sha":"52c8b9ecb32c6269e84b7653f9da26d9eace0c24","user":{"login":"gopherjs","id":6654647,"avatar_url":"https://avatars.githubusercontent.com/u/6654647?v=3","gravatar_id":"","url":"https://api.github.com/users/gopherjs","html_url":"https://github.com/gopherjs","followers_url":"https://api.github.com/users/gopherjs/followers","following_url":"https://api.github.com/users/gopherjs/following{/other_user}","gists_url":"https://api.github.com/users/gopherjs/gists{/gist_id}","starred_url":"https://api.github.com/users/gopherjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopherjs/subscriptions","organizations_url":"https://api.github.com/users/gopherjs/orgs","repos_url":"https://api.github.com/users/gopherjs/repos","events_url":"https://api.github.com/users/gopherjs/events{/privacy}","received_events_url":"https://api.github.com/users/gopherjs/received_events","type":"Organization","site_admin":false},"repo":{"id":12418999,"name":"gopherjs","full_name":"gopherjs/gopherjs","owner":{"login":"gopherjs","id":6654647,"avatar_url":"https://avatars.githubusercontent.com/u/6654647?v=3","gravatar_id":"","url":"https://api.github.com/users/gopherjs","html_url":"https://github.com/gopherjs","followers_url":"https://api.github.com/users/gopherjs/followers","following_url":"https://api.github.com/users/gopherjs/following{/other_user}","gists_url":"https://api.github.com/users/gopherjs/gists{/gist_id}","starred_url":"https://api.github.com/users/gopherjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopherjs/subscriptions","organizations_url":"https://api.github.com/users/gopherjs/orgs","repos_url":"https://api.github.com/users/gopherjs/repos","events_url":"https://api.github.com/users/gopherjs/events{/privacy}","received_events_url":"https://api.github.com/users/gopherjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gopherjs/gopherjs","description":"A compiler from Go to JavaScript for running Go code in a browser","fork":false,"url":"https://api.github.com/repos/gopherjs/gopherjs","forks_url":"https://api.github.com/repos/gopherjs/gopherjs/forks","keys_url":"https://api.github.com/repos/gopherjs/gopherjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gopherjs/gopherjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gopherjs/gopherjs/teams","hooks_url":"https://api.github.com/repos/gopherjs/gopherjs/hooks","issue_events_url":"https://api.github.com/repos/gopherjs/gopherjs/issues/events{/number}","events_url":"https://api.github.com/repos/gopherjs/gopherjs/events","assignees_url":"https://api.github.com/repos/gopherjs/gopherjs/assignees{/user}","branches_url":"https://api.github.com/repos/gopherjs/gopherjs/branches{/branch}","tags_url":"https://api.github.com/repos/gopherjs/gopherjs/tags","blobs_url":"https://api.github.com/repos/gopherjs/gopherjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gopherjs/gopherjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gopherjs/gopherjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/gopherjs/gopherjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gopherjs/gopherjs/statuses/{sha}","languages_url":"https://api.github.com/repos/gopherjs/gopherjs/languages","stargazers_url":"https://api.github.com/repos/gopherjs/gopherjs/stargazers","contributors_url":"https://api.github.com/repos/gopherjs/gopherjs/contributors","subscribers_url":"https://api.github.com/repos/gopherjs/gopherjs/subscribers","subscription_url":"https://api.github.com/repos/gopherjs/gopherjs/subscription","commits_url":"https://api.github.com/repos/gopherjs/gopherjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/gopherjs/gopherjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/gopherjs/gopherjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/gopherjs/gopherjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/gopherjs/gopherjs/contents/{+path}","compare_url":"https://api.github.com/repos/gopherjs/gopherjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gopherjs/gopherjs/merges","archive_url":"https://api.github.com/repos/gopherjs/gopherjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gopherjs/gopherjs/downloads","issues_url":"https://api.github.com/repos/gopherjs/gopherjs/issues{/number}","pulls_url":"https://api.github.com/repos/gopherjs/gopherjs/pulls{/number}","milestones_url":"https://api.github.com/repos/gopherjs/gopherjs/milestones{/number}","notifications_url":"https://api.github.com/repos/gopherjs/gopherjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gopherjs/gopherjs/labels{/name}","releases_url":"https://api.github.com/repos/gopherjs/gopherjs/releases{/id}","deployments_url":"https://api.github.com/repos/gopherjs/gopherjs/deployments","created_at":"2013-08-27T22:23:58Z","updated_at":"2016-05-08T21:33:03Z","pushed_at":"2016-05-08T23:05:05Z","git_url":"git://github.com/gopherjs/gopherjs.git","ssh_url":"git@github.com:gopherjs/gopherjs.git","clone_url":"https://github.com/gopherjs/gopherjs.git","svn_url":"https://github.com/gopherjs/gopherjs","homepage":"","size":3353,"stargazers_count":3814,"watchers_count":3814,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":172,"mirror_url":null,"open_issues_count":60,"forks":172,"open_issues":60,"watchers":3814,"default_branch":"master"}},"base":{"label":"gopherjs:master","ref":"master","sha":"d5d8eb5bbb7f4c0e10ccb62e1a45277cc823ff37","user":{"login":"gopherjs","id":6654647,"avatar_url":"https://avatars.githubusercontent.com/u/6654647?v=3","gravatar_id":"","url":"https://api.github.com/users/gopherjs","html_url":"https://github.com/gopherjs","followers_url":"https://api.github.com/users/gopherjs/followers","following_url":"https://api.github.com/users/gopherjs/following{/other_user}","gists_url":"https://api.github.com/users/gopherjs/gists{/gist_id}","starred_url":"https://api.github.com/users/gopherjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopherjs/subscriptions","organizations_url":"https://api.github.com/users/gopherjs/orgs","repos_url":"https://api.github.com/users/gopherjs/repos","events_url":"https://api.github.com/users/gopherjs/events{/privacy}","received_events_url":"https://api.github.com/users/gopherjs/received_events","type":"Organization","site_admin":false},"repo":{"id":12418999,"name":"gopherjs","full_name":"gopherjs/gopherjs","owner":{"login":"gopherjs","id":6654647,"avatar_url":"https://avatars.githubusercontent.com/u/6654647?v=3","gravatar_id":"","url":"https://api.github.com/users/gopherjs","html_url":"https://github.com/gopherjs","followers_url":"https://api.github.com/users/gopherjs/followers","following_url":"https://api.github.com/users/gopherjs/following{/other_user}","gists_url":"https://api.github.com/users/gopherjs/gists{/gist_id}","starred_url":"https://api.github.com/users/gopherjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopherjs/subscriptions","organizations_url":"https://api.github.com/users/gopherjs/orgs","repos_url":"https://api.github.com/users/gopherjs/repos","events_url":"https://api.github.com/users/gopherjs/events{/privacy}","received_events_url":"https://api.github.com/users/gopherjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gopherjs/gopherjs","description":"A compiler from Go to JavaScript for running Go code in a browser","fork":false,"url":"https://api.github.com/repos/gopherjs/gopherjs","forks_url":"https://api.github.com/repos/gopherjs/gopherjs/forks","keys_url":"https://api.github.com/repos/gopherjs/gopherjs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gopherjs/gopherjs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gopherjs/gopherjs/teams","hooks_url":"https://api.github.com/repos/gopherjs/gopherjs/hooks","issue_events_url":"https://api.github.com/repos/gopherjs/gopherjs/issues/events{/number}","events_url":"https://api.github.com/repos/gopherjs/gopherjs/events","assignees_url":"https://api.github.com/repos/gopherjs/gopherjs/assignees{/user}","branches_url":"https://api.github.com/repos/gopherjs/gopherjs/branches{/branch}","tags_url":"https://api.github.com/repos/gopherjs/gopherjs/tags","blobs_url":"https://api.github.com/repos/gopherjs/gopherjs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gopherjs/gopherjs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gopherjs/gopherjs/git/refs{/sha}","trees_url":"https://api.github.com/repos/gopherjs/gopherjs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gopherjs/gopherjs/statuses/{sha}","languages_url":"https://api.github.com/repos/gopherjs/gopherjs/languages","stargazers_url":"https://api.github.com/repos/gopherjs/gopherjs/stargazers","contributors_url":"https://api.github.com/repos/gopherjs/gopherjs/contributors","subscribers_url":"https://api.github.com/repos/gopherjs/gopherjs/subscribers","subscription_url":"https://api.github.com/repos/gopherjs/gopherjs/subscription","commits_url":"https://api.github.com/repos/gopherjs/gopherjs/commits{/sha}","git_commits_url":"https://api.github.com/repos/gopherjs/gopherjs/git/commits{/sha}","comments_url":"https://api.github.com/repos/gopherjs/gopherjs/comments{/number}","issue_comment_url":"https://api.github.com/repos/gopherjs/gopherjs/issues/comments{/number}","contents_url":"https://api.github.com/repos/gopherjs/gopherjs/contents/{+path}","compare_url":"https://api.github.com/repos/gopherjs/gopherjs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gopherjs/gopherjs/merges","archive_url":"https://api.github.com/repos/gopherjs/gopherjs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gopherjs/gopherjs/downloads","issues_url":"https://api.github.com/repos/gopherjs/gopherjs/issues{/number}","pulls_url":"https://api.github.com/repos/gopherjs/gopherjs/pulls{/number}","milestones_url":"https://api.github.com/repos/gopherjs/gopherjs/milestones{/number}","notifications_url":"https://api.github.com/repos/gopherjs/gopherjs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gopherjs/gopherjs/labels{/name}","releases_url":"https://api.github.com/repos/gopherjs/gopherjs/releases{/id}","deployments_url":"https://api.github.com/repos/gopherjs/gopherjs/deployments","created_at":"2013-08-27T22:23:58Z","updated_at":"2016-05-08T21:33:03Z","pushed_at":"2016-05-08T23:05:05Z","git_url":"git://github.com/gopherjs/gopherjs.git","ssh_url":"git@github.com:gopherjs/gopherjs.git","clone_url":"https://github.com/gopherjs/gopherjs.git","svn_url":"https://github.com/gopherjs/gopherjs","homepage":"","size":3353,"stargazers_count":3814,"watchers_count":3814,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":172,"mirror_url":null,"open_issues_count":60,"forks":172,"open_issues":60,"watchers":3814,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gopherjs/gopherjs/pulls/454"},"html":{"href":"https://github.com/gopherjs/gopherjs/pull/454"},"issue":{"href":"https://api.github.com/repos/gopherjs/gopherjs/issues/454"},"comments":{"href":"https://api.github.com/repos/gopherjs/gopherjs/issues/454/comments"},"review_comments":{"href":"https://api.github.com/repos/gopherjs/gopherjs/pulls/454/comments"},"review_comment":{"href":"https://api.github.com/repos/gopherjs/gopherjs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gopherjs/gopherjs/pulls/454/commits"},"statuses":{"href":"https://api.github.com/repos/gopherjs/gopherjs/statuses/52c8b9ecb32c6269e84b7653f9da26d9eace0c24"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":143,"deletions":6,"changed_files":2}}