Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-01-31 18:02:11 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-02-03 17:33:24 +0300
commitb0f915d79cf8338f02a90533c0f1abd5b2b0f16d (patch)
tree28ba83c51166b54545dd2ac3dd7bb5391677ae3e /src
parentef1585e19280a393bac48f26e3cc2f4c55825f00 (diff)
Use JSend-inspired JSON response structures
We don't want SOAP messages, but having a bit of standardized structure in JSON responses makes it easier to interpret them in code. This is just a start for errors. We will have to also migrate the existing (success) respones at some point. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'src')
-rw-r--r--src/http/ErrorResponseParser.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/http/ErrorResponseParser.js b/src/http/ErrorResponseParser.js
index 41a13ccc4..1ba28438e 100644
--- a/src/http/ErrorResponseParser.js
+++ b/src/http/ErrorResponseParser.js
@@ -20,7 +20,7 @@
*/
const isErrorResponse = resp => {
- return 'x-mail-error' in resp.headers
+ return 'x-mail-response' in resp.headers && resp.data.status === 'error'
}
export const parseErrorResponse = resp => {
@@ -28,11 +28,11 @@ export const parseErrorResponse = resp => {
return resp
}
- const {debug, type, code, message, trace} = resp.data
+ const {debug, type, code, message, trace} = resp.data.data || {}
return {
isError: true,
- debug,
+ debug: !!debug,
type,
code,
message,