|
@@ -36,6 +36,7 @@ class Uploader {
|
|
|
* @property {any} companionOptions
|
|
|
* @property {any=} storage
|
|
|
* @property {any=} headers
|
|
|
+ * @property {string=} httpMethod
|
|
|
*
|
|
|
* @param {UploaderOptions} options
|
|
|
*/
|
|
@@ -112,6 +113,7 @@ class Uploader {
|
|
|
uploadUrl: req.body.uploadUrl,
|
|
|
protocol: req.body.protocol,
|
|
|
metadata: req.body.metadata,
|
|
|
+ httpMethod: req.body.httpMethod,
|
|
|
size: size,
|
|
|
fieldname: req.body.fieldname,
|
|
|
pathPrefix: `${req.companion.options.filePath}`,
|
|
@@ -455,8 +457,9 @@ class Uploader {
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
+ const httpMethod = (this.options.httpMethod || '').toLowerCase() === 'put' ? 'put' : 'post'
|
|
|
const headers = headerSanitize(this.options.headers)
|
|
|
- request.post({ url: this.options.endpoint, headers, formData, encoding: null }, (error, response, body) => {
|
|
|
+ request[httpMethod]({ url: this.options.endpoint, headers, formData, encoding: null }, (error, response, body) => {
|
|
|
if (error) {
|
|
|
logger.error(error, 'upload.multipart.error')
|
|
|
this.emitError(error)
|