Closed
Description
#### Summary
The following code demonstrates the issue:
require('axios').get(
'https://upload.wikimedia.org/wikipedia/commons/f/fe/A_Different_Slant_on_Carina.jpg',
{ maxContentLength: 2000 }
)
.then(d => console.log('done'))
.catch(e => console.log(e.toString()))
Expected behavior:
- The script exits immediately after printing "Error: maxContentLength size of 2000 exceeded"
- Not much more than 2KB was downloaded from the server
Actual behavior:
- The script prints "Error: maxContentLength size of 2000 exceeded", then continues to download the remaining 52MB of data from the server. It takes about two minutes before it exits on my connection.
It's possible to work around this by adding a cancellation token and manually canceling the request when an error is encountered. However, since the request never actually fires a "complete" event, it's surprising that the download continues, only to have the data be thrown into the void.
#### Context
- axios version: v0.16.2
- Environment: node v8.4.0, macOS Sierra 10.12.6
Metadata
Metadata
Assignees
Labels
No labels