[pve-devel] [PATCH widget-toolkit 01/11] data/ProxmoxProxy: set responseType to undefined for XMLHTTPRequest

Dominik Csapak d.csapak at proxmox.com
Wed May 26 10:58:29 CEST 2021


extjs 7.0 gives the responseType to the XMLHTTPRequest (which
is 'json' for a json reader), but that means that the response is
automatically decoded by the browser, with no means to get the original
return back

in our case, for successful api calls it would work, but some of our
errors are plain text, not json, so the decoded json object is 'null'
and we lose the error information

revert the type to 'undefined' which tells the browser not do do any
decoding

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/data/ProxmoxProxy.js      | 1 +
 src/data/reader/JsonObject.js | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/data/ProxmoxProxy.js b/src/data/ProxmoxProxy.js
index f716113..d4dfe22 100644
--- a/src/data/ProxmoxProxy.js
+++ b/src/data/ProxmoxProxy.js
@@ -17,6 +17,7 @@ Ext.define('Proxmox.RestProxy', {
     constructor: function(config) {
 	Ext.applyIf(config, {
 	    reader: {
+		responseType: undefined,
 		type: 'json',
 		rootProperty: config.root || 'data',
 	    },
diff --git a/src/data/reader/JsonObject.js b/src/data/reader/JsonObject.js
index fff774d..4298066 100644
--- a/src/data/reader/JsonObject.js
+++ b/src/data/reader/JsonObject.js
@@ -32,6 +32,7 @@ Ext.define('Proxmox.data.reader.JsonObject', {
     alias: 'reader.jsonobject',
 
     readArray: false,
+    responseType: undefined,
 
     rows: undefined,
 
-- 
2.20.1





More information about the pve-devel mailing list