mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 17:59:37 +02:00
Fix tests
This commit is contained in:
parent
e37ca6cbc7
commit
7dd7ff4ceb
2 changed files with 9 additions and 4 deletions
|
@ -134,7 +134,12 @@ function unwrapText (test: request.Test): Promise<string> {
|
|||
function unwrapBodyOrDecodeToJSON <T> (test: request.Test): Promise<T> {
|
||||
return test.then(res => {
|
||||
if (res.body instanceof Buffer) {
|
||||
return JSON.parse(new TextDecoder().decode(res.body))
|
||||
try {
|
||||
return JSON.parse(new TextDecoder().decode(res.body))
|
||||
} catch (err) {
|
||||
console.error('Cannot decode JSON.', res.body)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
return res.body
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue