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
buildUrl uses JSON.stringify instead of toJSON method if it exists #6128
Labels
Comments
Currently (1.3.0-build.2753+sha.f37a2da) buildUrl users angular.toJSON(). Dates however still get quoted and one ends up with URL's that look like |
Duplicated at #8150 |
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.
buildUrl uses JSON.stringify to convert objects to string for $http.get,
but this converts Date objects to a quote enclosed string:
JSON.stringify(new Date()) => ""2014-02-05T15:15:22.612Z""
(new Date()).toJSON() => "2014-02-05T15:40:48.080Z"
I think buildUrl should use the object's toJSON method if it exists
This also applies to other objects that provide toJSON methods
The text was updated successfully, but these errors were encountered: