Skip to content

basalt / http/src / RawBody

Interface: RawBody ​

Defined in: http/src/raw-body.ts:29

What a rawBody() route's handler receives as body.

Properties ​

bytes ​

> bytes: Buffer

Defined in: http/src/raw-body.ts:35

The exact bytes that arrived — never parsed, never re-serialised. This is the message a provider signed; anything derived from a parsed object is a different message.


contentLength ​

> contentLength: number | undefined

Defined in: http/src/raw-body.ts:43

The declared Content-Length, when the client sent one.


contentType ​

> contentType: string | undefined

Defined in: http/src/raw-body.ts:41

The declared Content-Type essence, lower-cased and without parameters (application/json), or undefined when the client sent none. The client's claim about the bytes, not a fact about them.

Methods ​

text() ​

> text(): string

Defined in: http/src/raw-body.ts:50

bytes decoded as UTF-8 — the form most signature schemes are specified against (stripe.webhooks.constructEvent takes a string). Decoding is lossy for bytes that are not valid UTF-8; use RawBody.bytes when the scheme is specified over octets.

Returns ​

string

Released under the MIT License.