import { sha256 } from '../../../server/helpers/core-utils'
import { VideoStreamingPlaylist } from '../../models/videos/video-streaming-playlist.model'
import { expect } from 'chai'
+import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
-function getPlaylist (url: string, statusCodeExpected = 200) {
+function getPlaylist (url: string, statusCodeExpected = HttpStatusCode.OK_200) {
return makeRawRequest(url, statusCodeExpected)
}
-function getSegment (url: string, statusCodeExpected = 200, range?: string) {
+function getSegment (url: string, statusCodeExpected = HttpStatusCode.OK_200, range?: string) {
return makeRawRequest(url, statusCodeExpected, range)
}
-function getSegmentSha256 (url: string, statusCodeExpected = 200) {
+function getSegmentSha256 (url: string, statusCodeExpected = HttpStatusCode.OK_200) {
return makeRawRequest(url, statusCodeExpected)
}
const offset = parseInt(matches[2], 10)
const range = `${offset}-${offset + length - 1}`
- const res2 = await getSegment(`${baseUrlSegment}/${videoUUID}/${videoName}`, 206, `bytes=${range}`)
+ const res2 = await getSegment(`${baseUrlSegment}/${videoUUID}/${videoName}`, HttpStatusCode.PARTIAL_CONTENT_206, `bytes=${range}`)
const resSha = await getSegmentSha256(hlsPlaylist.segmentsSha256Url)