Skip to content

Commit 1237eb3

Browse files
author
Rich Harris
authored
Expose rawBody (#1109)
* expect rawBody and parse inside kit * update adapter-node * ignore type error for now * random lockfile stuff * update docs * add wrangler.toml * use rawBody, bundle worker with esbuild * fix dependencies * fix dependencies * update lockfile * ugh who asked you, eslint * changesets * add test * pass rawBody from netlify adapter * expose getRawBody from kit/http * use getRawBody in adapter-node * use getRawBody in adapter-vercel
1 parent 361bd3b commit 1237eb3

File tree

36 files changed

+410
-280
lines changed

36 files changed

+410
-280
lines changed

.changeset/clever-lizards-grab.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/adapter-node': patch
3+
---
4+
5+
Use getRawBody

.changeset/cold-buttons-sell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/adapter-cloudflare-workers': patch
3+
---
4+
5+
Pass rawBody to SvelteKit, bundle worker with esbuild

.changeset/flat-ducks-impress.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/adapter-vercel': patch
3+
---
4+
5+
Fix dependencies

.changeset/lemon-ways-doubt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/adapter-netlify': patch
3+
---
4+
5+
Fix dependencies

.changeset/modern-dryers-join.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
Expose rawBody on request, and expect rawBody from adapters

.changeset/nasty-boats-bathe.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/adapter-netlify': patch
3+
---
4+
5+
Pass rawBody from netlify adapter

.changeset/tiny-candles-repeat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
Expose getRawBody from kit/http

.changeset/unlucky-wasps-rest.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/adapter-vercel': patch
3+
---
4+
5+
Use getRawBody in adapter-vercel

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ yarn.lock
1010
.vercel_build_output
1111
.netlify
1212
.svelte
13+
.cloudflare

documentation/docs/01-routing.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ type Request<Context = any> = {
5353
path: string;
5454
params: Record<string, string | string[]>;
5555
query: URLSearchParams;
56-
body: string | Buffer | ReadOnlyFormData;
56+
rawBody: string | ArrayBuffer;
57+
body: string | ArrayBuffer | ReadOnlyFormData | any;
5758
context: Context; // see getContext, below
5859
};
5960

@@ -95,10 +96,10 @@ export async function get({ params }) {
9596
9697
The job of this function is to return a `{status, headers, body}` object representing the response, where `status` is an [HTTP status code](https://httpstatusdogs.com):
9798

98-
* `2xx` — successful response (default is `200`)
99-
* `3xx` — redirection (should be accompanied by a `location` header)
100-
* `4xx` — client error
101-
* `5xx` — server error
99+
- `2xx` — successful response (default is `200`)
100+
- `3xx` — redirection (should be accompanied by a `location` header)
101+
- `4xx` — client error
102+
- `5xx` — server error
102103

103104
> For successful responses, SvelteKit will generate 304s automatically
104105
@@ -126,7 +127,6 @@ return {
126127
};
127128
```
128129

129-
130130
### Private modules
131131

132132
A filename that has a segment with a leading underscore, such as `src/routes/foo/_Private.svelte` or `src/routes/bar/_utils/cool-util.js`, is hidden from the router, but can be imported by files that are not.

0 commit comments

Comments
 (0)