Repository: thrift
Updated Branches:
  refs/heads/master 467998b6e -> 1e723d931


THRIFT-2674 JavaScript: declare Accept: and Content-Type: in request
Patch: Stig Bakken

This closes #468


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/1e723d93
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/1e723d93
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/1e723d93

Branch: refs/heads/master
Commit: 1e723d931e92652e4ccb1385709258759ae5bc54
Parents: 467998b
Author: henrique <[email protected]>
Authored: Fri May 1 14:09:00 2015 +1000
Committer: henrique <[email protected]>
Committed: Fri May 1 14:09:00 2015 +1000

----------------------------------------------------------------------
 lib/js/src/thrift.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/1e723d93/lib/js/src/thrift.js
----------------------------------------------------------------------
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 @@ Thrift.TXHRTransport.prototype = {
         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 @@ Thrift.TXHRTransport.prototype = {
             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) {

Reply via email to