Skip to content
tRPC

Partners

Interface: HTTPBaseHandlerOptions<TRouter, TRequest>

On this page

Defined in: packages/server/src/unstable-core-do-not-import/http/types.ts:59

The options every HTTP adapter takes.

Extends

  • BaseHandlerOptions<TRouter, TRequest>

Type Parameters

Type Parameter
TRouter extends AnyTRPCRouter
TRequest

Properties

allowBatching?

optional allowBatching: boolean

Defined in: packages/server/src/unstable-core-do-not-import/http/types.ts:192

Whether clients can batch calls into one request.

See

https://trpc.io/docs/client/links/httpBatchLink#disabling-request-batching

Default

true

Inherited from

BaseHandlerOptions.allowBatching


allowMethodOverride?

optional allowMethodOverride: boolean

Defined in: packages/server/src/unstable-core-do-not-import/http/types.ts:186

Lets clients call queries and subscriptions with POST as well as GET. Mutations always use POST.

See

https://trpc.io/docs/rpc#overriding-the-default-http-method

Default

false

Inherited from

BaseHandlerOptions.allowMethodOverride


batching?

optional batching: object

Defined in: packages/server/src/unstable-core-do-not-import/http/types.ts:172

enabled

enabled: boolean

Default
true

Deprecated

Use allowBatching instead. This will be removed in v12.

Inherited from

BaseHandlerOptions.batching


maxBatchSize?

optional maxBatchSize: number

Defined in: packages/server/src/unstable-core-do-not-import/http/types.ts:199

The most calls a batch can have. Larger batches get a 400 error. Set the client's maxItems to the same or a lower number.

See

https://trpc.io/docs/client/links/httpBatchLink#limiting-batch-size

Default

unlimited

Inherited from

BaseHandlerOptions.maxBatchSize


onError?

optional onError: HTTPErrorHandler<TRouter, TRequest>

Defined in: packages/server/src/unstable-core-do-not-import/http/types.ts:168

Called with each error a procedure throws, for example to log it.

See

https://trpc.io/docs/server/error-handling#handling-errors

Inherited from

BaseHandlerOptions.onError


responseMeta?

optional responseMeta: ResponseMetaFn<TRouter>

Defined in: packages/server/src/unstable-core-do-not-import/http/types.ts:68

Sets the response's status and headers before it's sent, for example to cache it.

See

https://trpc.io/docs/server/caching#using-responsemeta-to-cache-responses


router

router: TRouter

Defined in: packages/server/src/unstable-core-do-not-import/http/types.ts:179

The router to serve.

Inherited from

BaseHandlerOptions.router