{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/apm-agent-nodejs/pulls/comments/199922974","pull_request_review_id":134136715,"id":199922974,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTkyMjk3NA==","diff_hunk":"@@ -0,0 +1,45 @@\n+'use strict'\n+\n+require('../../../..').start({\n+  serviceName: 'test',\n+  captureExceptions: false\n+})\n+\n+var http = require('http')\n+var zlib = require('zlib')\n+var fs = require('fs')\n+var got = require('got')\n+var test = require('tape')\n+\n+test('https://github.com/elastic/apm-agent-nodejs/issues/423', function (t) {\n+  // Start dummy remote server to fetch gzip'ed data from\n+  var remote = http.createServer(function (req, res) {\n+    res.setHeader('Content-Encoding', 'gzip')\n+    fs.createReadStream(__filename).pipe(zlib.createGzip()).pipe(res)\n+  })\n+\n+  remote.listen(function () {\n+    var port = remote.address().port\n+    var url = 'http://localhost:' + port\n+\n+    // Start simple server that performs got-request on every request\n+    var server = http.createServer(function (req, res) {\n+      got(url).then(function (response) {\n+        t.equal(response.body[0], '\\'', 'body should be uncompressed')","path":"test/instrumentation/modules/http/github-423.js","position":null,"original_position":28,"commit_id":"5f43355f965bcface901d4615657ad8641734476","original_commit_id":"3e10d2ead48c65f40a94bd8c238a094ab8a67bf0","user":{"login":"watson","id":10602,"node_id":"MDQ6VXNlcjEwNjAy","avatar_url":"https://avatars3.githubusercontent.com/u/10602?v=4","gravatar_id":"","url":"https://api.github.com/users/watson","html_url":"https://github.com/watson","followers_url":"https://api.github.com/users/watson/followers","following_url":"https://api.github.com/users/watson/following{/other_user}","gists_url":"https://api.github.com/users/watson/gists{/gist_id}","starred_url":"https://api.github.com/users/watson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/watson/subscriptions","organizations_url":"https://api.github.com/users/watson/orgs","repos_url":"https://api.github.com/users/watson/repos","events_url":"https://api.github.com/users/watson/events{/privacy}","received_events_url":"https://api.github.com/users/watson/received_events","type":"User","site_admin":false},"body":"Ok, ended up testing just the first line and added a test for the total length as well. That should hopefully cover everything 😃 ","created_at":"2018-07-03T19:16:52Z","updated_at":"2018-07-03T19:16:52Z","html_url":"https://github.com/elastic/apm-agent-nodejs/pull/429#discussion_r199922974","pull_request_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/pulls/429","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/elastic/apm-agent-nodejs/pulls/comments/199922974"},"html":{"href":"https://github.com/elastic/apm-agent-nodejs/pull/429#discussion_r199922974"},"pull_request":{"href":"https://api.github.com/repos/elastic/apm-agent-nodejs/pulls/429"}},"in_reply_to_id":199872498},"pull_request":{"url":"https://api.github.com/repos/elastic/apm-agent-nodejs/pulls/429","id":198690699,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4NjkwNjk5","html_url":"https://github.com/elastic/apm-agent-nodejs/pull/429","diff_url":"https://github.com/elastic/apm-agent-nodejs/pull/429.diff","patch_url":"https://github.com/elastic/apm-agent-nodejs/pull/429.patch","issue_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/issues/429","number":429,"state":"open","locked":false,"title":"fix: ensure correct streaming when using mimic-response","user":{"login":"watson","id":10602,"node_id":"MDQ6VXNlcjEwNjAy","avatar_url":"https://avatars3.githubusercontent.com/u/10602?v=4","gravatar_id":"","url":"https://api.github.com/users/watson","html_url":"https://github.com/watson","followers_url":"https://api.github.com/users/watson/followers","following_url":"https://api.github.com/users/watson/following{/other_user}","gists_url":"https://api.github.com/users/watson/gists{/gist_id}","starred_url":"https://api.github.com/users/watson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/watson/subscriptions","organizations_url":"https://api.github.com/users/watson/orgs","repos_url":"https://api.github.com/users/watson/repos","events_url":"https://api.github.com/users/watson/events{/privacy}","received_events_url":"https://api.github.com/users/watson/received_events","type":"User","site_admin":false},"body":"The `mimic-response` module exposes a single function with the following API:\r\n\r\n```js\r\nmimicResponse(fromStream, toStream)\r\n```\r\n\r\nIf someone is calling `mimicResponse` where the `fromStream` have had its emitter functions bound using `bindEmitter(fromStream)`, the `toStream` will wrongly bind all its event listeners to the `fromStream`.\r\n\r\nThis becomes especially problematic in case the data is transformed either in the `toStream` or in between `fromStream` and `toStream`, eg:\r\n\r\n```js\r\nfromStream.pipe(zlib.createGunzip()).pipe(toStream)\r\n```\r\n\r\nIn those cases, the data emitted by `toStream` will actually be the un-transformed data coming from the `fromStream`.\r\n\r\nThis commit patches `mimic-response` so that the event emitters of `toStream` runs in the expected context.\r\n\r\nFixes #423","created_at":"2018-07-02T14:06:09Z","updated_at":"2018-07-03T19:16:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e80d4b7dc438f021edc59ed465558daf1d346416","assignee":{"login":"watson","id":10602,"node_id":"MDQ6VXNlcjEwNjAy","avatar_url":"https://avatars3.githubusercontent.com/u/10602?v=4","gravatar_id":"","url":"https://api.github.com/users/watson","html_url":"https://github.com/watson","followers_url":"https://api.github.com/users/watson/followers","following_url":"https://api.github.com/users/watson/following{/other_user}","gists_url":"https://api.github.com/users/watson/gists{/gist_id}","starred_url":"https://api.github.com/users/watson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/watson/subscriptions","organizations_url":"https://api.github.com/users/watson/orgs","repos_url":"https://api.github.com/users/watson/repos","events_url":"https://api.github.com/users/watson/events{/privacy}","received_events_url":"https://api.github.com/users/watson/received_events","type":"User","site_admin":false},"assignees":[{"login":"watson","id":10602,"node_id":"MDQ6VXNlcjEwNjAy","avatar_url":"https://avatars3.githubusercontent.com/u/10602?v=4","gravatar_id":"","url":"https://api.github.com/users/watson","html_url":"https://github.com/watson","followers_url":"https://api.github.com/users/watson/followers","following_url":"https://api.github.com/users/watson/following{/other_user}","gists_url":"https://api.github.com/users/watson/gists{/gist_id}","starred_url":"https://api.github.com/users/watson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/watson/subscriptions","organizations_url":"https://api.github.com/users/watson/orgs","repos_url":"https://api.github.com/users/watson/repos","events_url":"https://api.github.com/users/watson/events{/privacy}","received_events_url":"https://api.github.com/users/watson/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":882569428,"node_id":"MDU6TGFiZWw4ODI1Njk0Mjg=","url":"https://api.github.com/repos/elastic/apm-agent-nodejs/labels/[zube]:%20In%20Review","name":"[zube]: In Review","color":"ffffff","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/pulls/429/commits","review_comments_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/pulls/429/comments","review_comment_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/issues/429/comments","statuses_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/statuses/5f43355f965bcface901d4615657ad8641734476","head":{"label":"watson:mimic-response","ref":"mimic-response","sha":"5f43355f965bcface901d4615657ad8641734476","user":{"login":"watson","id":10602,"node_id":"MDQ6VXNlcjEwNjAy","avatar_url":"https://avatars3.githubusercontent.com/u/10602?v=4","gravatar_id":"","url":"https://api.github.com/users/watson","html_url":"https://github.com/watson","followers_url":"https://api.github.com/users/watson/followers","following_url":"https://api.github.com/users/watson/following{/other_user}","gists_url":"https://api.github.com/users/watson/gists{/gist_id}","starred_url":"https://api.github.com/users/watson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/watson/subscriptions","organizations_url":"https://api.github.com/users/watson/orgs","repos_url":"https://api.github.com/users/watson/repos","events_url":"https://api.github.com/users/watson/events{/privacy}","received_events_url":"https://api.github.com/users/watson/received_events","type":"User","site_admin":false},"repo":{"id":102186538,"node_id":"MDEwOlJlcG9zaXRvcnkxMDIxODY1Mzg=","name":"apm-agent-nodejs","full_name":"watson/apm-agent-nodejs","owner":{"login":"watson","id":10602,"node_id":"MDQ6VXNlcjEwNjAy","avatar_url":"https://avatars3.githubusercontent.com/u/10602?v=4","gravatar_id":"","url":"https://api.github.com/users/watson","html_url":"https://github.com/watson","followers_url":"https://api.github.com/users/watson/followers","following_url":"https://api.github.com/users/watson/following{/other_user}","gists_url":"https://api.github.com/users/watson/gists{/gist_id}","starred_url":"https://api.github.com/users/watson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/watson/subscriptions","organizations_url":"https://api.github.com/users/watson/orgs","repos_url":"https://api.github.com/users/watson/repos","events_url":"https://api.github.com/users/watson/events{/privacy}","received_events_url":"https://api.github.com/users/watson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/watson/apm-agent-nodejs","description":"Elastic APM Node.js Agent (Experimental)","fork":true,"url":"https://api.github.com/repos/watson/apm-agent-nodejs","forks_url":"https://api.github.com/repos/watson/apm-agent-nodejs/forks","keys_url":"https://api.github.com/repos/watson/apm-agent-nodejs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/watson/apm-agent-nodejs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/watson/apm-agent-nodejs/teams","hooks_url":"https://api.github.com/repos/watson/apm-agent-nodejs/hooks","issue_events_url":"https://api.github.com/repos/watson/apm-agent-nodejs/issues/events{/number}","events_url":"https://api.github.com/repos/watson/apm-agent-nodejs/events","assignees_url":"https://api.github.com/repos/watson/apm-agent-nodejs/assignees{/user}","branches_url":"https://api.github.com/repos/watson/apm-agent-nodejs/branches{/branch}","tags_url":"https://api.github.com/repos/watson/apm-agent-nodejs/tags","blobs_url":"https://api.github.com/repos/watson/apm-agent-nodejs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/watson/apm-agent-nodejs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/watson/apm-agent-nodejs/git/refs{/sha}","trees_url":"https://api.github.com/repos/watson/apm-agent-nodejs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/watson/apm-agent-nodejs/statuses/{sha}","languages_url":"https://api.github.com/repos/watson/apm-agent-nodejs/languages","stargazers_url":"https://api.github.com/repos/watson/apm-agent-nodejs/stargazers","contributors_url":"https://api.github.com/repos/watson/apm-agent-nodejs/contributors","subscribers_url":"https://api.github.com/repos/watson/apm-agent-nodejs/subscribers","subscription_url":"https://api.github.com/repos/watson/apm-agent-nodejs/subscription","commits_url":"https://api.github.com/repos/watson/apm-agent-nodejs/commits{/sha}","git_commits_url":"https://api.github.com/repos/watson/apm-agent-nodejs/git/commits{/sha}","comments_url":"https://api.github.com/repos/watson/apm-agent-nodejs/comments{/number}","issue_comment_url":"https://api.github.com/repos/watson/apm-agent-nodejs/issues/comments{/number}","contents_url":"https://api.github.com/repos/watson/apm-agent-nodejs/contents/{+path}","compare_url":"https://api.github.com/repos/watson/apm-agent-nodejs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/watson/apm-agent-nodejs/merges","archive_url":"https://api.github.com/repos/watson/apm-agent-nodejs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/watson/apm-agent-nodejs/downloads","issues_url":"https://api.github.com/repos/watson/apm-agent-nodejs/issues{/number}","pulls_url":"https://api.github.com/repos/watson/apm-agent-nodejs/pulls{/number}","milestones_url":"https://api.github.com/repos/watson/apm-agent-nodejs/milestones{/number}","notifications_url":"https://api.github.com/repos/watson/apm-agent-nodejs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/watson/apm-agent-nodejs/labels{/name}","releases_url":"https://api.github.com/repos/watson/apm-agent-nodejs/releases{/id}","deployments_url":"https://api.github.com/repos/watson/apm-agent-nodejs/deployments","created_at":"2017-09-02T09:33:15Z","updated_at":"2018-06-27T07:56:27Z","pushed_at":"2018-07-03T19:15:27Z","git_url":"git://github.com/watson/apm-agent-nodejs.git","ssh_url":"git@github.com:watson/apm-agent-nodejs.git","clone_url":"https://github.com/watson/apm-agent-nodejs.git","svn_url":"https://github.com/watson/apm-agent-nodejs","homepage":"","size":1772,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause","node_id":"MDc6TGljZW5zZTQ="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"e17d641963077e4c05a4de6767a98e9ddc12e294","user":{"login":"elastic","id":6764390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3NjQzOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6764390?v=4","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":99673273,"node_id":"MDEwOlJlcG9zaXRvcnk5OTY3MzI3Mw==","name":"apm-agent-nodejs","full_name":"elastic/apm-agent-nodejs","owner":{"login":"elastic","id":6764390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3NjQzOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6764390?v=4","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/apm-agent-nodejs","description":"Elastic APM Node.js Agent","fork":false,"url":"https://api.github.com/repos/elastic/apm-agent-nodejs","forks_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/forks","keys_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/teams","hooks_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/hooks","issue_events_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/events","assignees_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/tags","blobs_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/languages","stargazers_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/stargazers","contributors_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/contributors","subscribers_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/subscribers","subscription_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/subscription","commits_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/merges","archive_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/downloads","issues_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/labels{/name}","releases_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/releases{/id}","deployments_url":"https://api.github.com/repos/elastic/apm-agent-nodejs/deployments","created_at":"2017-08-08T09:07:27Z","updated_at":"2018-07-03T17:08:51Z","pushed_at":"2018-07-03T19:15:28Z","git_url":"git://github.com/elastic/apm-agent-nodejs.git","ssh_url":"git@github.com:elastic/apm-agent-nodejs.git","clone_url":"https://github.com/elastic/apm-agent-nodejs.git","svn_url":"https://github.com/elastic/apm-agent-nodejs","homepage":"https://www.elastic.co/guide/en/apm/agent/nodejs/current/index.html","size":1768,"stargazers_count":102,"watchers_count":102,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"archived":false,"open_issues_count":54,"license":{"key":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause","node_id":"MDc6TGljZW5zZTQ="},"forks":29,"open_issues":54,"watchers":102,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/apm-agent-nodejs/pulls/429"},"html":{"href":"https://github.com/elastic/apm-agent-nodejs/pull/429"},"issue":{"href":"https://api.github.com/repos/elastic/apm-agent-nodejs/issues/429"},"comments":{"href":"https://api.github.com/repos/elastic/apm-agent-nodejs/issues/429/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/apm-agent-nodejs/pulls/429/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/apm-agent-nodejs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/apm-agent-nodejs/pulls/429/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/apm-agent-nodejs/statuses/5f43355f965bcface901d4615657ad8641734476"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"watson"}}