{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/90777417","pull_request_review_id":11294497,"id":90777417,"diff_hunk":"@@ -0,0 +1,48 @@\n+'use strict';\n+const common = require('../common');\n+const assert = require('assert');\n+const http = require('http');\n+\n+const expectedSuccesses = {\n+  undefined: 'GET',\n+  null: 'GET',\n+  'get': 'GET',\n+  'post': 'POST'\n+};\n+\n+const methods = Object.keys(expectedSuccesses);\n+let requestCount = 0;\n+\n+const server = http.createServer((req, res) => {\n+  requestCount++;\n+  res.end();\n+\n+  if (methods.length === requestCount) {\n+    server.close();\n+  }\n+}).listen(0, test);\n+\n+function test() {\n+  function fail(input) {\n+    assert.throws(() => {\n+      http.request({ method: input, path: '/' }, common.fail);\n+    }, /Method must be a string/);","path":"test/parallel/test-http-client-check-http-token.js","position":29,"original_position":29,"commit_id":"242c5c929cc4c348b89c21ceb66a6adc5117b007","original_commit_id":"242c5c929cc4c348b89c21ceb66a6adc5117b007","user":{"login":"cjihrig","id":2512748,"avatar_url":"https://avatars.githubusercontent.com/u/2512748?v=3","gravatar_id":"","url":"https://api.github.com/users/cjihrig","html_url":"https://github.com/cjihrig","followers_url":"https://api.github.com/users/cjihrig/followers","following_url":"https://api.github.com/users/cjihrig/following{/other_user}","gists_url":"https://api.github.com/users/cjihrig/gists{/gist_id}","starred_url":"https://api.github.com/users/cjihrig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjihrig/subscriptions","organizations_url":"https://api.github.com/users/cjihrig/orgs","repos_url":"https://api.github.com/users/cjihrig/repos","events_url":"https://api.github.com/users/cjihrig/events{/privacy}","received_events_url":"https://api.github.com/users/cjihrig/received_events","type":"User","site_admin":false},"body":"If you want to be really strict, this could be `/^TypeError: Method must be a string$/`.","created_at":"2016-12-04T13:30:02Z","updated_at":"2016-12-04T13:32:14Z","html_url":"https://github.com/nodejs/node/pull/10111#discussion_r90777417","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/10111","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/90777417"},"html":{"href":"https://github.com/nodejs/node/pull/10111#discussion_r90777417"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/10111"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/10111","id":96426247,"html_url":"https://github.com/nodejs/node/pull/10111","diff_url":"https://github.com/nodejs/node/pull/10111.diff","patch_url":"https://github.com/nodejs/node/pull/10111.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/10111","number":10111,"state":"open","locked":false,"title":"http: verify method is a string","user":{"login":"lucamaraschi","id":332968,"avatar_url":"https://avatars.githubusercontent.com/u/332968?v=3","gravatar_id":"","url":"https://api.github.com/users/lucamaraschi","html_url":"https://github.com/lucamaraschi","followers_url":"https://api.github.com/users/lucamaraschi/followers","following_url":"https://api.github.com/users/lucamaraschi/following{/other_user}","gists_url":"https://api.github.com/users/lucamaraschi/gists{/gist_id}","starred_url":"https://api.github.com/users/lucamaraschi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucamaraschi/subscriptions","organizations_url":"https://api.github.com/users/lucamaraschi/orgs","repos_url":"https://api.github.com/users/lucamaraschi/repos","events_url":"https://api.github.com/users/lucamaraschi/events{/privacy}","received_events_url":"https://api.github.com/users/lucamaraschi/received_events","type":"User","site_admin":false},"body":"##### Checklist\r\n\r\n- [ x] tests and/or benchmarks are included\r\n- [ x] commit message follows commit guidelines\r\n\r\n##### Affected core subsystem(s)\r\nhttp\r\n\r\n\r\n##### Description of change\r\nAdded strict check for http request `method` to be a `string`. If `method` is not a string (or `undefined` or `null`) a `TypeError` exceptions is thrown. \r\nThe `method` value is still defaulted to `GET` in the following cases:\r\n- `method` is `undefined`\r\n- `method` is `null`\r\nThis fixes the `http-client` to crash if `options.method` in `http.request` was set to a number not equal to 0.\r\n\r\n","created_at":"2016-12-04T08:51:19Z","updated_at":"2016-12-04T13:32:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c3b253df29bf1e1b6a679964e91c1ec6ceabec8d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/10111/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/10111/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/10111/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/242c5c929cc4c348b89c21ceb66a6adc5117b007","head":{"label":"lucamaraschi:master","ref":"master","sha":"242c5c929cc4c348b89c21ceb66a6adc5117b007","user":{"login":"lucamaraschi","id":332968,"avatar_url":"https://avatars.githubusercontent.com/u/332968?v=3","gravatar_id":"","url":"https://api.github.com/users/lucamaraschi","html_url":"https://github.com/lucamaraschi","followers_url":"https://api.github.com/users/lucamaraschi/followers","following_url":"https://api.github.com/users/lucamaraschi/following{/other_user}","gists_url":"https://api.github.com/users/lucamaraschi/gists{/gist_id}","starred_url":"https://api.github.com/users/lucamaraschi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucamaraschi/subscriptions","organizations_url":"https://api.github.com/users/lucamaraschi/orgs","repos_url":"https://api.github.com/users/lucamaraschi/repos","events_url":"https://api.github.com/users/lucamaraschi/events{/privacy}","received_events_url":"https://api.github.com/users/lucamaraschi/received_events","type":"User","site_admin":false},"repo":{"id":75440637,"name":"my.node","full_name":"lucamaraschi/my.node","owner":{"login":"lucamaraschi","id":332968,"avatar_url":"https://avatars.githubusercontent.com/u/332968?v=3","gravatar_id":"","url":"https://api.github.com/users/lucamaraschi","html_url":"https://github.com/lucamaraschi","followers_url":"https://api.github.com/users/lucamaraschi/followers","following_url":"https://api.github.com/users/lucamaraschi/following{/other_user}","gists_url":"https://api.github.com/users/lucamaraschi/gists{/gist_id}","starred_url":"https://api.github.com/users/lucamaraschi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucamaraschi/subscriptions","organizations_url":"https://api.github.com/users/lucamaraschi/orgs","repos_url":"https://api.github.com/users/lucamaraschi/repos","events_url":"https://api.github.com/users/lucamaraschi/events{/privacy}","received_events_url":"https://api.github.com/users/lucamaraschi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lucamaraschi/my.node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":true,"url":"https://api.github.com/repos/lucamaraschi/my.node","forks_url":"https://api.github.com/repos/lucamaraschi/my.node/forks","keys_url":"https://api.github.com/repos/lucamaraschi/my.node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lucamaraschi/my.node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lucamaraschi/my.node/teams","hooks_url":"https://api.github.com/repos/lucamaraschi/my.node/hooks","issue_events_url":"https://api.github.com/repos/lucamaraschi/my.node/issues/events{/number}","events_url":"https://api.github.com/repos/lucamaraschi/my.node/events","assignees_url":"https://api.github.com/repos/lucamaraschi/my.node/assignees{/user}","branches_url":"https://api.github.com/repos/lucamaraschi/my.node/branches{/branch}","tags_url":"https://api.github.com/repos/lucamaraschi/my.node/tags","blobs_url":"https://api.github.com/repos/lucamaraschi/my.node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lucamaraschi/my.node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lucamaraschi/my.node/git/refs{/sha}","trees_url":"https://api.github.com/repos/lucamaraschi/my.node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lucamaraschi/my.node/statuses/{sha}","languages_url":"https://api.github.com/repos/lucamaraschi/my.node/languages","stargazers_url":"https://api.github.com/repos/lucamaraschi/my.node/stargazers","contributors_url":"https://api.github.com/repos/lucamaraschi/my.node/contributors","subscribers_url":"https://api.github.com/repos/lucamaraschi/my.node/subscribers","subscription_url":"https://api.github.com/repos/lucamaraschi/my.node/subscription","commits_url":"https://api.github.com/repos/lucamaraschi/my.node/commits{/sha}","git_commits_url":"https://api.github.com/repos/lucamaraschi/my.node/git/commits{/sha}","comments_url":"https://api.github.com/repos/lucamaraschi/my.node/comments{/number}","issue_comment_url":"https://api.github.com/repos/lucamaraschi/my.node/issues/comments{/number}","contents_url":"https://api.github.com/repos/lucamaraschi/my.node/contents/{+path}","compare_url":"https://api.github.com/repos/lucamaraschi/my.node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lucamaraschi/my.node/merges","archive_url":"https://api.github.com/repos/lucamaraschi/my.node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lucamaraschi/my.node/downloads","issues_url":"https://api.github.com/repos/lucamaraschi/my.node/issues{/number}","pulls_url":"https://api.github.com/repos/lucamaraschi/my.node/pulls{/number}","milestones_url":"https://api.github.com/repos/lucamaraschi/my.node/milestones{/number}","notifications_url":"https://api.github.com/repos/lucamaraschi/my.node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lucamaraschi/my.node/labels{/name}","releases_url":"https://api.github.com/repos/lucamaraschi/my.node/releases{/id}","deployments_url":"https://api.github.com/repos/lucamaraschi/my.node/deployments","created_at":"2016-12-03T00:04:34Z","updated_at":"2016-12-03T00:05:07Z","pushed_at":"2016-12-04T08:33:21Z","git_url":"git://github.com/lucamaraschi/my.node.git","ssh_url":"git@github.com:lucamaraschi/my.node.git","clone_url":"https://github.com/lucamaraschi/my.node.git","svn_url":"https://github.com/lucamaraschi/my.node","homepage":"https://nodejs.org","size":247241,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"nodejs:master","ref":"master","sha":"5486867e00c061ba326a847743d4ca2bb914359f","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"name":"node","full_name":"nodejs/node","owner":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":false,"url":"https://api.github.com/repos/nodejs/node","forks_url":"https://api.github.com/repos/nodejs/node/forks","keys_url":"https://api.github.com/repos/nodejs/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/node/teams","hooks_url":"https://api.github.com/repos/nodejs/node/hooks","issue_events_url":"https://api.github.com/repos/nodejs/node/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/node/events","assignees_url":"https://api.github.com/repos/nodejs/node/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/node/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/node/tags","blobs_url":"https://api.github.com/repos/nodejs/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/node/languages","stargazers_url":"https://api.github.com/repos/nodejs/node/stargazers","contributors_url":"https://api.github.com/repos/nodejs/node/contributors","subscribers_url":"https://api.github.com/repos/nodejs/node/subscribers","subscription_url":"https://api.github.com/repos/nodejs/node/subscription","commits_url":"https://api.github.com/repos/nodejs/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/node/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/node/merges","archive_url":"https://api.github.com/repos/nodejs/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/node/downloads","issues_url":"https://api.github.com/repos/nodejs/node/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/node/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/node/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/node/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/node/releases{/id}","deployments_url":"https://api.github.com/repos/nodejs/node/deployments","created_at":"2014-11-26T19:57:11Z","updated_at":"2016-12-04T13:31:00Z","pushed_at":"2016-12-04T12:31:45Z","git_url":"git://github.com/nodejs/node.git","ssh_url":"git@github.com:nodejs/node.git","clone_url":"https://github.com/nodejs/node.git","svn_url":"https://github.com/nodejs/node","homepage":"https://nodejs.org","size":373309,"stargazers_count":29548,"watchers_count":29548,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5262,"mirror_url":null,"open_issues_count":1152,"forks":5262,"open_issues":1152,"watchers":29548,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/10111"},"html":{"href":"https://github.com/nodejs/node/pull/10111"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/10111"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/10111/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/10111/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/10111/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/242c5c929cc4c348b89c21ceb66a6adc5117b007"}}}}
{"actor":{"display_login":"cjihrig"}}