2

I know that in javascript, fetch API's AbortController allows us to cancel HTTP requests from the client side.

  const abortController = new AbortController();
  let httpResponse: FetchResponse;
  try {
    httpResponse = await fetch(endpointUrl, {
      signal: ttsAbortController.signal,
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        blah: 'blah'
      }),
    });

   // Later on:
   abortController.abort();

I want to know if it's possible to listen to this event/signal on the server side and be notified when the client cancels a request. It's especially important in our case since we need to revert some changes that were made before the client cancels their request.

Josh
  • 189
  • 1
  • 16

0 Answers0