THRIFT-2674 JavaScript: declare Accept: and Content-Type: in request
Patch: Stig Bakken
This closes #468
diff --git a/lib/js/src/thrift.js b/lib/js/src/thrift.js
index 35f679c..ada28ba 100644
--- a/lib/js/src/thrift.js
+++ b/lib/js/src/thrift.js
@@ -327,7 +327,11 @@
var xreq = this.getXmlHttpRequestObject();
if (xreq.overrideMimeType) {
- xreq.overrideMimeType('application/json');
+ xreq.overrideMimeType('application/vnd.apache.thrift.json; charset=utf-8');
+ }
+ if (xreq.setRequestHeader) {
+ xreq.setRequestHeader('Accept', 'application/vnd.apache.thrift.json; charset=utf-8');
+ xreq.setRequestHeader('Content-Type', 'application/vnd.apache.thrift.json; charset=utf-8');
}
if (callback) {
@@ -387,7 +391,7 @@
data: postData,
type: 'POST',
cache: false,
- contentType: 'application/json',
+ contentType: 'application/vnd.apache.thrift.json; charset=utf-8',
dataType: 'text thrift',
converters: {
'text thrift' : function(responseData) {