( context: TContext )
| 218 | } |
| 219 | |
| 220 | async function parseContextParams<TContext>( |
| 221 | context: TContext |
| 222 | ): Promise<Record<string, string | string[] | undefined>> { |
| 223 | const candidate = context as RouteContextWithParams |
| 224 | if (!candidate.params) return {} |
| 225 | return await candidate.params |
| 226 | } |
| 227 | |
| 228 | function shouldReadJsonBody<C extends AnyApiRouteContract>(contract: C): boolean { |
| 229 | return Boolean(contract.body) && contract.method !== 'GET' |