aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared/requests.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-17 11:58:15 +0100
committerChocobozzz <me@florianbigard.com>2021-12-17 12:24:03 +0100
commitc55e3d7227fe1453869e309025996b9d75256d5d (patch)
tree08e9b0ca210d75c82c8606fef0852eca020e8e0e /server/tests/shared/requests.ts
parentbf54587a3e2ad9c2c186828f2a5682b91ee2cc00 (diff)
downloadPeerTube-c55e3d7227fe1453869e309025996b9d75256d5d.tar.gz
PeerTube-c55e3d7227fe1453869e309025996b9d75256d5d.tar.zst
PeerTube-c55e3d7227fe1453869e309025996b9d75256d5d.zip
Move test functions outside extra-utils
Diffstat (limited to 'server/tests/shared/requests.ts')
-rw-r--r--server/tests/shared/requests.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/server/tests/shared/requests.ts b/server/tests/shared/requests.ts
index 9eb596029..7f1acc0e1 100644
--- a/server/tests/shared/requests.ts
+++ b/server/tests/shared/requests.ts
@@ -1,7 +1,7 @@
1import { doRequest } from '@server/helpers/requests'
2import { activityPubContextify } from '@server/helpers/activitypub' 1import { activityPubContextify } from '@server/helpers/activitypub'
3import { HTTP_SIGNATURE } from '@server/initializers/constants' 2import { buildDigest } from '@server/helpers/peertube-crypto'
4import { buildGlobalHeaders } from '@server/lib/job-queue/handlers/utils/activitypub-http-utils' 3import { doRequest } from '@server/helpers/requests'
4import { ACTIVITY_PUB, HTTP_SIGNATURE } from '@server/initializers/constants'
5 5
6export function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) { 6export function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) {
7 const options = { 7 const options = {
@@ -31,7 +31,11 @@ export async function makeFollowRequest (to: { url: string }, by: { url: string,
31 key: by.privateKey, 31 key: by.privateKey,
32 headers: HTTP_SIGNATURE.HEADERS_TO_SIGN 32 headers: HTTP_SIGNATURE.HEADERS_TO_SIGN
33 } 33 }
34 const headers = buildGlobalHeaders(body) 34 const headers = {
35 'digest': buildDigest(body),
36 'content-type': 'application/activity+json',
37 'accept': ACTIVITY_PUB.ACCEPT_HEADER
38 }
35 39
36 return makePOSTAPRequest(to.url + '/inbox', body, httpSignature, headers) 40 return makePOSTAPRequest(to.url + '/inbox', body, httpSignature, headers)
37} 41}