PeerTube/shared/extra-utils/server/clients.ts

21 lines
547 B
TypeScript
Raw Normal View History

2017-09-04 14:21:47 -05:00
import * as request from 'supertest'
2020-01-31 09:56:52 -06:00
import { URL } from 'url'
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
2017-09-04 14:21:47 -05:00
function getClient (url: string) {
2017-09-07 10:58:09 -05:00
const path = '/api/v1/oauth-clients/local'
2017-09-04 14:21:47 -05:00
return request(url)
.get(path)
2020-01-31 09:56:52 -06:00
.set('Host', new URL(url).host)
2017-09-04 14:21:47 -05:00
.set('Accept', 'application/json')
.expect(HttpStatusCode.OK_200)
2017-09-04 14:21:47 -05:00
.expect('Content-Type', /json/)
}
// ---------------------------------------------------------------------------
export {
getClient
}