Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there support for aborting requests? #11

Open
AjaxSolutions opened this issue Apr 17, 2020 · 3 comments
Open

Is there support for aborting requests? #11

AjaxSolutions opened this issue Apr 17, 2020 · 3 comments
Labels
compat Compatibility issue good first issue Good for newcomers help wanted Extra attention is needed
Projects

Comments

@AjaxSolutions
Copy link

An example, please.

@konojunya
Copy link

I think it would be nice to add a signal to the axios option and abort it as an API.

Ideally, the following is how to use it :)

import axios from "axios";

const controller = new AbortController();
const signal = controller.signal;
const p = axios.get('/user/1234', { signal });

controller.abort(); // abort!

The implementation also seems to be feasible by passing a signal under this option.

headers: deepMerge(options.headers, customHeaders, true)

@developit
Copy link
Owner

@konojunya that's the plan! I actually am already exporting axios.CancelToken as an alias of AbortController and just need to wire up the .signal property.

@developit developit added the compat Compatibility issue label Apr 17, 2020
@developit developit added this to To do in 1.0.0 Apr 17, 2020
@developit developit added good first issue Good for newcomers help wanted Extra attention is needed labels Jul 23, 2020
@makkabi
Copy link

makkabi commented Aug 12, 2023

Would also love to use signal with redaxios (and TypeScript). Is this already possible with what is mentioned in the two comments above? If yes, how?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compat Compatibility issue good first issue Good for newcomers help wanted Extra attention is needed
Projects
1.0.0
  
To do
Development

No branches or pull requests

4 participants