Skip to content

getConnInfo

reference
1 min readUpdated

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

ts
function getConnInfo(c)

Parameters

NameType
cany

Diagram

mermaid
graph LR
  A[Cloudflare Pages Request] --> B[getConnInfo]
  B --> C[Connection Information]
  C --> D[Adapter Request Handling]

Usage

ts
import { 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 Request object to getConnInfo.
  • 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?

Download as PDF
getConnInfo — Hono (narrator proof)