webRequest
Convert a Node request into a web Request.
Compatibility
ReactServer/build API, not a browser import.
React SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.
PreactServer/build API, not a browser import.
Preact SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.
Import from @kasperrt/smolter/utils/http
Signature
function webRequest(
incoming: ServerIncomingMessage,
outgoing: ServerResponse,
target?: string,
): Promise<Request>;Parameters
Pass incoming, outgoing, and optionally a local target path for data requests.
Returns
Returns Promise<Request>, preserving method, headers, buffered body and a disconnect abort signal.
Usage
Convert a Node request into a web Request.
const request = await webRequest(req, res);Behavior and limits
Use before body-parser middleware consumes the stream. Express protocol and originalUrl are respected. Body limits and trusted proxy policy belong to the host.