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
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
body | public | ReadableStream<Uint8Array> | The request body as a ReadableStream | net/server/http-compat.ts:334 |
headers | public | GoatHeaders | The request headers in web-standard Headers format | net/server/http-compat.ts:332 |
method | public | string | The HTTP method (GET, POST, etc) | net/server/http-compat.ts:330 |
url | public | string | The normalized request URL including scheme, authority and path | net/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