cloudworker icon indicating copy to clipboard operation
cloudworker copied to clipboard

respondWith should no-op/throw when called outside context of fetch event

Open jdanyow opened this issue 5 years ago • 1 comments

addEventListener('fetch', async event => {
  await Promise.resolve();
  // In production, this is a no-op because respondWith was not called immediately.
  // cloudworker is returning the response. Perhaps it should throw to help folks catch issues quickly.
  event.respondWith(new Response('hello world'));
});

jdanyow avatar Jul 08 '19 05:07 jdanyow

thanks! I'll take a look at this sometime soon.

hankjacobs avatar Jul 17 '19 01:07 hankjacobs