Browse Source

s3: Set filename and type in POST /multipart body.

Renée Kooi 7 years ago
parent
commit
6a2b2b3e5e
1 changed files with 9 additions and 4 deletions
  1. 9 4
      src/plugins/AwsS3/Multipart.js

+ 9 - 4
src/plugins/AwsS3/Multipart.js

@@ -93,11 +93,16 @@ module.exports = class AwsS3Multipart extends Plugin {
   createMultipartUpload (file) {
     this.assertHost()
 
-    const filename = encodeURIComponent(file.name)
-    const type = encodeURIComponent(file.type)
-    return fetch(`${this.opts.host}/s3/multipart?filename=${filename}&type=${type}`, {
+    return fetch(`${this.opts.host}/s3/multipart`, {
       method: 'post',
-      headers: { accept: 'application/json' }
+      body: JSON.stringify({
+        filename: file.name,
+        type: file.type
+      }),
+      headers: {
+        accept: 'application/json',
+        'content-type': 'application/json'
+      }
     }).then(handleResponse)
   }