Kind: Function
Source: src/adapter/cloudflare-pages/conninfo.ts
Part of: Adapter
Get connection information from Cloudflare Pages
getConnInfo reads connection details from a Cloudflare Pages request. It maps Cloudflare-specific request metadata into the connection information shape used by the adapter layer.
Signature
tsfunction getConnInfo(c)
Parameters
| Name | Type |
|---|---|
c | any |
Diagram
mermaidgraph LR A[Cloudflare Pages Request] --> B[getConnInfo] B --> C[Connection Information] C --> D[Adapter Request Handling]
Usage
tsimport { getConnInfo } from "./conninfo"
export const onRequest: PagesFunction = async ({ request }) => {
const connInfo = getConnInfo(request)
console.log(connInfo)
return new Response("OK")
}
AI Coding Instructions
- Pass the Cloudflare Pages
Requestobject togetConnInfo. - Keep Cloudflare-specific header and request metadata handling inside this adapter module.
- Return connection data in the shared shape expected by the rest of the adapter system.
- Account for connection fields that may be absent in local development or test environments.
Was this page helpful?