Permalink
Browse files

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
  • Loading branch information...
1 parent c3a41ff commit 10f80d7d2918f98262090b425ecc294d9518aa7e @vojtajina vojtajina committed with IgorMinar Jun 8, 2012
Showing with 4 additions and 4 deletions.
  1. +2 −2 src/ng/http.js
  2. +2 −2 test/ng/httpSpec.js
View
@@ -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
@@ -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'});

0 comments on commit 10f80d7

Please sign in to comment.