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

Commit 10f80d7

Browse files
vojtajinaIgorMinar
authored andcommitted
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
1 parent c3a41ff commit 10f80d7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ng/http.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ function $HttpProvider() {
111111
'Accept': 'application/json, text/plain, */*',
112112
'X-Requested-With': 'XMLHttpRequest'
113113
},
114-
post: {'Content-Type': 'application/json'},
115-
put: {'Content-Type': 'application/json'}
114+
post: {'Content-Type': 'application/json;charset=utf-8'},
115+
put: {'Content-Type': 'application/json;charset=utf-8'}
116116
}
117117
};
118118

test/ng/httpSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ describe('$http', function() {
384384
$httpBackend.expect('POST', '/url', 'messageBody', function(headers) {
385385
return headers['Accept'] == 'application/json, text/plain, */*' &&
386386
headers['X-Requested-With'] == 'XMLHttpRequest' &&
387-
headers['Content-Type'] == 'application/json';
387+
headers['Content-Type'] == 'application/json;charset=utf-8';
388388
}).respond('');
389389

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

402402
$http({url: '/url', method: 'PUT', headers: {}, data: 'messageBody'});

0 commit comments

Comments
 (0)