diff --git a/rest-client.js b/rest-client.js
index <HASH>..<HASH> 100644
--- a/rest-client.js
+++ b/rest-client.js
@@ -105,12 +105,11 @@ return /******/ (function(modules) { // webpackBootstrap
 	            if (args) url += '?' + toQuery(args);
 
 	            var xhr = new XMLHttpRequest();
+	            xhr.open(method, url, true);
 
 	            var contentType = 'application/json';
 	            if (method == 'POST') contentType = 'application/x-www-form-urlencoded';
-
 	            xhr.setRequestHeader('Content-Type', contentType);
-	            xhr.open(method, url, true);
 
 	            this.prerequest(xhr);
 
diff --git a/src/rest-client.js b/src/rest-client.js
index <HASH>..<HASH> 100644
--- a/src/rest-client.js
+++ b/src/rest-client.js
@@ -32,13 +32,12 @@ class RestClient {
             url += '?' + toQuery(args);
 
         let xhr = new XMLHttpRequest();
+        xhr.open(method, url, true);
 
         let contentType = 'application/json';
         if (method == 'POST')
             contentType = 'application/x-www-form-urlencoded';
-
         xhr.setRequestHeader('Content-Type', contentType);
-        xhr.open(method, url, true);
 
         this.prerequest(xhr);
Fixed wrong xhr open and header setting order