1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

More robust test

This commit is contained in:
Chocobozzz 2023-05-15 15:41:31 +02:00
parent 5a05c14573
commit 261dac403a
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 6 additions and 3 deletions

View file

@ -14,7 +14,7 @@ export class StreamingPlaylistsCommand extends AbstractCommand {
withRetry?: boolean // default false
currentRetry?: number
}): Promise<string> {
const { videoFileToken, reinjectVideoFileToken, withRetry = false, currentRetry = 1 } = options
const { videoFileToken, reinjectVideoFileToken, expectedStatus, withRetry = false, currentRetry = 1 } = options
try {
const result = await unwrapTextOrDecode(this.getRawRequest({
@ -29,6 +29,11 @@ export class StreamingPlaylistsCommand extends AbstractCommand {
defaultExpectedStatus: HttpStatusCode.OK_200
}))
// master.m3u8 could be empty
if (!result && (!expectedStatus || expectedStatus === HttpStatusCode.OK_200)) {
throw new Error('Empty result')
}
return result
} catch (err) {
if (!withRetry || currentRetry > 10) throw err