GitHub PullRequestEvent at 2014-03-18 20:15:04
Repository: restangular
Actor: idpaterson
Payload: {"action":"opened","number":638,"pull_request":{"url":"https://api.github.com/repos/mgonto/restangular/pulls/638","id":13705145,"html_url":"https://github.com/mgonto/restangular/pull/638","diff_url":"https://github.com/mgonto/restangular/pull/638.diff","patch_url":"https://github.com/mgonto/restangular/pull/638.patch","issue_url":"https://api.github.com/repos/mgonto/restangular/issues/638","number":638,"state":"open","title":"Pull requests/fix request extension by interceptors","user":{"login":"idpaterson","id":507058,"avatar_url":"https://avatars.githubusercontent.com/u/507058?","gravatar_id":"69a66695447d7597fb67da49635d8ea2","url":"https://api.github.com/users/idpaterson","html_url":"https://github.com/idpaterson","followers_url":"https://api.github.com/users/idpaterson/followers","following_url":"https://api.github.com/users/idpaterson/following{/other_user}","gists_url":"https://api.github.com/users/idpaterson/gists{/gist_id}","starred_url":"https://api.github.com/users/idpaterson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idpaterson/subscriptions","organizations_url":"https://api.github.com/users/idpaterson/orgs","repos_url":"https://api.github.com/users/idpaterson/repos","events_url":"https://api.github.com/users/idpaterson/events{/privacy}","received_events_url":"https://api.github.com/users/idpaterson/received_events","type":"User","site_admin":false},"body":"As @nerezo alluded to in #608, `_.defaults` was causing inconsistent behavior when using request interceptors. Previously, the first value returned for either `element`, `headers`, `params`, or `httpConfig` by any interceptor was the value that was used in the request. This made it impossible to chain interceptors because each was receiving a copy of the original data and was only sometimes given the chance to modify that data.\r\n\r\nThe existing tests passed because a single reference to the resource was being modified. The addition of `angular.copy(element)` quickly shows that the return value is not actually being used as expected. \r\n\r\nThe code was changed to use `_.extend` rather than `_.defaults` since it eliminates the first-in-wins behavior. Additionally, the data passed to the interceptors is taken from the `request` accumulator rather than from the initial input. `config.defaultInterceptor` is now used to provide the defaults for `request` based on the initial data. This behavior is what I would expect, but it differs from what happened in the past (`config.defaultInterceptor` was executed last to add any missing keys to the `request`). People overriding `defaultInterceptor` could have issues with this change, but that is neither something that was documented nor something that seems sensible to do. ","created_at":"2014-03-18T20:15:02Z","updated_at":"2014-03-18T20:15:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mgonto/restangular/pulls/638/commits","review_comments_url":"https://api.github.com/repos/mgonto/restangular/pulls/638/comments","review_comment_url":"https://api.github.com/repos/mgonto/restangular/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mgonto/restangular/issues/638/comments","statuses_url":"https://api.github.com/repos/mgonto/restangular/statuses/8e786ecfdc21c7f275f26ffa6d8ba42554a84613","head":{"label":"idpaterson:pull-requests/fix-request-extension-by-interceptors","ref":"pull-requests/fix-request-extension-by-interceptors","sha":"8e786ecfdc21c7f275f26ffa6d8ba42554a84613","user":{"login":"idpaterson","id":507058,"avatar_url":"https://avatars.githubusercontent.com/u/507058?","gravatar_id":"69a66695447d7597fb67da49635d8ea2","url":"https://api.github.com/users/idpaterson","html_url":"https://github.com/idpaterson","followers_url":"https://api.github.com/users/idpaterson/followers","following_url":"https://api.github.com/users/idpaterson/following{/other_user}","gists_url":"https://api.github.com/users/idpaterson/gists{/gist_id}","starred_url":"https://api.github.com/users/idpaterson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idpaterson/subscriptions","organizations_url":"https://api.github.com/users/idpaterson/orgs","repos_url":"https://api.github.com/users/idpaterson/repos","events_url":"https://api.github.com/users/idpaterson/events{/privacy}","received_events_url":"https://api.github.com/users/idpaterson/received_events","type":"User","site_admin":false},"repo":{"id":17726585,"name":"restangular","full_name":"idpaterson/restangular","owner":{"login":"idpaterson","id":507058,"avatar_url":"https://avatars.githubusercontent.com/u/507058?","gravatar_id":"69a66695447d7597fb67da49635d8ea2","url":"https://api.github.com/users/idpaterson","html_url":"https://github.com/idpaterson","followers_url":"https://api.github.com/users/idpaterson/followers","following_url":"https://api.github.com/users/idpaterson/following{/other_user}","gists_url":"https://api.github.com/users/idpaterson/gists{/gist_id}","starred_url":"https://api.github.com/users/idpaterson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idpaterson/subscriptions","organizations_url":"https://api.github.com/users/idpaterson/orgs","repos_url":"https://api.github.com/users/idpaterson/repos","events_url":"https://api.github.com/users/idpaterson/events{/privacy}","received_events_url":"https://api.github.com/users/idpaterson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/idpaterson/restangular","description":"AngularJS service to handle Rest API Restful Resources properly and easily","fork":true,"url":"https://api.github.com/repos/idpaterson/restangular","forks_url":"https://api.github.com/repos/idpaterson/restangular/forks","keys_url":"https://api.github.com/repos/idpaterson/restangular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/idpaterson/restangular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/idpaterson/restangular/teams","hooks_url":"https://api.github.com/repos/idpaterson/restangular/hooks","issue_events_url":"https://api.github.com/repos/idpaterson/restangular/issues/events{/number}","events_url":"https://api.github.com/repos/idpaterson/restangular/events","assignees_url":"https://api.github.com/repos/idpaterson/restangular/assignees{/user}","branches_url":"https://api.github.com/repos/idpaterson/restangular/branches{/branch}","tags_url":"https://api.github.com/repos/idpaterson/restangular/tags","blobs_url":"https://api.github.com/repos/idpaterson/restangular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/idpaterson/restangular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/idpaterson/restangular/git/refs{/sha}","trees_url":"https://api.github.com/repos/idpaterson/restangular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/idpaterson/restangular/statuses/{sha}","languages_url":"https://api.github.com/repos/idpaterson/restangular/languages","stargazers_url":"https://api.github.com/repos/idpaterson/restangular/stargazers","contributors_url":"https://api.github.com/repos/idpaterson/restangular/contributors","subscribers_url":"https://api.github.com/repos/idpaterson/restangular/subscribers","subscription_url":"https://api.github.com/repos/idpaterson/restangular/subscription","commits_url":"https://api.github.com/repos/idpaterson/restangular/commits{/sha}","git_commits_url":"https://api.github.com/repos/idpaterson/restangular/git/commits{/sha}","comments_url":"https://api.github.com/repos/idpaterson/restangular/comments{/number}","issue_comment_url":"https://api.github.com/repos/idpaterson/restangular/issues/comments/{number}","contents_url":"https://api.github.com/repos/idpaterson/restangular/contents/{+path}","compare_url":"https://api.github.com/repos/idpaterson/restangular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/idpaterson/restangular/merges","archive_url":"https://api.github.com/repos/idpaterson/restangular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/idpaterson/restangular/downloads","issues_url":"https://api.github.com/repos/idpaterson/restangular/issues{/number}","pulls_url":"https://api.github.com/repos/idpaterson/restangular/pulls{/number}","milestones_url":"https://api.github.com/repos/idpaterson/restangular/milestones{/number}","notifications_url":"https://api.github.com/repos/idpaterson/restangular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/idpaterson/restangular/labels{/name}","releases_url":"https://api.github.com/repos/idpaterson/restangular/releases{/id}","created_at":"2014-03-13T21:24:54Z","updated_at":"2014-03-18T20:15:03Z","pushed_at":"2014-03-18T20:04:53Z","git_url":"git://github.com/idpaterson/restangular.git","ssh_url":"git@github.com:idpaterson/restangular.git","clone_url":"https://github.com/idpaterson/restangular.git","svn_url":"https://github.com/idpaterson/restangular","homepage":"","size":3658,"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","master_branch":"master"}},"base":{"label":"mgonto:master","ref":"master","sha":"8e65e1c8e6307e23cae1540415003023bc07bece","user":{"login":"mgonto","id":723723,"avatar_url":"https://avatars.githubusercontent.com/u/723723?","gravatar_id":"476f8170f26e7d20b6fee1714f0a9969","url":"https://api.github.com/users/mgonto","html_url":"https://github.com/mgonto","followers_url":"https://api.github.com/users/mgonto/followers","following_url":"https://api.github.com/users/mgonto/following{/other_user}","gists_url":"https://api.github.com/users/mgonto/gists{/gist_id}","starred_url":"https://api.github.com/users/mgonto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgonto/subscriptions","organizations_url":"https://api.github.com/users/mgonto/orgs","repos_url":"https://api.github.com/users/mgonto/repos","events_url":"https://api.github.com/users/mgonto/events{/privacy}","received_events_url":"https://api.github.com/users/mgonto/received_events","type":"User","site_admin":false},"repo":{"id":9210604,"name":"restangular","full_name":"mgonto/restangular","owner":{"login":"mgonto","id":723723,"avatar_url":"https://avatars.githubusercontent.com/u/723723?","gravatar_id":"476f8170f26e7d20b6fee1714f0a9969","url":"https://api.github.com/users/mgonto","html_url":"https://github.com/mgonto","followers_url":"https://api.github.com/users/mgonto/followers","following_url":"https://api.github.com/users/mgonto/following{/other_user}","gists_url":"https://api.github.com/users/mgonto/gists{/gist_id}","starred_url":"https://api.github.com/users/mgonto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgonto/subscriptions","organizations_url":"https://api.github.com/users/mgonto/orgs","repos_url":"https://api.github.com/users/mgonto/repos","events_url":"https://api.github.com/users/mgonto/events{/privacy}","received_events_url":"https://api.github.com/users/mgonto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mgonto/restangular","description":"AngularJS service to handle Rest API Restful Resources properly and easily","fork":false,"url":"https://api.github.com/repos/mgonto/restangular","forks_url":"https://api.github.com/repos/mgonto/restangular/forks","keys_url":"https://api.github.com/repos/mgonto/restangular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mgonto/restangular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mgonto/restangular/teams","hooks_url":"https://api.github.com/repos/mgonto/restangular/hooks","issue_events_url":"https://api.github.com/repos/mgonto/restangular/issues/events{/number}","events_url":"https://api.github.com/repos/mgonto/restangular/events","assignees_url":"https://api.github.com/repos/mgonto/restangular/assignees{/user}","branches_url":"https://api.github.com/repos/mgonto/restangular/branches{/branch}","tags_url":"https://api.github.com/repos/mgonto/restangular/tags","blobs_url":"https://api.github.com/repos/mgonto/restangular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mgonto/restangular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mgonto/restangular/git/refs{/sha}","trees_url":"https://api.github.com/repos/mgonto/restangular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mgonto/restangular/statuses/{sha}","languages_url":"https://api.github.com/repos/mgonto/restangular/languages","stargazers_url":"https://api.github.com/repos/mgonto/restangular/stargazers","contributors_url":"https://api.github.com/repos/mgonto/restangular/contributors","subscribers_url":"https://api.github.com/repos/mgonto/restangular/subscribers","subscription_url":"https://api.github.com/repos/mgonto/restangular/subscription","commits_url":"https://api.github.com/repos/mgonto/restangular/commits{/sha}","git_commits_url":"https://api.github.com/repos/mgonto/restangular/git/commits{/sha}","comments_url":"https://api.github.com/repos/mgonto/restangular/comments{/number}","issue_comment_url":"https://api.github.com/repos/mgonto/restangular/issues/comments/{number}","contents_url":"https://api.github.com/repos/mgonto/restangular/contents/{+path}","compare_url":"https://api.github.com/repos/mgonto/restangular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mgonto/restangular/merges","archive_url":"https://api.github.com/repos/mgonto/restangular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mgonto/restangular/downloads","issues_url":"https://api.github.com/repos/mgonto/restangular/issues{/number}","pulls_url":"https://api.github.com/repos/mgonto/restangular/pulls{/number}","milestones_url":"https://api.github.com/repos/mgonto/restangular/milestones{/number}","notifications_url":"https://api.github.com/repos/mgonto/restangular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mgonto/restangular/labels{/name}","releases_url":"https://api.github.com/repos/mgonto/restangular/releases{/id}","created_at":"2013-04-04T03:53:57Z","updated_at":"2014-03-03T21:13:45Z","pushed_at":"2014-03-03T21:13:45Z","git_url":"git://github.com/mgonto/restangular.git","ssh_url":"git@github.com:mgonto/restangular.git","clone_url":"https://github.com/mgonto/restangular.git","svn_url":"https://github.com/mgonto/restangular","homepage":"","size":3658,"stargazers_count":2866,"watchers_count":2866,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":278,"mirror_url":null,"open_issues_count":55,"forks":278,"open_issues":55,"watchers":2866,"default_branch":"master","master_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mgonto/restangular/pulls/638"},"html":{"href":"https://github.com/mgonto/restangular/pull/638"},"issue":{"href":"https://api.github.com/repos/mgonto/restangular/issues/638"},"comments":{"href":"https://api.github.com/repos/mgonto/restangular/issues/638/comments"},"review_comments":{"href":"https://api.github.com/repos/mgonto/restangular/pulls/638/comments"},"review_comment":{"href":"https://api.github.com/repos/mgonto/restangular/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mgonto/restangular/pulls/638/commits"},"statuses":{"href":"https://api.github.com/repos/mgonto/restangular/statuses/8e786ecfdc21c7f275f26ffa6d8ba42554a84613"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":2,"additions":23,"deletions":16,"changed_files":2}}