From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 8C6EE72959
 for <pve-devel@lists.proxmox.com>; Wed, 26 May 2021 10:58:41 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 88203E2E6
 for <pve-devel@lists.proxmox.com>; Wed, 26 May 2021 10:58:41 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 63205E2A7
 for <pve-devel@lists.proxmox.com>; Wed, 26 May 2021 10:58:40 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 3AEE646674
 for <pve-devel@lists.proxmox.com>; Wed, 26 May 2021 10:58:40 +0200 (CEST)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Wed, 26 May 2021 10:58:29 +0200
Message-Id: <20210526085839.9808-2-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20210526085839.9808-1-d.csapak@proxmox.com>
References: <20210526085839.9808-1-d.csapak@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.028 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pve-devel] [PATCH widget-toolkit 01/11] data/ProxmoxProxy: set
 responseType to undefined for XMLHTTPRequest
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 26 May 2021 08:58:41 -0000

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@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