Skip to content

Commit

Permalink
fix: axios maxBodyLength option not working (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnmkng committed May 27, 2021
1 parent 6a3e065 commit c559b5a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
1.2.3 / 2021/05/27
===================
- Fixed invalid max body length setting thanks to a transitive default in `axios`.

1.2.2 / 2021/04/20
===================
- Fixed double stringification of JSON inputs in `.start()`, `.call()` and `.metamorph()` functions.
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "apify-client",
"version": "1.2.2",
"version": "1.2.3",
"description": "Apify API client for JavaScript",
"main": "src/index.js",
"keywords": [
Expand Down
6 changes: 5 additions & 1 deletion src/http_client.js
Expand Up @@ -70,8 +70,12 @@ class HttpClient {
transformResponse: null,
responseType: 'arraybuffer',
timeout: this.timeoutMillis,
// maxBodyLength needs to be Infinity, because -1 falls back to a 10 MB default
// from an axios subdependency - 'follow-redirects'
maxBodyLength: Infinity,
// maxContentLength must be -1, because Infinity will cause axios to run super slow
// thanks to a bug that's now fixed, but not released yet https://github.com/axios/axios/pull/3738
maxContentLength: -1,
maxBodyLength: -1,
});

// Clean all default headers because they only make a mess
Expand Down

0 comments on commit c559b5a

Please sign in to comment.