Skip to content

Commit 291e8fe

Browse files
author
Sefa Ilkimen
committed
browser: fix content type header
1 parent 8b3466e commit 291e8fe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/browser/cordova-http-plugin.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ function sendRequest(method, withData, opts, success, failure) {
8686

8787
switch (serializer) {
8888
case 'json':
89+
xhr.setRequestHeader('Content-Type', 'application/json; charset=utf8');
8990
processedData = serializeJsonData(data);
9091

9192
if (processedData === null) {
@@ -95,12 +96,12 @@ function sendRequest(method, withData, opts, success, failure) {
9596
break;
9697

9798
case 'utf8':
98-
xhr.setRequestHeader('Content-type', 'application/json; charset=utf8');
99+
xhr.setRequestHeader('Content-Type', 'text/plain; charset=utf8');
99100
processedData = data.text;
100101
break;
101102

102103
case 'urlencoded':
103-
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
104+
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
104105
processedData = serializeParams(data);
105106
break;
106107
}

0 commit comments

Comments
 (0)