]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/utils/requests/requests.ts
Add ability to manually approves instance followers in REST API
[github/Chocobozzz/PeerTube.git] / shared / utils / requests / requests.ts
index 6b59e24fc188354b9e032377f8e4572bb7a81887..3532fb429e75801a3c8a6fe840a54dcdfeb1849c 100644 (file)
@@ -3,6 +3,10 @@ import { buildAbsoluteFixturePath, root } from '../miscs/miscs'
 import { isAbsolute, join } from 'path'
 import { parse } from 'url'
 
+function get4KFileUrl () {
+  return 'https://download.cpy.re/peertube/4k_file.txt'
+}
+
 function makeRawRequest (url: string, statusCodeExpected?: number, range?: string) {
   const { host, protocol, pathname } = parse(url)
 
@@ -73,6 +77,8 @@ function makeUploadRequest (options: {
   Object.keys(options.fields).forEach(field => {
     const value = options.fields[field]
 
+    if (value === undefined) return
+
     if (Array.isArray(value)) {
       for (let i = 0; i < value.length; i++) {
         req.field(field + '[' + i + ']', value[i])
@@ -166,6 +172,7 @@ function updateAvatarRequest (options: {
 // ---------------------------------------------------------------------------
 
 export {
+  get4KFileUrl,
   makeHTMLRequest,
   makeGetRequest,
   makeUploadRequest,