Skip to content

Abortable fetch #20

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

Closed
wants to merge 4 commits into from
Closed

Abortable fetch #20

wants to merge 4 commits into from

Conversation

jklemmack
Copy link

To address UserVoice request Support AbortController API in servicestack-client, and to add a feature analogous to AxiosJS's cancellation, this PR adds support for an optional request config parameter signal, of type AbortSignal.

This is a cleanup & reissue of PR #19

Example usage:

let controller = new AbortController();
const signal = controller.signal;

let client = new JsonServiceClient(...)
let result = client.get(request, null, signal )
.then(response => {})
.catch((error) => {})

signal.abort();

@mythz
Copy link
Member

mythz commented Feb 15, 2021

@jklemmack Is this PR ready to merge? Or if you're still working on it drop a comment later to let me know when it's ready.

I'm usually hesitant to add dependencies in case it breaks an environment. Can you also check that the UMD build still works, i.e:

<script defer src="dist/servicestack-client.umd.js"></script>

@jklemmack
Copy link
Author

It should be good to go, but I'll admit there's some risk. The majority of the tests fail for me since the test URL endpoint isn't live currently. The additional AbortController dependency is only added as a devDependency to support testing.

Right now I'm getting an error running publish which I think I've traced to inject-umd.sh

sed: 1: "dist/servicestack-clien ...": extra characters at the end of d command

I'm not a Mac/linux guy, so I'm hitting a nice brick wall currently.

@mythz
Copy link
Member

mythz commented Feb 15, 2021

I'm not a Mac/linux guy, so I'm hitting a nice brick wall currently.

I'm running this on Windows. To build the library I'm just running npm run publish package.json script which uses WSL's bash inject-umd.sh to run the script. I've deployed an update very recently so you should be able to run npm run publish in your local branch to build the /dist assets.

@mythz mythz closed this Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants