GitHub PullRequestEvent at 2014-06-11 15:24:58
Repository: node-restify
Actor: gergelyke
Payload: {"action":"closed","number":624,"pull_request":{"url":"https://api.github.com/repos/mcavage/node-restify/pulls/624","id":17003434,"html_url":"https://github.com/mcavage/node-restify/pull/624","diff_url":"https://github.com/mcavage/node-restify/pull/624.diff","patch_url":"https://github.com/mcavage/node-restify/pull/624.patch","issue_url":"https://api.github.com/repos/mcavage/node-restify/issues/624","number":624,"state":"closed","title":"Expose the Request and Response","user":{"login":"TheThing","id":432585,"avatar_url":"https://avatars.githubusercontent.com/u/432585?","gravatar_id":"7de9810736b7f5f1cea0883c04965e8b","url":"https://api.github.com/users/TheThing","html_url":"https://github.com/TheThing","followers_url":"https://api.github.com/users/TheThing/followers","following_url":"https://api.github.com/users/TheThing/following{/other_user}","gists_url":"https://api.github.com/users/TheThing/gists{/gist_id}","starred_url":"https://api.github.com/users/TheThing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheThing/subscriptions","organizations_url":"https://api.github.com/users/TheThing/orgs","repos_url":"https://api.github.com/users/TheThing/repos","events_url":"https://api.github.com/users/TheThing/events{/privacy}","received_events_url":"https://api.github.com/users/TheThing/received_events","type":"User","site_admin":false},"body":"With these changes, one can check if the request object or response object are instanceof.\r\n\r\nAssuming I have a (stupid) helper function like so:\r\n\r\n```javascript\r\nvar restify = require('restify');\r\n\r\nexports.isLocalhost = function(ip, cb, req) {\r\n  if (ip === '127.0.0.1') {\r\n    if (req instanceof restify.Request) {\r\n      req.log.warn('Request was made localhost');\r\n    }\r\n    return true;\r\n  }\r\n  return false;\r\n}\r\n```\r\n\r\nOne could unit test the isLocalhost helper without worrying about faking the request object.","created_at":"2014-06-11T15:07:00Z","updated_at":"2014-06-11T15:24:58Z","closed_at":"2014-06-11T15:24:58Z","merged_at":null,"merge_commit_sha":"629dc7edfc0b144a028af8747e64e9e2889c3f0c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mcavage/node-restify/pulls/624/commits","review_comments_url":"https://api.github.com/repos/mcavage/node-restify/pulls/624/comments","review_comment_url":"https://api.github.com/repos/mcavage/node-restify/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mcavage/node-restify/issues/624/comments","statuses_url":"https://api.github.com/repos/mcavage/node-restify/statuses/07883ba2d3ea79b85f33f8561f1d096cc2bba316","head":{"label":"TheThing:expose-objects","ref":"expose-objects","sha":"07883ba2d3ea79b85f33f8561f1d096cc2bba316","user":{"login":"TheThing","id":432585,"avatar_url":"https://avatars.githubusercontent.com/u/432585?","gravatar_id":"7de9810736b7f5f1cea0883c04965e8b","url":"https://api.github.com/users/TheThing","html_url":"https://github.com/TheThing","followers_url":"https://api.github.com/users/TheThing/followers","following_url":"https://api.github.com/users/TheThing/following{/other_user}","gists_url":"https://api.github.com/users/TheThing/gists{/gist_id}","starred_url":"https://api.github.com/users/TheThing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheThing/subscriptions","organizations_url":"https://api.github.com/users/TheThing/orgs","repos_url":"https://api.github.com/users/TheThing/repos","events_url":"https://api.github.com/users/TheThing/events{/privacy}","received_events_url":"https://api.github.com/users/TheThing/received_events","type":"User","site_admin":false},"repo":{"id":20729161,"name":"node-restify","full_name":"TheThing/node-restify","owner":{"login":"TheThing","id":432585,"avatar_url":"https://avatars.githubusercontent.com/u/432585?","gravatar_id":"7de9810736b7f5f1cea0883c04965e8b","url":"https://api.github.com/users/TheThing","html_url":"https://github.com/TheThing","followers_url":"https://api.github.com/users/TheThing/followers","following_url":"https://api.github.com/users/TheThing/following{/other_user}","gists_url":"https://api.github.com/users/TheThing/gists{/gist_id}","starred_url":"https://api.github.com/users/TheThing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheThing/subscriptions","organizations_url":"https://api.github.com/users/TheThing/orgs","repos_url":"https://api.github.com/users/TheThing/repos","events_url":"https://api.github.com/users/TheThing/events{/privacy}","received_events_url":"https://api.github.com/users/TheThing/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TheThing/node-restify","description":"node.js REST framework specifically meant for web service APIs","fork":true,"url":"https://api.github.com/repos/TheThing/node-restify","forks_url":"https://api.github.com/repos/TheThing/node-restify/forks","keys_url":"https://api.github.com/repos/TheThing/node-restify/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TheThing/node-restify/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TheThing/node-restify/teams","hooks_url":"https://api.github.com/repos/TheThing/node-restify/hooks","issue_events_url":"https://api.github.com/repos/TheThing/node-restify/issues/events{/number}","events_url":"https://api.github.com/repos/TheThing/node-restify/events","assignees_url":"https://api.github.com/repos/TheThing/node-restify/assignees{/user}","branches_url":"https://api.github.com/repos/TheThing/node-restify/branches{/branch}","tags_url":"https://api.github.com/repos/TheThing/node-restify/tags","blobs_url":"https://api.github.com/repos/TheThing/node-restify/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TheThing/node-restify/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TheThing/node-restify/git/refs{/sha}","trees_url":"https://api.github.com/repos/TheThing/node-restify/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TheThing/node-restify/statuses/{sha}","languages_url":"https://api.github.com/repos/TheThing/node-restify/languages","stargazers_url":"https://api.github.com/repos/TheThing/node-restify/stargazers","contributors_url":"https://api.github.com/repos/TheThing/node-restify/contributors","subscribers_url":"https://api.github.com/repos/TheThing/node-restify/subscribers","subscription_url":"https://api.github.com/repos/TheThing/node-restify/subscription","commits_url":"https://api.github.com/repos/TheThing/node-restify/commits{/sha}","git_commits_url":"https://api.github.com/repos/TheThing/node-restify/git/commits{/sha}","comments_url":"https://api.github.com/repos/TheThing/node-restify/comments{/number}","issue_comment_url":"https://api.github.com/repos/TheThing/node-restify/issues/comments/{number}","contents_url":"https://api.github.com/repos/TheThing/node-restify/contents/{+path}","compare_url":"https://api.github.com/repos/TheThing/node-restify/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TheThing/node-restify/merges","archive_url":"https://api.github.com/repos/TheThing/node-restify/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TheThing/node-restify/downloads","issues_url":"https://api.github.com/repos/TheThing/node-restify/issues{/number}","pulls_url":"https://api.github.com/repos/TheThing/node-restify/pulls{/number}","milestones_url":"https://api.github.com/repos/TheThing/node-restify/milestones{/number}","notifications_url":"https://api.github.com/repos/TheThing/node-restify/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TheThing/node-restify/labels{/name}","releases_url":"https://api.github.com/repos/TheThing/node-restify/releases{/id}","created_at":"2014-06-11T14:52:32Z","updated_at":"2014-06-11T15:07:00Z","pushed_at":"2014-06-11T14:59:05Z","git_url":"git://github.com/TheThing/node-restify.git","ssh_url":"git@github.com:TheThing/node-restify.git","clone_url":"https://github.com/TheThing/node-restify.git","svn_url":"https://github.com/TheThing/node-restify","homepage":"http://mcavage.github.com/node-restify","size":5123,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mcavage:master","ref":"master","sha":"b5377db708535b2b3acbe46da99c8d9e04854a0b","user":{"login":"mcavage","id":365262,"avatar_url":"https://avatars.githubusercontent.com/u/365262?","gravatar_id":"d4303c5963bae19094178768c8aead0c","url":"https://api.github.com/users/mcavage","html_url":"https://github.com/mcavage","followers_url":"https://api.github.com/users/mcavage/followers","following_url":"https://api.github.com/users/mcavage/following{/other_user}","gists_url":"https://api.github.com/users/mcavage/gists{/gist_id}","starred_url":"https://api.github.com/users/mcavage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcavage/subscriptions","organizations_url":"https://api.github.com/users/mcavage/orgs","repos_url":"https://api.github.com/users/mcavage/repos","events_url":"https://api.github.com/users/mcavage/events{/privacy}","received_events_url":"https://api.github.com/users/mcavage/received_events","type":"User","site_admin":false},"repo":{"id":1661758,"name":"node-restify","full_name":"mcavage/node-restify","owner":{"login":"mcavage","id":365262,"avatar_url":"https://avatars.githubusercontent.com/u/365262?","gravatar_id":"d4303c5963bae19094178768c8aead0c","url":"https://api.github.com/users/mcavage","html_url":"https://github.com/mcavage","followers_url":"https://api.github.com/users/mcavage/followers","following_url":"https://api.github.com/users/mcavage/following{/other_user}","gists_url":"https://api.github.com/users/mcavage/gists{/gist_id}","starred_url":"https://api.github.com/users/mcavage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcavage/subscriptions","organizations_url":"https://api.github.com/users/mcavage/orgs","repos_url":"https://api.github.com/users/mcavage/repos","events_url":"https://api.github.com/users/mcavage/events{/privacy}","received_events_url":"https://api.github.com/users/mcavage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mcavage/node-restify","description":"node.js REST framework specifically meant for web service APIs","fork":false,"url":"https://api.github.com/repos/mcavage/node-restify","forks_url":"https://api.github.com/repos/mcavage/node-restify/forks","keys_url":"https://api.github.com/repos/mcavage/node-restify/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mcavage/node-restify/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mcavage/node-restify/teams","hooks_url":"https://api.github.com/repos/mcavage/node-restify/hooks","issue_events_url":"https://api.github.com/repos/mcavage/node-restify/issues/events{/number}","events_url":"https://api.github.com/repos/mcavage/node-restify/events","assignees_url":"https://api.github.com/repos/mcavage/node-restify/assignees{/user}","branches_url":"https://api.github.com/repos/mcavage/node-restify/branches{/branch}","tags_url":"https://api.github.com/repos/mcavage/node-restify/tags","blobs_url":"https://api.github.com/repos/mcavage/node-restify/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mcavage/node-restify/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mcavage/node-restify/git/refs{/sha}","trees_url":"https://api.github.com/repos/mcavage/node-restify/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mcavage/node-restify/statuses/{sha}","languages_url":"https://api.github.com/repos/mcavage/node-restify/languages","stargazers_url":"https://api.github.com/repos/mcavage/node-restify/stargazers","contributors_url":"https://api.github.com/repos/mcavage/node-restify/contributors","subscribers_url":"https://api.github.com/repos/mcavage/node-restify/subscribers","subscription_url":"https://api.github.com/repos/mcavage/node-restify/subscription","commits_url":"https://api.github.com/repos/mcavage/node-restify/commits{/sha}","git_commits_url":"https://api.github.com/repos/mcavage/node-restify/git/commits{/sha}","comments_url":"https://api.github.com/repos/mcavage/node-restify/comments{/number}","issue_comment_url":"https://api.github.com/repos/mcavage/node-restify/issues/comments/{number}","contents_url":"https://api.github.com/repos/mcavage/node-restify/contents/{+path}","compare_url":"https://api.github.com/repos/mcavage/node-restify/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mcavage/node-restify/merges","archive_url":"https://api.github.com/repos/mcavage/node-restify/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mcavage/node-restify/downloads","issues_url":"https://api.github.com/repos/mcavage/node-restify/issues{/number}","pulls_url":"https://api.github.com/repos/mcavage/node-restify/pulls{/number}","milestones_url":"https://api.github.com/repos/mcavage/node-restify/milestones{/number}","notifications_url":"https://api.github.com/repos/mcavage/node-restify/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mcavage/node-restify/labels{/name}","releases_url":"https://api.github.com/repos/mcavage/node-restify/releases{/id}","created_at":"2011-04-25T21:19:26Z","updated_at":"2014-06-11T05:28:47Z","pushed_at":"2014-06-11T05:28:45Z","git_url":"git://github.com/mcavage/node-restify.git","ssh_url":"git@github.com:mcavage/node-restify.git","clone_url":"https://github.com/mcavage/node-restify.git","svn_url":"https://github.com/mcavage/node-restify","homepage":"http://mcavage.github.com/node-restify","size":5123,"stargazers_count":2266,"watchers_count":2266,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":303,"mirror_url":null,"open_issues_count":47,"forks":303,"open_issues":47,"watchers":2266,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mcavage/node-restify/pulls/624"},"html":{"href":"https://github.com/mcavage/node-restify/pull/624"},"issue":{"href":"https://api.github.com/repos/mcavage/node-restify/issues/624"},"comments":{"href":"https://api.github.com/repos/mcavage/node-restify/issues/624/comments"},"review_comments":{"href":"https://api.github.com/repos/mcavage/node-restify/pulls/624/comments"},"review_comment":{"href":"https://api.github.com/repos/mcavage/node-restify/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mcavage/node-restify/pulls/624/commits"},"statuses":{"href":"https://api.github.com/repos/mcavage/node-restify/statuses/07883ba2d3ea79b85f33f8561f1d096cc2bba316"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":1,"review_comments":0,"commits":1,"additions":12,"deletions":0,"changed_files":3}}