Explorar o código

Fix POST Content-type: application/json

some RESTful backend unable to parse
metal A-wing %!s(int64=7) %!d(string=hai) anos
pai
achega
f72764ab88
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      src/js/api.js

+ 2 - 1
src/js/api.js

@@ -24,6 +24,7 @@ const SendXMLHttpRequest = (url, data, success, error, fail) => {
     };
 
     xhr.open(data !== null ? 'POST' : 'GET', url, true);
+    xhr.setRequestHeader("Content-type", "application/json; charset=UTF-8");
     xhr.send(data !== null ? JSON.stringify(data) : null);
 };
 
@@ -50,4 +51,4 @@ export default {
             callback({ status: xhr.status, response: null });
         });
     }
-};
+};