New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(http): add config parameter to headers functions #7235

Closed
wants to merge 1 commit into
base: master
from

Conversation

@grisendo

grisendo commented Apr 24, 2014

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) :

...
                  login: {
                    url: './api/login.json',
                    method: 'POST',
                    headers : {
                        'Authorization': function(data) {
                          return 'Basic ' + btoa(data.user + ':' + data.pass);
                        }
                    },
...
@mary-poppins

This comment has been minimized.

Show comment
Hide comment
@mary-poppins

mary-poppins Apr 24, 2014

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#7235)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

mary-poppins commented Apr 24, 2014

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#7235)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@lefos987 lefos987 added this to the Backlog milestone Apr 24, 2014

@mary-poppins

This comment has been minimized.

Show comment
Hide comment
@mary-poppins

mary-poppins May 2, 2014

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.
PS2: If you are a Googler, please sign the CLA as well to simplify the CLA verification process.

mary-poppins commented May 2, 2014

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.
PS2: If you are a Googler, please sign the CLA as well to simplify the CLA verification process.

@grisendo grisendo added cla: no and removed cla: yes labels May 2, 2014

@mary-poppins

This comment has been minimized.

Show comment
Hide comment
@mary-poppins

mary-poppins May 2, 2014

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).

mary-poppins commented May 2, 2014

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).

@grisendo grisendo added cla: yes and removed cla: no labels May 2, 2014

@IgorMinar

This comment has been minimized.

Show comment
Hide comment
@IgorMinar

IgorMinar May 2, 2014

Member

it might be better to pass in the config object since that one contains all of the information about the request. (other people might want to set a header depending on the http method or other header value)

we'll also need tests for this change.

Member

IgorMinar commented May 2, 2014

it might be better to pass in the config object since that one contains all of the information about the request. (other people might want to set a header depending on the http method or other header value)

we'll also need tests for this change.

@grisendo grisendo changed the title from feat(http): add data parameter to headers functions to feat(http): add config parameter to headers functions May 3, 2014

@grisendo

This comment has been minimized.

Show comment
Hide comment
@grisendo

grisendo May 3, 2014

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 commented May 3, 2014

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);
                        }
                    },
...

@btford btford removed the gh: PR label Aug 20, 2014

@pkozlowski-opensource

This comment has been minimized.

Show comment
Hide comment
@pkozlowski-opensource

pkozlowski-opensource Aug 24, 2014

Member

@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:

  • - it doesn't merge cleanly any more, could you please rebase it on top of the current master?
  • - we need to update docs to reflect this new argument

Thnx!

Member

pkozlowski-opensource commented Aug 24, 2014

@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:

  • - it doesn't merge cleanly any more, could you please rebase it on top of the current master?
  • - we need to update docs to reflect this new argument

Thnx!

@grisendo

This comment has been minimized.

Show comment
Hide comment
@grisendo

grisendo Aug 25, 2014

Just refactored, adding documentation later

grisendo commented Aug 25, 2014

Just refactored, adding documentation later

@grisendo

This comment has been minimized.

Show comment
Hide comment
@grisendo

grisendo Aug 26, 2014

Added also documentation changes.

grisendo commented Aug 26, 2014

Added also documentation changes.

@grisendo

This comment has been minimized.

Show comment
Hide comment
@grisendo

grisendo Aug 27, 2014

Changed to 'config object' as @pkozlowski-opensource suggested and fixed a typo.

grisendo commented Aug 27, 2014

Changed to 'config object' as @pkozlowski-opensource suggested and fixed a typo.

@pkozlowski-opensource

This comment has been minimized.

Show comment
Hide comment
@pkozlowski-opensource

pkozlowski-opensource Sep 5, 2014

I'm not sure if 'data' is the best argument name here... What about configObj or something along those lines?

pkozlowski-opensource commented on src/ng/http.js in e6965a8 Sep 5, 2014

I'm not sure if 'data' is the best argument name here... What about configObj or something along those lines?

@grisendo

This comment has been minimized.

Show comment
Hide comment
@grisendo

grisendo Sep 6, 2014

What about 'requestConfig', since is the name given to 'function $http(requestConfig) {' in 'src/ng/http.js' line 619?

grisendo commented Sep 6, 2014

What about 'requestConfig', since is the name given to 'function $http(requestConfig) {' in 'src/ng/http.js' line 619?

@pkozlowski-opensource pkozlowski-opensource self-assigned this Nov 25, 2014

@pkozlowski-opensource pkozlowski-opensource modified the milestones: Backlog, 1.3.8 Dec 13, 2014

@btford btford modified the milestones: 1.3.8, 1.3.9 Dec 19, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment