From 00c5955b13cc173d4ba6018b582afd3993ac89a1 Mon Sep 17 00:00:00 2001 From: Benjamin Graf Date: Mon, 12 Oct 2020 19:14:09 +0200 Subject: [PATCH 1/2] Update factory.js Document the `maxBodyLength` property on the `PutOptions` object. It will be passed through to `follow-redirects` in nodejs-environments, where it is the default axios backend. See also those issues: https://github.com/axios/axios/issues/2696 https://github.com/axios/axios/issues/1323 The option is documented here: https://www.npmjs.com/package/follow-redirects --- source/factory.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/factory.js b/source/factory.js index 1456d1c7..e649e5a9 100644 --- a/source/factory.js +++ b/source/factory.js @@ -25,7 +25,8 @@ const NOOP = () => {}; * Options for creating a resource * @typedef {UserOptions} PutOptions * @property {Boolean=} overwrite - Whether or not to overwrite existing files (default: true) - * @property {Number=} maxContentLength - The maximum amount of bytes to upload (default: 10 MiB) + * @property {Number=} maxContentLength - The maximum amount of bytes to download (default: 10 MiB) + * @property {Number=} maxBodyLength - The maximum amount of bytes to upload (default: 10 MiB) (only in nodejs-environments) */ /** From 10a52a7e43e24badf4719c67351fb80e84988ef5 Mon Sep 17 00:00:00 2001 From: Benjamin Graf Date: Mon, 12 Oct 2020 19:19:22 +0200 Subject: [PATCH 2/2] Update request.js Allow passing the option `maxBodyLength` through to axios which in turn will pass it on to `follow-redirects`, which is it's default backend in nodejs environments --- source/request.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/request.js b/source/request.js index 0cd9bc6d..6867f7a1 100644 --- a/source/request.js +++ b/source/request.js @@ -71,6 +71,9 @@ function prepareRequestOptions(requestOptions, methodOptions) { if (methodOptions.maxContentLength) { requestOptions.maxContentLength = methodOptions.maxContentLength; } + if (methodOptions.maxBodyLength) { + requestOptions.maxBodyLength = methodOptions.maxBodyLength; + } if (methodOptions.onUploadProgress && typeof methodOptions.onUploadProgress === "function") { requestOptions.onUploadProgress = methodOptions.onUploadProgress; }