Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix($http): add check for functions in request #16133

Closed
wants to merge 5 commits into from
Closed

fix($http): add check for functions in request #16133

wants to merge 5 commits into from

Conversation

carlfranz
Copy link
Contributor

Avoid that functions in params object (like getter or setter) will be encoded in the url.

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix.

What is the current behavior? (You can also link to an open issue here)
Functions in class-object are encoded in url.

What is the new behavior (if this is a feature change)?
Functions in class-object are no more encoded in url

Does this PR introduce a breaking change?
no

Please check if the PR fulfills these requirements

Other information:
See example of bug here: https://embed.plnkr.co/tspyPWVcm6jMpVDBl6WK/ (open console)

Avoid that functions in `params` object (like getter or setter) will be encoded in the url.
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

1 similar comment
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@carlfranz
Copy link
Contributor Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

Copy link
Member

@gkalpak gkalpak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks reasonable. Thx 👍
We need:

  1. Tests
  2. To decide whether it is a breaking change or not.

default serializer should not serialize functions
default serializer should not serialize functions
@carlfranz
Copy link
Contributor Author

shows me an error on ng-model O_o

Copy link
Member

@gkalpak gkalpak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly related to this PR, but I realized that $httpParamSerializerJQLike treats functions differently than jQuery (jQuery calls functions and uses the return value).

@@ -2345,6 +2345,10 @@ describe('$http param serializers', function() {
expect(jqrSer({someDate: new Date('2014-07-15T17:30:00.000Z')})).toEqual('someDate=2014-07-15T17:30:00.000Z');
});

it('should NOT serialize functions', function() {
expect(defSer({foo: 'foov', bar: function() {}})).toEqual('foo=foov');
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not common functionality. It does not belong here, but in default array serialization section.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved!

default serialization should not serialize functions
functions should NOT be serialized
@gkalpak
Copy link
Member

gkalpak commented Jul 31, 2017

@carlfranz, feel free to ping me when this is ready for another review.

@carlfranz
Copy link
Contributor Author

ping? :)

gkalpak pushed a commit that referenced this pull request Jul 31, 2017
@gkalpak gkalpak closed this in 394dbcc Jul 31, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants