]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/shared/requests.ts
Fix live constraints tests
[github/Chocobozzz/PeerTube.git] / server / tests / shared / requests.ts
index 9eb5960298b74615554cea76295600d446a52bea..57120cacacbaf84a785c513e8f95c2ed24238a57 100644 (file)
@@ -1,7 +1,7 @@
+import { buildDigest } from '@server/helpers/peertube-crypto'
 import { doRequest } from '@server/helpers/requests'
-import { activityPubContextify } from '@server/helpers/activitypub'
-import { HTTP_SIGNATURE } from '@server/initializers/constants'
-import { buildGlobalHeaders } from '@server/lib/job-queue/handlers/utils/activitypub-http-utils'
+import { ACTIVITY_PUB, HTTP_SIGNATURE } from '@server/initializers/constants'
+import { activityPubContextify } from '@server/lib/activitypub/context'
 
 export function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) {
   const options = {
@@ -22,7 +22,7 @@ export async function makeFollowRequest (to: { url: string }, by: { url: string,
     object: to.url
   }
 
-  const body = activityPubContextify(follow)
+  const body = activityPubContextify(follow, 'Follow')
 
   const httpSignature = {
     algorithm: HTTP_SIGNATURE.ALGORITHM,
@@ -31,7 +31,11 @@ export async function makeFollowRequest (to: { url: string }, by: { url: string,
     key: by.privateKey,
     headers: HTTP_SIGNATURE.HEADERS_TO_SIGN
   }
-  const headers = buildGlobalHeaders(body)
+  const headers = {
+    'digest': buildDigest(body),
+    'content-type': 'application/activity+json',
+    'accept': ACTIVITY_PUB.ACCEPT_HEADER
+  }
 
   return makePOSTAPRequest(to.url + '/inbox', body, httpSignature, headers)
 }