path: '/accounts/peertube',
headers: buildAPHeader(),
expecter: (body, status) => {
- return status === 200 && body.startsWith('{"type":')
+ return status === 200 && body.startsWith('{"@context":')
}
},
{
path: '/videos/watch/' + video.uuid,
headers: buildAPHeader(),
expecter: (body, status) => {
- return status === 200 && body.startsWith('{"type":"Video"')
+ return status === 200 && body.startsWith('{"@context":')
}
},
{
}
},
{
- title: 'API - watching',
+ title: 'API - views with token',
method: 'PUT',
headers: {
...buildAuthorizationHeader(),
...buildJSONHeader()
},
body: JSON.stringify({ currentTime: 2 }),
- path: '/api/v1/videos/' + video.uuid + '/watching',
+ path: '/api/v1/videos/' + video.uuid + '/views',
expecter: (body, status) => {
return status === 204
}
},
{
- title: 'API - views',
+ title: 'API - views without token',
method: 'POST',
+ headers: buildJSONHeader(),
+ body: JSON.stringify({ currentTime: 2 }),
path: '/api/v1/videos/' + video.uuid + '/views',
expecter: (body, status) => {
return status === 204
headers?: { [ id: string ]: string }
expecter: Function
}) {
- const { method, path, body, expecter, headers } = options
+ const { method = 'GET', path, body, expecter, headers } = options
return new Promise((res, rej) => {
autocannon({