{"action":"created","comment":{"url":"https://api.github.com/repos/sindresorhus/got/pulls/comments/203151034","pull_request_review_id":137984736,"id":203151034,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzE1MTAzNA==","diff_hunk":"@@ -51,18 +53,19 @@ const create = defaults => {\n \t\treturn defaults.handler(url, options, next);\n \t};\n \n+\tdefaults.options.hooks = {\n+\t\tbeforeRequest: [],\n+\t\t...(defaults.options.hooks || {})\n+\t};\n+\tgot.hooks = defaults.options.hooks;\n+\n \tfor (const method of defaults.methods) {\n \t\tgot[method] = (url, options) => got(url, {...options, method});\n \t\tgot.stream[method] = (url, options) => got.stream(url, {...options, method});\n \t}\n \n-\tObject.assign(got, errors);\n-\tObject.defineProperty(got, 'defaults', {\n-\t\tvalue: deepFreeze(defaults),\n-\t\twritable: false,\n-\t\tenumerable: true,\n-\t\tconfigurable: true\n-\t});\n+\tdefineConstProperty(got, {...errors, create}, {deepFreeze: true});","path":"source/create.js","position":53,"original_position":53,"commit_id":"f721b374f61ee34294c08d3887f0d9a37e2fbaf9","original_commit_id":"f721b374f61ee34294c08d3887f0d9a37e2fbaf9","user":{"login":"jstewmon","id":909418,"node_id":"MDQ6VXNlcjkwOTQxOA==","avatar_url":"https://avatars1.githubusercontent.com/u/909418?v=4","gravatar_id":"","url":"https://api.github.com/users/jstewmon","html_url":"https://github.com/jstewmon","followers_url":"https://api.github.com/users/jstewmon/followers","following_url":"https://api.github.com/users/jstewmon/following{/other_user}","gists_url":"https://api.github.com/users/jstewmon/gists{/gist_id}","starred_url":"https://api.github.com/users/jstewmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jstewmon/subscriptions","organizations_url":"https://api.github.com/users/jstewmon/orgs","repos_url":"https://api.github.com/users/jstewmon/repos","events_url":"https://api.github.com/users/jstewmon/events{/privacy}","received_events_url":"https://api.github.com/users/jstewmon/received_events","type":"User","site_admin":false},"body":"I think this is overkill. If it's not overkill, I guess I'd say just call `defineConstProperty(got, got)` b/c it looks like `stream` and `extend` were arbitrarily omitted.","created_at":"2018-07-17T19:32:13Z","updated_at":"2018-07-17T19:32:13Z","html_url":"https://github.com/sindresorhus/got/pull/524#discussion_r203151034","pull_request_url":"https://api.github.com/repos/sindresorhus/got/pulls/524","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/got/pulls/comments/203151034"},"html":{"href":"https://github.com/sindresorhus/got/pull/524#discussion_r203151034"},"pull_request":{"href":"https://api.github.com/repos/sindresorhus/got/pulls/524"}}},"pull_request":{"url":"https://api.github.com/repos/sindresorhus/got/pulls/524","id":201742729,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxNzQyNzI5","html_url":"https://github.com/sindresorhus/got/pull/524","diff_url":"https://github.com/sindresorhus/got/pull/524.diff","patch_url":"https://github.com/sindresorhus/got/pull/524.patch","issue_url":"https://api.github.com/repos/sindresorhus/got/issues/524","number":524,"state":"open","locked":false,"title":"Better hooks and optional freezable defaults","user":{"login":"szmarczak","id":36894700,"node_id":"MDQ6VXNlcjM2ODk0NzAw","avatar_url":"https://avatars0.githubusercontent.com/u/36894700?v=4","gravatar_id":"","url":"https://api.github.com/users/szmarczak","html_url":"https://github.com/szmarczak","followers_url":"https://api.github.com/users/szmarczak/followers","following_url":"https://api.github.com/users/szmarczak/following{/other_user}","gists_url":"https://api.github.com/users/szmarczak/gists{/gist_id}","starred_url":"https://api.github.com/users/szmarczak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szmarczak/subscriptions","organizations_url":"https://api.github.com/users/szmarczak/orgs","repos_url":"https://api.github.com/users/szmarczak/repos","events_url":"https://api.github.com/users/szmarczak/events{/privacy}","received_events_url":"https://api.github.com/users/szmarczak/received_events","type":"User","site_admin":false},"body":"Migrated from #523 due to a GitHub crash.\r\n\r\n- [x] `got.hooks = got.defaults.options.hooks`\r\n- [x] By default hooks are always empty<br>(before: if you hadn't specified `hooks` in the defaults, `got.hooks` would be `undefined`)\r\n- [x] `defaults.preventChanges` (documented in `advanced-creation.md`)","created_at":"2018-07-16T19:54:38Z","updated_at":"2018-07-17T19:32:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"56c770dbf7aee54e6700cbd62f639a8133b509d7","assignee":null,"assignees":[],"requested_reviewers":[{"login":"brandon93s","id":4730164,"node_id":"MDQ6VXNlcjQ3MzAxNjQ=","avatar_url":"https://avatars0.githubusercontent.com/u/4730164?v=4","gravatar_id":"","url":"https://api.github.com/users/brandon93s","html_url":"https://github.com/brandon93s","followers_url":"https://api.github.com/users/brandon93s/followers","following_url":"https://api.github.com/users/brandon93s/following{/other_user}","gists_url":"https://api.github.com/users/brandon93s/gists{/gist_id}","starred_url":"https://api.github.com/users/brandon93s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brandon93s/subscriptions","organizations_url":"https://api.github.com/users/brandon93s/orgs","repos_url":"https://api.github.com/users/brandon93s/repos","events_url":"https://api.github.com/users/brandon93s/events{/privacy}","received_events_url":"https://api.github.com/users/brandon93s/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sindresorhus/got/pulls/524/commits","review_comments_url":"https://api.github.com/repos/sindresorhus/got/pulls/524/comments","review_comment_url":"https://api.github.com/repos/sindresorhus/got/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sindresorhus/got/issues/524/comments","statuses_url":"https://api.github.com/repos/sindresorhus/got/statuses/f721b374f61ee34294c08d3887f0d9a37e2fbaf9","head":{"label":"szmarczak:better-hooks-2","ref":"better-hooks-2","sha":"f721b374f61ee34294c08d3887f0d9a37e2fbaf9","user":{"login":"szmarczak","id":36894700,"node_id":"MDQ6VXNlcjM2ODk0NzAw","avatar_url":"https://avatars0.githubusercontent.com/u/36894700?v=4","gravatar_id":"","url":"https://api.github.com/users/szmarczak","html_url":"https://github.com/szmarczak","followers_url":"https://api.github.com/users/szmarczak/followers","following_url":"https://api.github.com/users/szmarczak/following{/other_user}","gists_url":"https://api.github.com/users/szmarczak/gists{/gist_id}","starred_url":"https://api.github.com/users/szmarczak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szmarczak/subscriptions","organizations_url":"https://api.github.com/users/szmarczak/orgs","repos_url":"https://api.github.com/users/szmarczak/repos","events_url":"https://api.github.com/users/szmarczak/events{/privacy}","received_events_url":"https://api.github.com/users/szmarczak/received_events","type":"User","site_admin":false},"repo":{"id":123169698,"node_id":"MDEwOlJlcG9zaXRvcnkxMjMxNjk2OTg=","name":"got","full_name":"szmarczak/got","owner":{"login":"szmarczak","id":36894700,"node_id":"MDQ6VXNlcjM2ODk0NzAw","avatar_url":"https://avatars0.githubusercontent.com/u/36894700?v=4","gravatar_id":"","url":"https://api.github.com/users/szmarczak","html_url":"https://github.com/szmarczak","followers_url":"https://api.github.com/users/szmarczak/followers","following_url":"https://api.github.com/users/szmarczak/following{/other_user}","gists_url":"https://api.github.com/users/szmarczak/gists{/gist_id}","starred_url":"https://api.github.com/users/szmarczak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szmarczak/subscriptions","organizations_url":"https://api.github.com/users/szmarczak/orgs","repos_url":"https://api.github.com/users/szmarczak/repos","events_url":"https://api.github.com/users/szmarczak/events{/privacy}","received_events_url":"https://api.github.com/users/szmarczak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/szmarczak/got","description":"Simplified HTTP requests","fork":true,"url":"https://api.github.com/repos/szmarczak/got","forks_url":"https://api.github.com/repos/szmarczak/got/forks","keys_url":"https://api.github.com/repos/szmarczak/got/keys{/key_id}","collaborators_url":"https://api.github.com/repos/szmarczak/got/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/szmarczak/got/teams","hooks_url":"https://api.github.com/repos/szmarczak/got/hooks","issue_events_url":"https://api.github.com/repos/szmarczak/got/issues/events{/number}","events_url":"https://api.github.com/repos/szmarczak/got/events","assignees_url":"https://api.github.com/repos/szmarczak/got/assignees{/user}","branches_url":"https://api.github.com/repos/szmarczak/got/branches{/branch}","tags_url":"https://api.github.com/repos/szmarczak/got/tags","blobs_url":"https://api.github.com/repos/szmarczak/got/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/szmarczak/got/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/szmarczak/got/git/refs{/sha}","trees_url":"https://api.github.com/repos/szmarczak/got/git/trees{/sha}","statuses_url":"https://api.github.com/repos/szmarczak/got/statuses/{sha}","languages_url":"https://api.github.com/repos/szmarczak/got/languages","stargazers_url":"https://api.github.com/repos/szmarczak/got/stargazers","contributors_url":"https://api.github.com/repos/szmarczak/got/contributors","subscribers_url":"https://api.github.com/repos/szmarczak/got/subscribers","subscription_url":"https://api.github.com/repos/szmarczak/got/subscription","commits_url":"https://api.github.com/repos/szmarczak/got/commits{/sha}","git_commits_url":"https://api.github.com/repos/szmarczak/got/git/commits{/sha}","comments_url":"https://api.github.com/repos/szmarczak/got/comments{/number}","issue_comment_url":"https://api.github.com/repos/szmarczak/got/issues/comments{/number}","contents_url":"https://api.github.com/repos/szmarczak/got/contents/{+path}","compare_url":"https://api.github.com/repos/szmarczak/got/compare/{base}...{head}","merges_url":"https://api.github.com/repos/szmarczak/got/merges","archive_url":"https://api.github.com/repos/szmarczak/got/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/szmarczak/got/downloads","issues_url":"https://api.github.com/repos/szmarczak/got/issues{/number}","pulls_url":"https://api.github.com/repos/szmarczak/got/pulls{/number}","milestones_url":"https://api.github.com/repos/szmarczak/got/milestones{/number}","notifications_url":"https://api.github.com/repos/szmarczak/got/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/szmarczak/got/labels{/name}","releases_url":"https://api.github.com/repos/szmarczak/got/releases{/id}","deployments_url":"https://api.github.com/repos/szmarczak/got/deployments","created_at":"2018-02-27T18:18:00Z","updated_at":"2018-07-07T03:52:11Z","pushed_at":"2018-07-17T19:14:39Z","git_url":"git://github.com/szmarczak/got.git","ssh_url":"git@github.com:szmarczak/got.git","clone_url":"https://github.com/szmarczak/got.git","svn_url":"https://github.com/szmarczak/got","homepage":"","size":1084,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"sindresorhus:master","ref":"master","sha":"83bc44c536f0c0ffb743e20e04bf569c51fa5d69","user":{"login":"sindresorhus","id":170270,"node_id":"MDQ6VXNlcjE3MDI3MA==","avatar_url":"https://avatars1.githubusercontent.com/u/170270?v=4","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"repo":{"id":18193978,"node_id":"MDEwOlJlcG9zaXRvcnkxODE5Mzk3OA==","name":"got","full_name":"sindresorhus/got","owner":{"login":"sindresorhus","id":170270,"node_id":"MDQ6VXNlcjE3MDI3MA==","avatar_url":"https://avatars1.githubusercontent.com/u/170270?v=4","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sindresorhus/got","description":"Simplified HTTP requests","fork":false,"url":"https://api.github.com/repos/sindresorhus/got","forks_url":"https://api.github.com/repos/sindresorhus/got/forks","keys_url":"https://api.github.com/repos/sindresorhus/got/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sindresorhus/got/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sindresorhus/got/teams","hooks_url":"https://api.github.com/repos/sindresorhus/got/hooks","issue_events_url":"https://api.github.com/repos/sindresorhus/got/issues/events{/number}","events_url":"https://api.github.com/repos/sindresorhus/got/events","assignees_url":"https://api.github.com/repos/sindresorhus/got/assignees{/user}","branches_url":"https://api.github.com/repos/sindresorhus/got/branches{/branch}","tags_url":"https://api.github.com/repos/sindresorhus/got/tags","blobs_url":"https://api.github.com/repos/sindresorhus/got/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sindresorhus/got/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sindresorhus/got/git/refs{/sha}","trees_url":"https://api.github.com/repos/sindresorhus/got/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sindresorhus/got/statuses/{sha}","languages_url":"https://api.github.com/repos/sindresorhus/got/languages","stargazers_url":"https://api.github.com/repos/sindresorhus/got/stargazers","contributors_url":"https://api.github.com/repos/sindresorhus/got/contributors","subscribers_url":"https://api.github.com/repos/sindresorhus/got/subscribers","subscription_url":"https://api.github.com/repos/sindresorhus/got/subscription","commits_url":"https://api.github.com/repos/sindresorhus/got/commits{/sha}","git_commits_url":"https://api.github.com/repos/sindresorhus/got/git/commits{/sha}","comments_url":"https://api.github.com/repos/sindresorhus/got/comments{/number}","issue_comment_url":"https://api.github.com/repos/sindresorhus/got/issues/comments{/number}","contents_url":"https://api.github.com/repos/sindresorhus/got/contents/{+path}","compare_url":"https://api.github.com/repos/sindresorhus/got/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sindresorhus/got/merges","archive_url":"https://api.github.com/repos/sindresorhus/got/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sindresorhus/got/downloads","issues_url":"https://api.github.com/repos/sindresorhus/got/issues{/number}","pulls_url":"https://api.github.com/repos/sindresorhus/got/pulls{/number}","milestones_url":"https://api.github.com/repos/sindresorhus/got/milestones{/number}","notifications_url":"https://api.github.com/repos/sindresorhus/got/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sindresorhus/got/labels{/name}","releases_url":"https://api.github.com/repos/sindresorhus/got/releases{/id}","deployments_url":"https://api.github.com/repos/sindresorhus/got/deployments","created_at":"2014-03-27T22:40:49Z","updated_at":"2018-07-17T17:05:37Z","pushed_at":"2018-07-17T19:16:49Z","git_url":"git://github.com/sindresorhus/got.git","ssh_url":"git@github.com:sindresorhus/got.git","clone_url":"https://github.com/sindresorhus/got.git","svn_url":"https://github.com/sindresorhus/got","homepage":"","size":990,"stargazers_count":2789,"watchers_count":2789,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":182,"mirror_url":null,"archived":false,"open_issues_count":14,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":182,"open_issues":14,"watchers":2789,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/got/pulls/524"},"html":{"href":"https://github.com/sindresorhus/got/pull/524"},"issue":{"href":"https://api.github.com/repos/sindresorhus/got/issues/524"},"comments":{"href":"https://api.github.com/repos/sindresorhus/got/issues/524/comments"},"review_comments":{"href":"https://api.github.com/repos/sindresorhus/got/pulls/524/comments"},"review_comment":{"href":"https://api.github.com/repos/sindresorhus/got/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sindresorhus/got/pulls/524/commits"},"statuses":{"href":"https://api.github.com/repos/sindresorhus/got/statuses/f721b374f61ee34294c08d3887f0d9a37e2fbaf9"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"jstewmon"}}