Skip to main content

Interface: GoatRequest

Defined in: net/server/http-compat.ts:320

A cross-platform request wrapper that provides a consistent interface for handling HTTP requests across different runtimes (Deno, Node.js HTTP/1.1, Node.js HTTP/2).

This class normalizes the differences between:

  • Deno/web standard Request
  • Node.js HTTP/1.1 IncomingMessage
  • Node.js HTTP/2 Http2ServerRequest

It provides a web-standard interface with properties like url, method, headers, and body, along with helper methods for common operations.

Properties

PropertyModifierTypeDescriptionDefined in
bodypublicReadableStream<Uint8Array>The request body as a ReadableStreamnet/server/http-compat.ts:334
headerspublicGoatHeadersThe request headers in web-standard Headers formatnet/server/http-compat.ts:332
methodpublicstringThe HTTP method (GET, POST, etc)net/server/http-compat.ts:330
urlpublicstringThe normalized request URL including scheme, authority and pathnet/server/http-compat.ts:328

Accessors

raw

Get Signature

get raw(): Request | NodeHttp1Request | NodeHttp2Request | MinimalNodeIncomingMessage

Defined in: net/server/http-compat.ts:444

Gets the original request object from the runtime

Returns

Request | NodeHttp1Request | NodeHttp2Request | MinimalNodeIncomingMessage

The native request object

Methods

json()

json(): Promise<any>

Defined in: net/server/http-compat.ts:409

Reads and parses the request body as JSON

Returns

Promise<any>

The parsed JSON data


text()

text(): Promise<string>

Defined in: net/server/http-compat.ts:427

Reads the request body as text

Returns

Promise<string>

The body content as a string