MCPcopy
hub / github.com/sveltejs/kit / getRequestEvent

Function getRequestEvent

packages/kit/src/runtime/app/server/event.js:23–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21 * @since 2.20.0
22 */
23export function getRequestEvent() {
24 const event = request_event ?? als?.getStore();
25
26 if (!event) {
27 let message =
28 'Can only read the current request event inside functions invoked during `handle`, such as server `load` functions, actions, endpoints, and other server hooks.';
29
30 if (!als) {
31 message +=
32 ' In environments without `AsyncLocalStorage`, the event must be read synchronously, not after an `await`.';
33 }
34
35 throw new Error(message);
36 }
37
38 return event;
39}
40
41/**
42 * @template T

Callers 13

handleErrorFunction · 0.90
hooks.server.jsFile · 0.90
loadFunction · 0.90
+page.server.tsFile · 0.90
GETFunction · 0.90
wrapperFunction · 0.90
wrapperFunction · 0.90
create_instanceFunction · 0.90
getFunction · 0.90
wrapperFunction · 0.90
create_validatorFunction · 0.90
loadFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected