-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($http): add check for functions in params #16132
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.
|
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 looks reasonable. (TBD if it is a breaking change or not.)
Could you add some tests?
src/ng/http.js
Outdated
@@ -42,6 +42,7 @@ function $HttpParamSerializerProvider() { | |||
var parts = []; | |||
forEachSorted(params, function(value, key) { | |||
if (value === null || isUndefined(value)) return; | |||
if (typeof value === 'function') return; |
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.
You can incorporate with the previous line:
if (value === null || isUndefined(value) || isFunction(value)) return;
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.
done! Can't find how to rename wrong commit :(
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.
@carlfranz, you can amend your last commit with git commit --amend
.
(Or if you want to change/reorganize multiple commits, git rebase --interactive <COMMIT_RANGE>
is powerful tool. Too powerful - ue at your own risk 😛)
when submitting params as class-object checks and remove functions
default serializer should NOT serialize functions
default serializer shoud not serialize functions
I created new one with the right commit format at #16133 please delete this. 👍 |
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)