forwardemail / forwardemail/superagent

Restart an aborted upload

Open
#1,557 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
16.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I am using superagent v5.1.0 in a React file uploader component I am building. As a file is being uploaded, the component allows me to click a button and cancel the upload. Then I can click another button to restart it.

First I start my upload:

```
const formData = new FormData();
formData.append("file", theImageFile);

superagent
.send(formData)
.on('progress', () => { ... })
.end((err, response) => { ... })
```
Then I cancel my upload:

```
superagent.abort();
```

Finally, I restart my upload (same code as when start it) and superagent throws the error: "Can't merge these send calls". The error can be seen here: https://github.com/visionmedia/superagent/blob/56ce51728083392132505218c05edd5cf9f60c58/src/request-base.js#L609

How can I get around this? Is this possible in superagent?

Thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.