{"action":"created","comment":{"url":"https://api.github.com/repos/tomas/needle/pulls/comments/84702186","pull_request_review_id":5459807,"id":84702186,"diff_hunk":"@@ -432,16 +440,17 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,\n           delete config.headers['content-length']; // in case the original was a multipart POST request.\n         }\n \n-        if (config.follow_set_cookies && resp.cookies)\n-          config.headers['cookie'] = cookies.write(resp.cookies);\n+        if (config.follow_set_cookies && resp.cookies) {\n+          config.headers['Cookie'] = cookies.write(Object.assign(resp.cookies, cookies.read(headers['set-cookie'])));\n+        }\n \n         if (config.follow_set_referer)\n           config.headers['referer'] = uri; // the original, not the destination URL.\n \n         config.headers['host'] = null; // clear previous Host header to avoid conflicts.\n \n         debug('Redirecting to ' + url.resolve(uri, headers.location));\n-        return self.send_request(++count, method, url.resolve(uri, headers.location), config, post_data, out, callback);\n+        return self.send_request(++count, method, url.resolve(uri, headers.location), config, post_data, out, cookies.read(headers['set-cookie']), callback);","path":"lib/needle.js","position":97,"original_position":97,"commit_id":"d8b826f248ae5a5834a918440a96a4102c300781","original_commit_id":"d8b826f248ae5a5834a918440a96a4102c300781","user":{"login":"rchipka","id":7538316,"avatar_url":"https://avatars.githubusercontent.com/u/7538316?v=3","gravatar_id":"","url":"https://api.github.com/users/rchipka","html_url":"https://github.com/rchipka","followers_url":"https://api.github.com/users/rchipka/followers","following_url":"https://api.github.com/users/rchipka/following{/other_user}","gists_url":"https://api.github.com/users/rchipka/gists{/gist_id}","starred_url":"https://api.github.com/users/rchipka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rchipka/subscriptions","organizations_url":"https://api.github.com/users/rchipka/orgs","repos_url":"https://api.github.com/users/rchipka/repos","events_url":"https://api.github.com/users/rchipka/events{/privacy}","received_events_url":"https://api.github.com/users/rchipka/received_events","type":"User","site_admin":false},"body":"Instead of using cookies.read() again here, why not just use `resp.cookies` directly?","created_at":"2016-10-24T14:40:00Z","updated_at":"2016-10-24T14:54:12Z","html_url":"https://github.com/tomas/needle/pull/129#discussion_r84702186","pull_request_url":"https://api.github.com/repos/tomas/needle/pulls/129","_links":{"self":{"href":"https://api.github.com/repos/tomas/needle/pulls/comments/84702186"},"html":{"href":"https://github.com/tomas/needle/pull/129#discussion_r84702186"},"pull_request":{"href":"https://api.github.com/repos/tomas/needle/pulls/129"}}},"pull_request":{"url":"https://api.github.com/repos/tomas/needle/pulls/129","id":34615937,"html_url":"https://github.com/tomas/needle/pull/129","diff_url":"https://github.com/tomas/needle/pull/129.diff","patch_url":"https://github.com/tomas/needle/pull/129.patch","issue_url":"https://api.github.com/repos/tomas/needle/issues/129","number":129,"state":"open","locked":false,"title":"Added CookieJar for storing all cookies on redirects","user":{"login":"icemilo","id":4646178,"avatar_url":"https://avatars.githubusercontent.com/u/4646178?v=3","gravatar_id":"","url":"https://api.github.com/users/icemilo","html_url":"https://github.com/icemilo","followers_url":"https://api.github.com/users/icemilo/followers","following_url":"https://api.github.com/users/icemilo/following{/other_user}","gists_url":"https://api.github.com/users/icemilo/gists{/gist_id}","starred_url":"https://api.github.com/users/icemilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icemilo/subscriptions","organizations_url":"https://api.github.com/users/icemilo/orgs","repos_url":"https://api.github.com/users/icemilo/repos","events_url":"https://api.github.com/users/icemilo/events{/privacy}","received_events_url":"https://api.github.com/users/icemilo/received_events","type":"User","site_admin":false},"body":"Hi, I love needle which simplifies http requests.\r\nI needed to store all the cookies for future request to the same origin, but needle only stores the latest cookie from the last redirect.\r\n\r\nI thought someone else might need this feature so I created a pull request.\r\nI've added a global variable to store all the cookies site sets on redirects and requests with cookies saved in the global `cookieJar`. And also, I have added a config key as `follow_set_all_cookies` defaults to `false`. Also, added `exports.cookies` for future needle requests.\r\n","created_at":"2015-05-04T05:11:21Z","updated_at":"2016-10-24T14:54:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62dddb5d17cabd31ec485c95eb1a90ea7b7987cf","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/tomas/needle/pulls/129/commits","review_comments_url":"https://api.github.com/repos/tomas/needle/pulls/129/comments","review_comment_url":"https://api.github.com/repos/tomas/needle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tomas/needle/issues/129/comments","statuses_url":"https://api.github.com/repos/tomas/needle/statuses/d8b826f248ae5a5834a918440a96a4102c300781","head":{"label":"icemilo:master","ref":"master","sha":"d8b826f248ae5a5834a918440a96a4102c300781","user":{"login":"icemilo","id":4646178,"avatar_url":"https://avatars.githubusercontent.com/u/4646178?v=3","gravatar_id":"","url":"https://api.github.com/users/icemilo","html_url":"https://github.com/icemilo","followers_url":"https://api.github.com/users/icemilo/followers","following_url":"https://api.github.com/users/icemilo/following{/other_user}","gists_url":"https://api.github.com/users/icemilo/gists{/gist_id}","starred_url":"https://api.github.com/users/icemilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icemilo/subscriptions","organizations_url":"https://api.github.com/users/icemilo/orgs","repos_url":"https://api.github.com/users/icemilo/repos","events_url":"https://api.github.com/users/icemilo/events{/privacy}","received_events_url":"https://api.github.com/users/icemilo/received_events","type":"User","site_admin":false},"repo":{"id":35014753,"name":"needle","full_name":"icemilo/needle","owner":{"login":"icemilo","id":4646178,"avatar_url":"https://avatars.githubusercontent.com/u/4646178?v=3","gravatar_id":"","url":"https://api.github.com/users/icemilo","html_url":"https://github.com/icemilo","followers_url":"https://api.github.com/users/icemilo/followers","following_url":"https://api.github.com/users/icemilo/following{/other_user}","gists_url":"https://api.github.com/users/icemilo/gists{/gist_id}","starred_url":"https://api.github.com/users/icemilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icemilo/subscriptions","organizations_url":"https://api.github.com/users/icemilo/orgs","repos_url":"https://api.github.com/users/icemilo/repos","events_url":"https://api.github.com/users/icemilo/events{/privacy}","received_events_url":"https://api.github.com/users/icemilo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/icemilo/needle","description":"Nimble, streamable HTTP client for Node.js/IO.js. With proxy, iconv, cookie, deflate & multipart support.","fork":true,"url":"https://api.github.com/repos/icemilo/needle","forks_url":"https://api.github.com/repos/icemilo/needle/forks","keys_url":"https://api.github.com/repos/icemilo/needle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/icemilo/needle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/icemilo/needle/teams","hooks_url":"https://api.github.com/repos/icemilo/needle/hooks","issue_events_url":"https://api.github.com/repos/icemilo/needle/issues/events{/number}","events_url":"https://api.github.com/repos/icemilo/needle/events","assignees_url":"https://api.github.com/repos/icemilo/needle/assignees{/user}","branches_url":"https://api.github.com/repos/icemilo/needle/branches{/branch}","tags_url":"https://api.github.com/repos/icemilo/needle/tags","blobs_url":"https://api.github.com/repos/icemilo/needle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/icemilo/needle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/icemilo/needle/git/refs{/sha}","trees_url":"https://api.github.com/repos/icemilo/needle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/icemilo/needle/statuses/{sha}","languages_url":"https://api.github.com/repos/icemilo/needle/languages","stargazers_url":"https://api.github.com/repos/icemilo/needle/stargazers","contributors_url":"https://api.github.com/repos/icemilo/needle/contributors","subscribers_url":"https://api.github.com/repos/icemilo/needle/subscribers","subscription_url":"https://api.github.com/repos/icemilo/needle/subscription","commits_url":"https://api.github.com/repos/icemilo/needle/commits{/sha}","git_commits_url":"https://api.github.com/repos/icemilo/needle/git/commits{/sha}","comments_url":"https://api.github.com/repos/icemilo/needle/comments{/number}","issue_comment_url":"https://api.github.com/repos/icemilo/needle/issues/comments{/number}","contents_url":"https://api.github.com/repos/icemilo/needle/contents/{+path}","compare_url":"https://api.github.com/repos/icemilo/needle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/icemilo/needle/merges","archive_url":"https://api.github.com/repos/icemilo/needle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/icemilo/needle/downloads","issues_url":"https://api.github.com/repos/icemilo/needle/issues{/number}","pulls_url":"https://api.github.com/repos/icemilo/needle/pulls{/number}","milestones_url":"https://api.github.com/repos/icemilo/needle/milestones{/number}","notifications_url":"https://api.github.com/repos/icemilo/needle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/icemilo/needle/labels{/name}","releases_url":"https://api.github.com/repos/icemilo/needle/releases{/id}","deployments_url":"https://api.github.com/repos/icemilo/needle/deployments","created_at":"2015-05-04T04:54:13Z","updated_at":"2016-06-07T02:44:24Z","pushed_at":"2016-10-24T05:40:01Z","git_url":"git://github.com/icemilo/needle.git","ssh_url":"git@github.com:icemilo/needle.git","clone_url":"https://github.com/icemilo/needle.git","svn_url":"https://github.com/icemilo/needle","homepage":"","size":446,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"tomas:master","ref":"master","sha":"35a8c8ce7ec5b5432c35a3752aab748cff8b420a","user":{"login":"tomas","id":10574,"avatar_url":"https://avatars.githubusercontent.com/u/10574?v=3","gravatar_id":"","url":"https://api.github.com/users/tomas","html_url":"https://github.com/tomas","followers_url":"https://api.github.com/users/tomas/followers","following_url":"https://api.github.com/users/tomas/following{/other_user}","gists_url":"https://api.github.com/users/tomas/gists{/gist_id}","starred_url":"https://api.github.com/users/tomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomas/subscriptions","organizations_url":"https://api.github.com/users/tomas/orgs","repos_url":"https://api.github.com/users/tomas/repos","events_url":"https://api.github.com/users/tomas/events{/privacy}","received_events_url":"https://api.github.com/users/tomas/received_events","type":"User","site_admin":false},"repo":{"id":2956541,"name":"needle","full_name":"tomas/needle","owner":{"login":"tomas","id":10574,"avatar_url":"https://avatars.githubusercontent.com/u/10574?v=3","gravatar_id":"","url":"https://api.github.com/users/tomas","html_url":"https://github.com/tomas","followers_url":"https://api.github.com/users/tomas/followers","following_url":"https://api.github.com/users/tomas/following{/other_user}","gists_url":"https://api.github.com/users/tomas/gists{/gist_id}","starred_url":"https://api.github.com/users/tomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomas/subscriptions","organizations_url":"https://api.github.com/users/tomas/orgs","repos_url":"https://api.github.com/users/tomas/repos","events_url":"https://api.github.com/users/tomas/events{/privacy}","received_events_url":"https://api.github.com/users/tomas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tomas/needle","description":"Nimble, streamable HTTP client for Node.js. With proxy, iconv, cookie, deflate & multipart support.","fork":false,"url":"https://api.github.com/repos/tomas/needle","forks_url":"https://api.github.com/repos/tomas/needle/forks","keys_url":"https://api.github.com/repos/tomas/needle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomas/needle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomas/needle/teams","hooks_url":"https://api.github.com/repos/tomas/needle/hooks","issue_events_url":"https://api.github.com/repos/tomas/needle/issues/events{/number}","events_url":"https://api.github.com/repos/tomas/needle/events","assignees_url":"https://api.github.com/repos/tomas/needle/assignees{/user}","branches_url":"https://api.github.com/repos/tomas/needle/branches{/branch}","tags_url":"https://api.github.com/repos/tomas/needle/tags","blobs_url":"https://api.github.com/repos/tomas/needle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomas/needle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomas/needle/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomas/needle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomas/needle/statuses/{sha}","languages_url":"https://api.github.com/repos/tomas/needle/languages","stargazers_url":"https://api.github.com/repos/tomas/needle/stargazers","contributors_url":"https://api.github.com/repos/tomas/needle/contributors","subscribers_url":"https://api.github.com/repos/tomas/needle/subscribers","subscription_url":"https://api.github.com/repos/tomas/needle/subscription","commits_url":"https://api.github.com/repos/tomas/needle/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomas/needle/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomas/needle/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomas/needle/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomas/needle/contents/{+path}","compare_url":"https://api.github.com/repos/tomas/needle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomas/needle/merges","archive_url":"https://api.github.com/repos/tomas/needle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomas/needle/downloads","issues_url":"https://api.github.com/repos/tomas/needle/issues{/number}","pulls_url":"https://api.github.com/repos/tomas/needle/pulls{/number}","milestones_url":"https://api.github.com/repos/tomas/needle/milestones{/number}","notifications_url":"https://api.github.com/repos/tomas/needle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomas/needle/labels{/name}","releases_url":"https://api.github.com/repos/tomas/needle/releases{/id}","deployments_url":"https://api.github.com/repos/tomas/needle/deployments","created_at":"2011-12-11T03:09:37Z","updated_at":"2016-10-23T17:58:45Z","pushed_at":"2016-10-24T05:40:01Z","git_url":"git://github.com/tomas/needle.git","ssh_url":"git@github.com:tomas/needle.git","clone_url":"https://github.com/tomas/needle.git","svn_url":"https://github.com/tomas/needle","homepage":"","size":554,"stargazers_count":716,"watchers_count":716,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":126,"mirror_url":null,"open_issues_count":17,"forks":126,"open_issues":17,"watchers":716,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tomas/needle/pulls/129"},"html":{"href":"https://github.com/tomas/needle/pull/129"},"issue":{"href":"https://api.github.com/repos/tomas/needle/issues/129"},"comments":{"href":"https://api.github.com/repos/tomas/needle/issues/129/comments"},"review_comments":{"href":"https://api.github.com/repos/tomas/needle/pulls/129/comments"},"review_comment":{"href":"https://api.github.com/repos/tomas/needle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tomas/needle/pulls/129/commits"},"statuses":{"href":"https://api.github.com/repos/tomas/needle/statuses/d8b826f248ae5a5834a918440a96a4102c300781"}}}}
{"actor":{"display_login":"rchipka"}}