Skip to main content

Class: BunRequest

Defined in: service-core/src/http/bun/BunAdapters.ts:28

Adapts a Bun/Fetch API Request to the framework-agnostic HttpRequest interface.

Unlike uWS's stack-allocated request, a Fetch API Request stays valid across await, so there is no urgency to capture everything synchronously in the constructor the way UWSRequest must — this is done here purely for parity/simplicity, not correctness.

Implements

Indexable

[key: string]: any

Allow arbitrary per-request properties (websocket, wsHandled, etc.)

Constructors

Constructor

new BunRequest(req, server): BunRequest

Defined in: service-core/src/http/bun/BunAdapters.ts:46

Parameters

req

Request

server

RequestIPSource

Returns

BunRequest

Properties

authPayload?

optional authPayload?: any

Defined in: service-core/src/http/bun/BunAdapters.ts:41

Full decoded JWT payload, set by JWT auth middleware.

Implementation of

HttpRequest.authPayload


authToken?

optional authToken?: string

Defined in: service-core/src/http/bun/BunAdapters.ts:42

Raw JWT token string, set by JWT auth middleware.

Implementation of

HttpRequest.authToken


body

body: any = undefined

Defined in: service-core/src/http/bun/BunAdapters.ts:35

Implementation of

HttpRequest.body


cookies

readonly cookies: Record<string, string>

Defined in: service-core/src/http/bun/BunAdapters.ts:37

Implementation of

HttpRequest.cookies


headers

readonly headers: Record<string, string>

Defined in: service-core/src/http/bun/BunAdapters.ts:32

Implementation of

HttpRequest.headers


method

readonly method: string

Defined in: service-core/src/http/bun/BunAdapters.ts:29

Implementation of

HttpRequest.method


params

params: Record<string, string> = {}

Defined in: service-core/src/http/bun/BunAdapters.ts:33

Implementation of

HttpRequest.params


path

readonly path: string

Defined in: service-core/src/http/bun/BunAdapters.ts:31

Implementation of

HttpRequest.path


query

readonly query: Record<string, string | string[]>

Defined in: service-core/src/http/bun/BunAdapters.ts:34

Implementation of

HttpRequest.query


rawBody?

optional rawBody?: Buffer<ArrayBufferLike>

Defined in: service-core/src/http/bun/BunAdapters.ts:36

Implementation of

HttpRequest.rawBody


signedCookies

readonly signedCookies: Record<string, string> = {}

Defined in: service-core/src/http/bun/BunAdapters.ts:38

Implementation of

HttpRequest.signedCookies


socket

readonly socket: object

Defined in: service-core/src/http/bun/BunAdapters.ts:39

Minimal socket interface; populated with remote address for IP extraction.

remoteAddress?

optional remoteAddress?: string

Implementation of

HttpRequest.socket


url

readonly url: string

Defined in: service-core/src/http/bun/BunAdapters.ts:30

Implementation of

HttpRequest.url


user?

optional user?: any

Defined in: service-core/src/http/bun/BunAdapters.ts:40

Set by JWT auth middleware after successful token verification.

Implementation of

HttpRequest.user