QwikのrequestEvオブジェクトの中身

ドキュメントが無いのでメモ。`onGet`とか`loader$`の第一引数に来るやつ

`packages/qwik-city/middleware/request-handler/request-event.ts`

```ts
  const requestEv: RequestEventInternal = {
    [RequestEvLoaders]: loaders,
    [RequestEvLocale]: serverRequestEv.locale,
    [RequestEvMode]: serverRequestEv.mode,
    [RequestEvStatus]: 200,
    [RequestEvAction]: undefined,
    [RequestEvTrailingSlash]: trailingSlash,
    [RequestEvBasePathname]: basePathname,
    [RequestEvRoute]: loadedRoute,
    cookie,
    headers,
    env,
    method: request.method,
    params: loadedRoute?.[0] ?? {},
    pathname: url.pathname,
    platform,
    query: url.searchParams,
    request,
    url,
    sharedMap: new Map(),
    get headersSent() {
      return writableStream !== null;
    },
    get exited() {
      return routeModuleIndex >= ABORT_INDEX;
    },

    next,

    exit: () => {
      routeModuleIndex = ABORT_INDEX;
      return new AbortMessage();
    },

    cacheControl: (cacheControl) => {
      check();
      headers.set('Cache-Control', createCacheControl(cacheControl));
    },

    getData: (loaderOrAction: Action<any> | Loader<any>) => {
      // create user request event, which is a narrowed down request context
      const id = (loaderOrAction as LoaderInternal | ActionInternal).__qrl.getHash();

      if ((loaderOrAction as LoaderInternal | ActionInternal).__brand === 'server_loader') {
        if (id in loaders) {
          throw new Error('Loader data does not exist');
        }
      }

      return loaders[id];
    },

    status: (statusCode?: number) => {
      if (typeof statusCode === 'number') {
        check();
        requestEv[RequestEvStatus] = statusCode;
        return statusCode;
      }
      return requestEv[RequestEvStatus];
    },

    locale: (locale?: string) => {
      if (typeof locale === 'string') {
        requestEv[RequestEvLocale] = locale;
      }
      return requestEv[RequestEvLocale] || '';
    },

    error: (statusCode: number, message: string) => {
      requestEv[RequestEvStatus] = statusCode;
      headers.delete('Cache-Control');
      return new ErrorResponse(statusCode, message);
    },

    redirect: (statusCode: number, url: string) => {
      check();
      requestEv[RequestEvStatus] = statusCode;
      headers.set('Location', url);
      headers.delete('Cache-Control');
      if (statusCode > 301) {
        headers.set('Cache-Control', 'no-store');
      }
      return new RedirectMessage();
    },

    fail: <T extends Record<string, any>>(statusCode: number, data: T) => {
      check();
      requestEv[RequestEvStatus] = statusCode;
      headers.delete('Cache-Control');
      return {
        __brand: 'fail',
        ...data,
      };
    },

    locale: (locale?: string) => {
      if (typeof locale === 'string') {
        requestEv[RequestEvLocale] = locale;
      }
      return requestEv[RequestEvLocale] || '';
    },

    error: (statusCode: number, message: string) => {
      requestEv[RequestEvStatus] = statusCode;
      headers.delete('Cache-Control');
      return new ErrorResponse(statusCode, message);
    },

    redirect: (statusCode: number, url: string) => {
      check();
      requestEv[RequestEvStatus] = statusCode;
      headers.set('Location', url);
      headers.delete('Cache-Control');
      if (statusCode > 301) {
        headers.set('Cache-Control', 'no-store');
      }
      return new RedirectMessage();
    },

    fail: <T extends Record<string, any>>(statusCode: number, data: T) => {
      check();
      requestEv[RequestEvStatus] = statusCode;
      headers.delete('Cache-Control');
      return {
        __brand: 'fail',
        ...data,
      };
    },
  }
```