how to end response without using "nativeEvent"?
what would be a better way of writing the following inside of
middleware
?
Returning a new Response()
gives a type error (but works as expected) and just setting the event.response.status
and returning doesn't end the response2 Replies
What's the type error? As returning early is the way to end early
onRequest
from createMiddleware
gives:
Type '(event: FetchEvent) => Promise<Response | undefined>' is not assignable to type 'RequestMiddleware | RequestMiddleware[] | undefined'.
just checked now, and throwing a new Response works as expected