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

Can this library detech aborted requests? #32

Open
TomHart opened this issue Nov 10, 2023 · 1 comment
Open

Can this library detech aborted requests? #32

TomHart opened this issue Nov 10, 2023 · 1 comment

Comments

@TomHart
Copy link

TomHart commented Nov 10, 2023

I can't see a mechanism to tell if a request has been terminate, so I can stop unneeded processing. Is this possible, or if not, anyway it could be added?

@TomokiMiyauci
Copy link
Collaborator

@TomHart
Since it uses only the web standard interface, what you probably want to do can be accomplished as follows:

import { URLRouter } from "https://deno.land/x/http_router/mod.ts";

const handler = URLRouter({
  "/": (request) => {
    request.signal.onabort = () => {
      console.log("aborted");
    };

    return new Response();
  },
});

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

No branches or pull requests

2 participants