{"action":"opened","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/11438","labels_url":"https://api.github.com/repos/angular/angular.js/issues/11438/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/11438/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/11438/events","html_url":"https://github.com/angular/angular.js/issues/11438","id":64574008,"number":11438,"title":"Regression: cannot extend headers in transformData fn","user":{"login":"Narretz","id":1153097,"avatar_url":"https://avatars.githubusercontent.com/u/1153097?v=3","gravatar_id":"","url":"https://api.github.com/users/Narretz","html_url":"https://github.com/Narretz","followers_url":"https://api.github.com/users/Narretz/followers","following_url":"https://api.github.com/users/Narretz/following{/other_user}","gists_url":"https://api.github.com/users/Narretz/gists{/gist_id}","starred_url":"https://api.github.com/users/Narretz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Narretz/subscriptions","organizations_url":"https://api.github.com/users/Narretz/orgs","repos_url":"https://api.github.com/users/Narretz/repos","events_url":"https://api.github.com/users/Narretz/events{/privacy}","received_events_url":"https://api.github.com/users/Narretz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular.js/labels/component:%20$http","name":"component: $http","color":"d7e102"},{"url":"https://api.github.com/repos/angular/angular.js/labels/severity:%20regression","name":"severity: regression","color":"e11d21"},{"url":"https://api.github.com/repos/angular/angular.js/labels/type:%20bug","name":"type: bug","color":"000000"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/angular/angular.js/milestones/89","html_url":"https://github.com/angular/angular.js/milestones/1.4.0-rc.0%20/%201.3.17","labels_url":"https://api.github.com/repos/angular/angular.js/milestones/89/labels","id":1025249,"number":89,"title":"1.4.0-rc.0 / 1.3.17","description":"","creator":{"login":"petebacondarwin","id":15655,"avatar_url":"https://avatars.githubusercontent.com/u/15655?v=3","gravatar_id":"","url":"https://api.github.com/users/petebacondarwin","html_url":"https://github.com/petebacondarwin","followers_url":"https://api.github.com/users/petebacondarwin/followers","following_url":"https://api.github.com/users/petebacondarwin/following{/other_user}","gists_url":"https://api.github.com/users/petebacondarwin/gists{/gist_id}","starred_url":"https://api.github.com/users/petebacondarwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petebacondarwin/subscriptions","organizations_url":"https://api.github.com/users/petebacondarwin/orgs","repos_url":"https://api.github.com/users/petebacondarwin/repos","events_url":"https://api.github.com/users/petebacondarwin/events{/privacy}","received_events_url":"https://api.github.com/users/petebacondarwin/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":0,"state":"open","created_at":"2015-03-17T12:04:33Z","updated_at":"2015-03-26T16:31:26Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-03-26T16:31:26Z","updated_at":"2015-03-26T16:31:26Z","closed_at":null,"body":"Before https://github.com/angular/angular.js/commit/5da1256fc2812d5b28fb0af0de81256054856369, it used to be possible to do this:\r\n\r\n```\r\n        function requestTransform(data, headers) {\r\n            headers = angular.extend(headers(), {\r\n              'X-MY_HEADER': 'abcd'\r\n            });\r\n          }\r\n          return angular.isObject(data) ? angular.toJson(data) : data;\r\n        }\r\n```\r\n\r\nThis is because the headersGetter used to re-use the argument instead of declaring a new one: https://github.com/angular/angular.js/commit/5da1256fc2812d5b28fb0af0de81256054856369#diff-748e0a1e1a7db3458d5f95d59d7e16c9L71\r\n\r\n/cc @pkozlowski-opensource "}}