This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
UrlEncoding does not handle DateTimes correctly #8150
Labels
Milestone
Comments
Alternative approach as discussed in #6128
|
danbarua
added a commit
to danbarua/angular.js
that referenced
this issue
Jul 11, 2014
$http was wrapping dates in double quotes leading to query strings like this: ?date=%222014-07-07T23:00:00.000Z%22 Instead of calling JSON.stringify, this fix checks to see if a param object has a toJSON() function and uses that for encoding, falling back to JSON.stringify as per the previous behaviour. Closes angular#8150 and angular#6128
Closed
danbarua
added a commit
to danbarua/angular.js
that referenced
this issue
Jul 11, 2014
$http was wrapping dates in double quotes leading to query strings like this: ?date=%222014-07-07T23:00:00.000Z%22 Instead of calling JSON.stringify, this fix checks to see if a param object has a toJSON() function and uses that for encoding, falling back to JSON.stringify as per the previous behaviour. Closes angular#8150 and angular#6128
ckknight
pushed a commit
to ckknight/angular.js
that referenced
this issue
Jul 16, 2014
This commit special cases date handling rather than calling toJSON as we always need a string representation of the object. $http was wrapping dates in double quotes leading to query strings like this: ?date=%222014-07-07T23:00:00.000Z%22 Closes angular#8150 Closes angular#6128 Closes angular#8154
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Possibly related to #6128
I'm having similar issues to the person in this StackOverflow question: http://stackoverflow.com/a/17355012/128228
It seems people are working around the issue by using Jquery's $.param function but it would be nice to get this issue fixed in Angular.
I'm making a request using $http.GET with params that look like this:
and the resulting HTTP request seems to be wrapping the datetime in quotes and then escaping the quotes resulting in this query string:
The offending line seems to be https://github.com/angular/angular.js/blob/master/src/ng/http.js#L993 which encodes a datetime into the string ""2014-06-30T23:00:00.000Z"" (note the double quotes).
I've implemented the following hack which works for me, but perhaps there may be a better way...
The text was updated successfully, but these errors were encountered: