Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function httpRequest(requestContext: RequestContext) {
const controller = new AbortController();
const signal = controller.signal;
// Wrap users passed abort events and call our own internal abort()
const userSignal = requestContext.options && requestContext.options.abortSignal;
if (userSignal) {
if (userSignal) {
controller.abort();
} else {
userSignal.addEventListener("abort", () => {
controller.abort();
});
}
}
const timeout = setTimeout(() => {
controller.abort();