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

Fix #6128 and #8150 #8154

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/ng/http.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
'use strict';

/**
* Parse headers into key value object
Expand Down Expand Up @@ -990,7 +990,12 @@ function $HttpProvider() {

forEach(value, function(v) {
if (isObject(v)) {
v = toJson(v);
if (v instanceof Date){
v = v.toISOString(); //toISOString() only supported in IE8 and above
}
else if (isObject(v)) {
v = toJson(v);
}
}
parts.push(encodeUriQuery(key) + '=' +
encodeUriQuery(v));
Expand Down
5 changes: 5 additions & 0 deletions test/ng/httpSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ describe('$http', function() {
$httpBackend.expect('GET', '/url').respond('');
$http({url: '/url', params: {}, method: 'GET'});
});

it('should not double quote dates', function() {
$httpBackend.expect('GET', '/url?date=2014-07-15T17:30:00.000Z').respond('');
$http({url: '/url', params: {date:new Date('2014-07-15T17:30:00.000Z')}, method: 'GET'});
});
});


Expand Down