fix($http): add utf-8 to default Content-Type header (post/put)

This fixes special characters issue with MongoLab.

https://groups.google.com/d/topic/angular/1T6h7bfZ7Rs/discussion
This commit is contained in:
Vojta Jina 2012-06-07 17:10:39 -07:00 committed by Igor Minar
parent c3a41ff9fe
commit 10f80d7d29
2 changed files with 4 additions and 4 deletions

View file

@ -111,8 +111,8 @@ function $HttpProvider() {
'Accept': 'application/json, text/plain, */*',
'X-Requested-With': 'XMLHttpRequest'
},
post: {'Content-Type': 'application/json'},
put: {'Content-Type': 'application/json'}
post: {'Content-Type': 'application/json;charset=utf-8'},
put: {'Content-Type': 'application/json;charset=utf-8'}
}
};

View file

@ -384,7 +384,7 @@ describe('$http', function() {
$httpBackend.expect('POST', '/url', 'messageBody', function(headers) {
return headers['Accept'] == 'application/json, text/plain, */*' &&
headers['X-Requested-With'] == 'XMLHttpRequest' &&
headers['Content-Type'] == 'application/json';
headers['Content-Type'] == 'application/json;charset=utf-8';
}).respond('');
$http({url: '/url', method: 'POST', headers: {}, data: 'messageBody'});
@ -396,7 +396,7 @@ describe('$http', function() {
$httpBackend.expect('PUT', '/url', 'messageBody', function(headers) {
return headers['Accept'] == 'application/json, text/plain, */*' &&
headers['X-Requested-With'] == 'XMLHttpRequest' &&
headers['Content-Type'] == 'application/json';
headers['Content-Type'] == 'application/json;charset=utf-8';
}).respond('');
$http({url: '/url', method: 'PUT', headers: {}, data: 'messageBody'});