-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat(http): add config parameter to headers functions #7235
Conversation
Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS. Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match. If you signed the CLA as a corporation, please let us know the company's name. Thanks a bunch! PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR. |
CLA signature verified! Thank you! Someone from the team will now triage your PR and it will be processed based on the determined priority (doc updates and fixes with tests are prioritized over other changes). |
it might be better to pass in the we'll also need tests for this change. |
So now the example should be: ... login: { url: './api/login.json', method: 'POST', headers : { 'Authorization': function(config) { return 'Basic ' + btoa(config.data.user + ':' + config.data.pass); } }, ... |
@grisendo - I think that this is a reasonable request and I can see that you've already incorporated Igor's suggestion. This PR could land but it requires a bit more work before it can be merged:
Thnx! |
f47dd1b
to
000e60c
Compare
Just refactored, adding documentation later |
Added also documentation changes. |
Changed to 'config object' as @pkozlowski-opensource suggested and fixed a typo. |
What about 'requestConfig', since is the name given to 'function $http(requestConfig) {' in 'src/ng/http.js' line 619? |
02dc2aa
to
fd2d6c0
Compare
cad9560
to
f294244
Compare
e8dc429
to
e83fab9
Compare
4dd5a20
to
998c61c
Compare
Request Type: feature
How to reproduce:
Component(s): $http
Impact:
Complexity: small
This issue is related to:
Detailed Description:
Adds 'data' parameter in $http's header property when headers defined as functions
Other Comments:
This pull request adds to $http header functions a data parameter, so headers can use object properties to be built:
Example (in a $resource) :