Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A PR in SvelteKit introduces a number of breaking changes that lay the foundation for streaming request/response bodies enable multipart form handling (including file uploads) better align SvelteKit with modern platforms that deal with `Request` and `Response` objects natively Hooks (`handle`, `handleError` and `getSession`) and endpoints previously received a proprietary `Request` object: ```ts interface Request<Locals = Record<string, any>, Body = unknown> { url: URL; method: string; headers: RequestHeaders; rawBody: RawBody; params: Record<string, string>; body: ParameterizedBody<Body>; locals: Locals; } ``` Instead, they now receive a `RequestEvent`: ```ts export interface RequestEvent<Locals = Record<string, any>> { request: Request; // https://developer.mozilla.org/en-US/docs/Web/API/Request url: URL; // https://developer.mozilla.org/en-US/docs/Web/API/URL params: Record<string, string>; locals: Locals; } ``` `method` and `headers` are no longer necessary as they exist on the `request` object. (`url` is still provided, since the `URL` object contains conveniences like `url.searchParams.get('foo')`, whereas `request.url` is a string.) To access the request body use the text/json/arrayBuffer/formData methods, e.g. `body = await request.json()`. See sveltejs/kit#3384 for details
- Loading branch information