1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

emit more specific status codes on video upload (#3423)

- reduce http status codes list to potentially useful codes
- convert more codes to typed ones
- factorize html generator for error responses
This commit is contained in:
Rigel Kent 2020-12-08 21:16:10 +01:00 committed by GitHub
parent c977fd3ec9
commit f2eb23cd87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 506 additions and 310 deletions

View file

@ -24,6 +24,7 @@ import {
} from '../../../../shared/extra-utils'
import { getAccount } from '../../../../shared/extra-utils/users/accounts'
import { VideoPlaylistPrivacy } from '../../../../shared/models/videos'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
describe('Test AP refresher', function () {
let servers: ServerInfo[] = []
@ -86,8 +87,8 @@ describe('Test AP refresher', function () {
await waitJobs(servers)
await getVideo(servers[0].url, videoUUID1, 404)
await getVideo(servers[0].url, videoUUID2, 200)
await getVideo(servers[0].url, videoUUID1, HttpStatusCode.NOT_FOUND_404)
await getVideo(servers[0].url, videoUUID2, HttpStatusCode.OK_200)
})
it('Should not update a remote video if the remote instance is down', async function () {
@ -106,7 +107,7 @@ describe('Test AP refresher', function () {
await reRunServer(servers[1])
await getVideo(servers[0].url, videoUUID3, 200)
await getVideo(servers[0].url, videoUUID3, HttpStatusCode.OK_200)
})
})
@ -126,8 +127,8 @@ describe('Test AP refresher', function () {
await waitJobs(servers)
await getAccount(servers[0].url, 'user1@localhost:' + servers[1].port, 200)
await getAccount(servers[0].url, 'user2@localhost:' + servers[1].port, 404)
await getAccount(servers[0].url, 'user1@localhost:' + servers[1].port, HttpStatusCode.OK_200)
await getAccount(servers[0].url, 'user2@localhost:' + servers[1].port, HttpStatusCode.NOT_FOUND_404)
})
})
@ -146,8 +147,8 @@ describe('Test AP refresher', function () {
await waitJobs(servers)
await getVideoPlaylist(servers[0].url, playlistUUID1, 200)
await getVideoPlaylist(servers[0].url, playlistUUID2, 404)
await getVideoPlaylist(servers[0].url, playlistUUID1, HttpStatusCode.OK_200)
await getVideoPlaylist(servers[0].url, playlistUUID2, HttpStatusCode.NOT_FOUND_404)
})
})