{"action":"created","comment":{"url":"https://api.github.com/repos/groupon/gofer/pulls/comments/79067653","id":79067653,"diff_hunk":"@@ -39,24 +40,25 @@ module.exports = (client, req, res, next) ->\n   options =\n     method: req.method\n     headers: omit req.headers, ['host']\n-    uri: pathname\n+    body: req\n     qs: omit query, [ 'callback' ]\n     # Make sure we don't polute logs with errors that aren't errors\n     # Browsers like to send If-Not-Modified-Since etc.\n     minStatusCode: 200\n     maxStatusCode: 399\n \n-  # The explicit handling of an error passed into cb\n-  # is because of a weirdness in gofer where failing option mappers\n-  # lead to undefined being defined and the callback being called\n-  # directly. Gross.\n-  properReturnValue = false\n-  proxyReq = client.request options, (err) ->\n-    return if properReturnValue\n-    next(err) if err?\n+  proxyReq = client.fetch pathname, options\n \n-  properReturnValue = proxyReq?\n+  handleProxyResponse = (proxyRes) ->\n+    new Bluebird (resolve, reject) ->\n+      proxyRes.on 'error', reject\n+      proxyRes.pipe res\n+      proxyRes.on 'end', resolve\n \n-  if properReturnValue\n-    proxyReq.on 'error', next\n-    req.pipe(proxyReq).pipe(res)\n+  piped =\n+    if typeof proxyReq.pipe == 'function'\n+      handleProxyResponse proxyReq\n+    else\n+      proxyReq.then handleProxyResponse\n+\n+  piped.then null, next","path":"src/proxy.coffee","position":46,"original_position":46,"commit_id":"62a6846695d9645ed22e4a07e16f1dd3a8d21398","original_commit_id":"62a6846695d9645ed22e4a07e16f1dd3a8d21398","user":{"login":"dbushong","id":97162,"avatar_url":"https://avatars.githubusercontent.com/u/97162?v=3","gravatar_id":"","url":"https://api.github.com/users/dbushong","html_url":"https://github.com/dbushong","followers_url":"https://api.github.com/users/dbushong/followers","following_url":"https://api.github.com/users/dbushong/following{/other_user}","gists_url":"https://api.github.com/users/dbushong/gists{/gist_id}","starred_url":"https://api.github.com/users/dbushong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbushong/subscriptions","organizations_url":"https://api.github.com/users/dbushong/orgs","repos_url":"https://api.github.com/users/dbushong/repos","events_url":"https://api.github.com/users/dbushong/events{/privacy}","received_events_url":"https://api.github.com/users/dbushong/received_events","type":"User","site_admin":false},"body":"why this instead of just `piped.catch next`?","created_at":"2016-09-15T21:37:31Z","updated_at":"2016-09-15T21:39:17Z","html_url":"https://github.com/groupon/gofer/pull/68#discussion_r79067653","pull_request_url":"https://api.github.com/repos/groupon/gofer/pulls/68","_links":{"self":{"href":"https://api.github.com/repos/groupon/gofer/pulls/comments/79067653"},"html":{"href":"https://github.com/groupon/gofer/pull/68#discussion_r79067653"},"pull_request":{"href":"https://api.github.com/repos/groupon/gofer/pulls/68"}}},"pull_request":{"url":"https://api.github.com/repos/groupon/gofer/pulls/68","id":85459155,"html_url":"https://github.com/groupon/gofer/pull/68","diff_url":"https://github.com/groupon/gofer/pull/68.diff","patch_url":"https://github.com/groupon/gofer/pull/68.patch","issue_url":"https://api.github.com/repos/groupon/gofer/issues/68","number":68,"state":"open","locked":false,"title":"Support gofer 3 in gofer/proxy","user":{"login":"jkrems","id":567540,"avatar_url":"https://avatars.githubusercontent.com/u/567540?v=3","gravatar_id":"","url":"https://api.github.com/users/jkrems","html_url":"https://github.com/jkrems","followers_url":"https://api.github.com/users/jkrems/followers","following_url":"https://api.github.com/users/jkrems/following{/other_user}","gists_url":"https://api.github.com/users/jkrems/gists{/gist_id}","starred_url":"https://api.github.com/users/jkrems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkrems/subscriptions","organizations_url":"https://api.github.com/users/jkrems/orgs","repos_url":"https://api.github.com/users/jkrems/repos","events_url":"https://api.github.com/users/jkrems/events{/privacy}","received_events_url":"https://api.github.com/users/jkrems/received_events","type":"User","site_admin":false},"body":"Tested manually against a gofer 3.x client. Long-term we should move this file into its own module and make sure we test it against both major versions of gofer.","created_at":"2016-09-15T18:50:27Z","updated_at":"2016-09-15T21:39:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"23e81be90225ca75e8575c25a61345987384fc65","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/groupon/gofer/pulls/68/commits","review_comments_url":"https://api.github.com/repos/groupon/gofer/pulls/68/comments","review_comment_url":"https://api.github.com/repos/groupon/gofer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/groupon/gofer/issues/68/comments","statuses_url":"https://api.github.com/repos/groupon/gofer/statuses/62a6846695d9645ed22e4a07e16f1dd3a8d21398","head":{"label":"groupon:jk-proxy-with-gofer-3-support","ref":"jk-proxy-with-gofer-3-support","sha":"62a6846695d9645ed22e4a07e16f1dd3a8d21398","user":{"login":"groupon","id":206233,"avatar_url":"https://avatars.githubusercontent.com/u/206233?v=3","gravatar_id":"","url":"https://api.github.com/users/groupon","html_url":"https://github.com/groupon","followers_url":"https://api.github.com/users/groupon/followers","following_url":"https://api.github.com/users/groupon/following{/other_user}","gists_url":"https://api.github.com/users/groupon/gists{/gist_id}","starred_url":"https://api.github.com/users/groupon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupon/subscriptions","organizations_url":"https://api.github.com/users/groupon/orgs","repos_url":"https://api.github.com/users/groupon/repos","events_url":"https://api.github.com/users/groupon/events{/privacy}","received_events_url":"https://api.github.com/users/groupon/received_events","type":"Organization","site_admin":false},"repo":{"id":21710399,"name":"gofer","full_name":"groupon/gofer","owner":{"login":"groupon","id":206233,"avatar_url":"https://avatars.githubusercontent.com/u/206233?v=3","gravatar_id":"","url":"https://api.github.com/users/groupon","html_url":"https://github.com/groupon","followers_url":"https://api.github.com/users/groupon/followers","following_url":"https://api.github.com/users/groupon/following{/other_user}","gists_url":"https://api.github.com/users/groupon/gists{/gist_id}","starred_url":"https://api.github.com/users/groupon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupon/subscriptions","organizations_url":"https://api.github.com/users/groupon/orgs","repos_url":"https://api.github.com/users/groupon/repos","events_url":"https://api.github.com/users/groupon/events{/privacy}","received_events_url":"https://api.github.com/users/groupon/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/groupon/gofer","description":"A general purpose service client library for node.js","fork":false,"url":"https://api.github.com/repos/groupon/gofer","forks_url":"https://api.github.com/repos/groupon/gofer/forks","keys_url":"https://api.github.com/repos/groupon/gofer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/groupon/gofer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/groupon/gofer/teams","hooks_url":"https://api.github.com/repos/groupon/gofer/hooks","issue_events_url":"https://api.github.com/repos/groupon/gofer/issues/events{/number}","events_url":"https://api.github.com/repos/groupon/gofer/events","assignees_url":"https://api.github.com/repos/groupon/gofer/assignees{/user}","branches_url":"https://api.github.com/repos/groupon/gofer/branches{/branch}","tags_url":"https://api.github.com/repos/groupon/gofer/tags","blobs_url":"https://api.github.com/repos/groupon/gofer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/groupon/gofer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/groupon/gofer/git/refs{/sha}","trees_url":"https://api.github.com/repos/groupon/gofer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/groupon/gofer/statuses/{sha}","languages_url":"https://api.github.com/repos/groupon/gofer/languages","stargazers_url":"https://api.github.com/repos/groupon/gofer/stargazers","contributors_url":"https://api.github.com/repos/groupon/gofer/contributors","subscribers_url":"https://api.github.com/repos/groupon/gofer/subscribers","subscription_url":"https://api.github.com/repos/groupon/gofer/subscription","commits_url":"https://api.github.com/repos/groupon/gofer/commits{/sha}","git_commits_url":"https://api.github.com/repos/groupon/gofer/git/commits{/sha}","comments_url":"https://api.github.com/repos/groupon/gofer/comments{/number}","issue_comment_url":"https://api.github.com/repos/groupon/gofer/issues/comments{/number}","contents_url":"https://api.github.com/repos/groupon/gofer/contents/{+path}","compare_url":"https://api.github.com/repos/groupon/gofer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/groupon/gofer/merges","archive_url":"https://api.github.com/repos/groupon/gofer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/groupon/gofer/downloads","issues_url":"https://api.github.com/repos/groupon/gofer/issues{/number}","pulls_url":"https://api.github.com/repos/groupon/gofer/pulls{/number}","milestones_url":"https://api.github.com/repos/groupon/gofer/milestones{/number}","notifications_url":"https://api.github.com/repos/groupon/gofer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/groupon/gofer/labels{/name}","releases_url":"https://api.github.com/repos/groupon/gofer/releases{/id}","deployments_url":"https://api.github.com/repos/groupon/gofer/deployments","created_at":"2014-07-10T21:08:31Z","updated_at":"2016-04-03T20:04:38Z","pushed_at":"2016-09-15T21:27:27Z","git_url":"git://github.com/groupon/gofer.git","ssh_url":"git@github.com:groupon/gofer.git","clone_url":"https://github.com/groupon/gofer.git","svn_url":"https://github.com/groupon/gofer","homepage":null,"size":312,"stargazers_count":40,"watchers_count":40,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":40,"default_branch":"master"}},"base":{"label":"groupon:master","ref":"master","sha":"3c8608235d4b78c4cb929fb79d195bf41f96a0db","user":{"login":"groupon","id":206233,"avatar_url":"https://avatars.githubusercontent.com/u/206233?v=3","gravatar_id":"","url":"https://api.github.com/users/groupon","html_url":"https://github.com/groupon","followers_url":"https://api.github.com/users/groupon/followers","following_url":"https://api.github.com/users/groupon/following{/other_user}","gists_url":"https://api.github.com/users/groupon/gists{/gist_id}","starred_url":"https://api.github.com/users/groupon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupon/subscriptions","organizations_url":"https://api.github.com/users/groupon/orgs","repos_url":"https://api.github.com/users/groupon/repos","events_url":"https://api.github.com/users/groupon/events{/privacy}","received_events_url":"https://api.github.com/users/groupon/received_events","type":"Organization","site_admin":false},"repo":{"id":21710399,"name":"gofer","full_name":"groupon/gofer","owner":{"login":"groupon","id":206233,"avatar_url":"https://avatars.githubusercontent.com/u/206233?v=3","gravatar_id":"","url":"https://api.github.com/users/groupon","html_url":"https://github.com/groupon","followers_url":"https://api.github.com/users/groupon/followers","following_url":"https://api.github.com/users/groupon/following{/other_user}","gists_url":"https://api.github.com/users/groupon/gists{/gist_id}","starred_url":"https://api.github.com/users/groupon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupon/subscriptions","organizations_url":"https://api.github.com/users/groupon/orgs","repos_url":"https://api.github.com/users/groupon/repos","events_url":"https://api.github.com/users/groupon/events{/privacy}","received_events_url":"https://api.github.com/users/groupon/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/groupon/gofer","description":"A general purpose service client library for node.js","fork":false,"url":"https://api.github.com/repos/groupon/gofer","forks_url":"https://api.github.com/repos/groupon/gofer/forks","keys_url":"https://api.github.com/repos/groupon/gofer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/groupon/gofer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/groupon/gofer/teams","hooks_url":"https://api.github.com/repos/groupon/gofer/hooks","issue_events_url":"https://api.github.com/repos/groupon/gofer/issues/events{/number}","events_url":"https://api.github.com/repos/groupon/gofer/events","assignees_url":"https://api.github.com/repos/groupon/gofer/assignees{/user}","branches_url":"https://api.github.com/repos/groupon/gofer/branches{/branch}","tags_url":"https://api.github.com/repos/groupon/gofer/tags","blobs_url":"https://api.github.com/repos/groupon/gofer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/groupon/gofer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/groupon/gofer/git/refs{/sha}","trees_url":"https://api.github.com/repos/groupon/gofer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/groupon/gofer/statuses/{sha}","languages_url":"https://api.github.com/repos/groupon/gofer/languages","stargazers_url":"https://api.github.com/repos/groupon/gofer/stargazers","contributors_url":"https://api.github.com/repos/groupon/gofer/contributors","subscribers_url":"https://api.github.com/repos/groupon/gofer/subscribers","subscription_url":"https://api.github.com/repos/groupon/gofer/subscription","commits_url":"https://api.github.com/repos/groupon/gofer/commits{/sha}","git_commits_url":"https://api.github.com/repos/groupon/gofer/git/commits{/sha}","comments_url":"https://api.github.com/repos/groupon/gofer/comments{/number}","issue_comment_url":"https://api.github.com/repos/groupon/gofer/issues/comments{/number}","contents_url":"https://api.github.com/repos/groupon/gofer/contents/{+path}","compare_url":"https://api.github.com/repos/groupon/gofer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/groupon/gofer/merges","archive_url":"https://api.github.com/repos/groupon/gofer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/groupon/gofer/downloads","issues_url":"https://api.github.com/repos/groupon/gofer/issues{/number}","pulls_url":"https://api.github.com/repos/groupon/gofer/pulls{/number}","milestones_url":"https://api.github.com/repos/groupon/gofer/milestones{/number}","notifications_url":"https://api.github.com/repos/groupon/gofer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/groupon/gofer/labels{/name}","releases_url":"https://api.github.com/repos/groupon/gofer/releases{/id}","deployments_url":"https://api.github.com/repos/groupon/gofer/deployments","created_at":"2014-07-10T21:08:31Z","updated_at":"2016-04-03T20:04:38Z","pushed_at":"2016-09-15T21:27:27Z","git_url":"git://github.com/groupon/gofer.git","ssh_url":"git@github.com:groupon/gofer.git","clone_url":"https://github.com/groupon/gofer.git","svn_url":"https://github.com/groupon/gofer","homepage":null,"size":312,"stargazers_count":40,"watchers_count":40,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":40,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/groupon/gofer/pulls/68"},"html":{"href":"https://github.com/groupon/gofer/pull/68"},"issue":{"href":"https://api.github.com/repos/groupon/gofer/issues/68"},"comments":{"href":"https://api.github.com/repos/groupon/gofer/issues/68/comments"},"review_comments":{"href":"https://api.github.com/repos/groupon/gofer/pulls/68/comments"},"review_comment":{"href":"https://api.github.com/repos/groupon/gofer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/groupon/gofer/pulls/68/commits"},"statuses":{"href":"https://api.github.com/repos/groupon/gofer/statuses/62a6846695d9645ed22e4a07e16f1dd3a8d21398"}}}}
{"actor":{"display_login":"dbushong"}}