Move AP request in requests file
This commit is contained in:
parent
af971e06c6
commit
2d1ad5b960
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
import { Response } from 'superagent'
|
|
||||||
import {
|
import {
|
||||||
addAccountToAccountBlocklist,
|
addAccountToAccountBlocklist,
|
||||||
cleanupTests,
|
cleanupTests,
|
||||||
|
|
|
@ -13,7 +13,6 @@ export * from './requests/requests'
|
||||||
|
|
||||||
export * from './search'
|
export * from './search'
|
||||||
|
|
||||||
export * from './server/activitypub'
|
|
||||||
export * from './server/clients'
|
export * from './server/clients'
|
||||||
export * from './server/config'
|
export * from './server/config'
|
||||||
export * from './server/debug'
|
export * from './server/debug'
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */
|
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */
|
||||||
|
|
||||||
import * as request from 'supertest'
|
|
||||||
import { buildAbsoluteFixturePath, root } from '../miscs/miscs'
|
|
||||||
import { isAbsolute, join } from 'path'
|
import { isAbsolute, join } from 'path'
|
||||||
import { URL } from 'url'
|
|
||||||
import { decode } from 'querystring'
|
import { decode } from 'querystring'
|
||||||
|
import * as request from 'supertest'
|
||||||
|
import { URL } from 'url'
|
||||||
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
|
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
|
||||||
|
import { buildAbsoluteFixturePath, root } from '../miscs/miscs'
|
||||||
|
|
||||||
function get4KFileUrl () {
|
function get4KFileUrl () {
|
||||||
return 'https://download.cpy.re/peertube/4k_file.txt'
|
return 'https://download.cpy.re/peertube/4k_file.txt'
|
||||||
|
@ -154,6 +154,15 @@ function makeHTMLRequest (url: string, path: string) {
|
||||||
.expect(HttpStatusCode.OK_200)
|
.expect(HttpStatusCode.OK_200)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function makeActivityPubGetRequest (url: string, path: string, expectedStatus = HttpStatusCode.OK_200) {
|
||||||
|
return makeGetRequest({
|
||||||
|
url,
|
||||||
|
path,
|
||||||
|
statusCodeExpected: expectedStatus,
|
||||||
|
accept: 'application/activity+json,text/html;q=0.9,\\*/\\*;q=0.8'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function updateImageRequest (options: {
|
function updateImageRequest (options: {
|
||||||
url: string
|
url: string
|
||||||
path: string
|
path: string
|
||||||
|
@ -202,6 +211,7 @@ export {
|
||||||
makePutBodyRequest,
|
makePutBodyRequest,
|
||||||
makeDeleteRequest,
|
makeDeleteRequest,
|
||||||
makeRawRequest,
|
makeRawRequest,
|
||||||
|
makeActivityPubGetRequest,
|
||||||
unwrapBody,
|
unwrapBody,
|
||||||
unwrapText,
|
unwrapText,
|
||||||
updateImageRequest
|
updateImageRequest
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
import * as request from 'supertest'
|
|
||||||
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
|
|
||||||
|
|
||||||
function makeActivityPubGetRequest (url: string, path: string, expectedStatus = HttpStatusCode.OK_200) {
|
|
||||||
return request(url)
|
|
||||||
.get(path)
|
|
||||||
.set('Accept', 'application/activity+json,text/html;q=0.9,\\*/\\*;q=0.8')
|
|
||||||
.expect(expectedStatus)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export {
|
|
||||||
makeActivityPubGetRequest
|
|
||||||
}
|
|
Loading…
Reference in New Issue