mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-24 08:50:32 +01:00
feat: replace useBody with readBody
This commit is contained in:
@@ -9,7 +9,7 @@ import type {
|
|||||||
} from '@trpc/server'
|
} from '@trpc/server'
|
||||||
import { createURL } from 'ufo'
|
import { createURL } from 'ufo'
|
||||||
import type { CompatibilityEvent } from 'h3'
|
import type { CompatibilityEvent } from 'h3'
|
||||||
import { defineEventHandler, isMethod, useBody } from 'h3'
|
import { defineEventHandler, isMethod, readBody } from 'h3'
|
||||||
import type { TRPCResponse } from '@trpc/server/dist/declarations/src/rpc'
|
import type { TRPCResponse } from '@trpc/server/dist/declarations/src/rpc'
|
||||||
|
|
||||||
type MaybePromise<T> = T | Promise<T>
|
type MaybePromise<T> = T | Promise<T>
|
||||||
@@ -63,7 +63,7 @@ export function createTRPCHandler<Router extends AnyRouter>({
|
|||||||
req: {
|
req: {
|
||||||
method: req.method!,
|
method: req.method!,
|
||||||
headers: req.headers,
|
headers: req.headers,
|
||||||
body: isMethod(event, 'GET') ? null : await useBody(event),
|
body: isMethod(event, 'GET') ? null : await readBody(event),
|
||||||
query: $url.searchParams,
|
query: $url.searchParams,
|
||||||
},
|
},
|
||||||
path: $url.pathname.substring(endpoint.length + 1),
|
path: $url.pathname.substring(endpoint.length + 1),
|
||||||
|
|||||||
Reference in New Issue
Block a user