aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands
diff options
context:
space:
mode:
Diffstat (limited to 'shared/server-commands')
-rw-r--r--shared/server-commands/requests/requests.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/shared/server-commands/requests/requests.ts b/shared/server-commands/requests/requests.ts
index 85cbc9be9..8cc1245e0 100644
--- a/shared/server-commands/requests/requests.ts
+++ b/shared/server-commands/requests/requests.ts
@@ -134,7 +134,12 @@ function unwrapText (test: request.Test): Promise<string> {
134function unwrapBodyOrDecodeToJSON <T> (test: request.Test): Promise<T> { 134function unwrapBodyOrDecodeToJSON <T> (test: request.Test): Promise<T> {
135 return test.then(res => { 135 return test.then(res => {
136 if (res.body instanceof Buffer) { 136 if (res.body instanceof Buffer) {
137 return JSON.parse(new TextDecoder().decode(res.body)) 137 try {
138 return JSON.parse(new TextDecoder().decode(res.body))
139 } catch (err) {
140 console.error('Cannot decode JSON.', res.body)
141 throw err
142 }
138 } 143 }
139 144
140 return res.body 145 return res.body