]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/utils/requests/requests.ts
Fix caption upload on Mac OS
[github/Chocobozzz/PeerTube.git] / server / tests / utils / requests / requests.ts
index b88b3ce5b4270c640a26c203350f212e03aa9211..fc7b38b8c3047f654d9be5763d547065ad3ea217 100644 (file)
@@ -48,7 +48,7 @@ function makeUploadRequest (options: {
   path: string,
   token?: string,
   fields: { [ fieldName: string ]: any },
-  attaches: { [ attachName: string ]: any },
+  attaches: { [ attachName: string ]: any | any[] },
   statusCodeExpected?: number
 }) {
   if (!options.statusCodeExpected) options.statusCodeExpected = 400
@@ -78,7 +78,11 @@ function makeUploadRequest (options: {
 
   Object.keys(options.attaches).forEach(attach => {
     const value = options.attaches[attach]
-    req.attach(attach, buildAbsoluteFixturePath(value))
+    if (Array.isArray(value)) {
+      req.attach(attach, buildAbsoluteFixturePath(value[0]), value[1])
+    } else {
+      req.attach(attach, buildAbsoluteFixturePath(value))
+    }
   })
 
   return req.expect(options.statusCodeExpected)