Commit 6f615bb
authored
feat(server): make CORS plugin origin options sync (#1839)
The `origin` and `timingOrigin` options of `CORSHandlerPlugin` are now
synchronous. They no longer accept promises, so resolving the allowed
origin never suspends the response path.
This is a breaking change for anyone passing an async function to either
option.
## Changes
- `origin` and `timingOrigin` drop `Promisable` from their value types.
- The two `value(...)` calls in the response interceptor are no longer
awaited.
## Testing
`pnpm vitest run packages/server/src/plugins/cors.test.ts` passes (15
tests), `pnpm type:check` is clean across all packages, and lint is
clean. No test changes were needed: every existing case already used
sync origin functions.
## Notes
`BatchHandlerPlugin`'s `maxSize`, `successStatus`, and `headers` options
still accept promises and were left unchanged.1 parent b32e9aa commit 6f615bb
1 file changed
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
0 commit comments