X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fextra-utils%2Fvideos%2Fstreaming-playlists-command.ts;h=5d40d35cb9e06b1d0d90cb0ba0c14a39edaf177d;hb=5678353d4fb0ddd8bea044868576ee02cdbabedb;hp=4caec713734e944cc8ee657c7529ff5e53fc615c;hpb=57f879a540551c3b958b0991c8e1e3657a4481d8;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/extra-utils/videos/streaming-playlists-command.ts b/shared/extra-utils/videos/streaming-playlists-command.ts index 4caec7137..5d40d35cb 100644 --- a/shared/extra-utils/videos/streaming-playlists-command.ts +++ b/shared/extra-utils/videos/streaming-playlists-command.ts @@ -1,6 +1,5 @@ - -import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes' -import { unwrapBody, unwrapText } from '../requests' +import { HttpStatusCode } from '@shared/models' +import { unwrapBody, unwrapTextOrDecode, unwrapBodyOrDecodeToJSON } from '../requests' import { AbstractCommand, OverrideCommandOptions } from '../shared' export class StreamingPlaylistsCommand extends AbstractCommand { @@ -8,7 +7,7 @@ export class StreamingPlaylistsCommand extends AbstractCommand { get (options: OverrideCommandOptions & { url: string }) { - return unwrapText(this.getRawRequest({ + return unwrapTextOrDecode(this.getRawRequest({ ...options, url: options.url, @@ -21,20 +20,20 @@ export class StreamingPlaylistsCommand extends AbstractCommand { url: string range?: string }) { - return unwrapText(this.getRawRequest({ + return unwrapBody(this.getRawRequest({ ...options, url: options.url, range: options.range, implicitToken: false, - defaultExpectedStatus: HttpStatusCode.OK_200, + defaultExpectedStatus: HttpStatusCode.OK_200 })) } getSegmentSha256 (options: OverrideCommandOptions & { url: string }) { - return unwrapBody<{ [ id: string ]: string }>(this.getRawRequest({ + return unwrapBodyOrDecodeToJSON<{ [ id: string ]: string }>(this.getRawRequest({ ...options, url: options.url,