-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($http): add check for functions in request #16133
Conversation
Avoid that functions in `params` object (like getter or setter) will be encoded in the url.
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.
|
1 similar comment
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! |
CLAs look good, thanks! |
1 similar comment
CLAs look good, thanks! |
There was a problem hiding this 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:
- Tests
- To decide whether it is a breaking change or not.
default serializer should not serialize functions
default serializer should not serialize functions
shows me an error on ng-model O_o |
There was a problem hiding this 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).
test/ng/httpSpec.js
Outdated
@@ -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'); | |||
}); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
@carlfranz, feel free to ping me when this is ready for another review. |
ping? :) |
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)