src/adapter/aws-lambda/handler.test.ts
            
                import type { LambdaEvent } from './handler'
                import { getProcessor, isContentEncodingBinary, isContentTypeBinary } from './handler'
                
                describe('isContentTypeBinary', () => {
                  it('Should determine whether it is binary', () => {
                    expect(isContentTypeBinary('image/png')).toBe(true)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('font/woff2')).toBe(true)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('image/svg+xml')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('image/svg+xml; charset=UTF-8')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('text/plain')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('text/plain; charset=UTF-8')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('text/css')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('text/javascript')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('application/json')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('application/ld+json')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('application/json; charset=UTF-8')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

}) }) describe('isContentEncodingBinary', () => { it('Should determine whether it is compressed', () => { expect(isContentEncodingBinary('gzip')).toBe(true)          

(alias) isContentEncodingBinary(contentEncoding: string | null): boolean import isContentEncodingBinary

expect(isContentEncodingBinary('compress')).toBe(true)          

(alias) isContentEncodingBinary(contentEncoding: string | null): boolean import isContentEncodingBinary

expect(isContentEncodingBinary('deflate')).toBe(true)          

(alias) isContentEncodingBinary(contentEncoding: string | null): boolean import isContentEncodingBinary

expect(isContentEncodingBinary('br')).toBe(true)          

(alias) isContentEncodingBinary(contentEncoding: string | null): boolean import isContentEncodingBinary

expect(isContentEncodingBinary('deflate, gzip')).toBe(true)          

(alias) isContentEncodingBinary(contentEncoding: string | null): boolean import isContentEncodingBinary

expect(isContentEncodingBinary('')).toBe(false)          

(alias) isContentEncodingBinary(contentEncoding: string | null): boolean import isContentEncodingBinary

expect(isContentEncodingBinary('unknown')).toBe(false)          

(alias) isContentEncodingBinary(contentEncoding: string | null): boolean import isContentEncodingBinary

}) }) describe('EventProcessor.createRequest', () => { it('Should return valid Request object from version 1.0 API Gateway event', () => { const event:

const event: LambdaEvent

LambdaEvent = {          

(alias) type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent import LambdaEvent

version: '1.0',          

(property) APIGatewayProxyEvent.version: string

resource: '/my/path',          

(property) APIGatewayProxyEvent.resource: string

path: '/my/path',          

(property) path: string

httpMethod: 'GET',          

(property) httpMethod: string

headers: {          

(property) headers: { 'content-type': string; header1: string; header2: string; }

'content-type': 'application/json', header1: 'value1',          

(property) header1: string

header2: 'value1',          

(property) header2: string

}, multiValueHeaders: {          

(property) multiValueHeaders: { header1: string[]; header2: string[]; }

header1: ['value1'],          

(property) header1: string[]

header2: ['value1', 'value2', 'value3'],          

(property) header2: string[]

}, queryStringParameters: {          

(property) queryStringParameters: { parameter2: string; }

parameter2: 'value',          

(property) parameter2: string

}, multiValueQueryStringParameters: {          

(property) multiValueQueryStringParameters: { parameter1: string[]; parameter2: string[]; }

parameter1: ['value1', 'value2'],          

(property) parameter1: string[]

parameter2: ['value'],          

(property) parameter2: string[]

}, requestContext: {          

(property) requestContext: { accountId: string; apiId: string; authorizer: { claims: null; scopes: null; }; domainName: string; domainPrefix: string; extendedRequestId: string; httpMethod: string; identity: { sourceIp: string; userAgent: string; clientCert: { ...; }; }; ... 6 more ...; stage: string; }

accountId: '123456789012',          

(property) accountId: string

apiId: 'id',          

(property) apiId: string

authorizer: {          

(property) authorizer: { claims: null; scopes: null; }

claims: null,          

(property) claims?: unknown

scopes: null,          

(property) scopes?: unknown

}, domainName: 'id.execute-api.us-east-1.amazonaws.com',          

(property) domainName: string

domainPrefix: 'id',          

(property) domainPrefix: string

extendedRequestId: 'request-id',          

(property) ApiGatewayRequestContext.extendedRequestId: string

httpMethod: 'GET',          

(property) ApiGatewayRequestContext.httpMethod: string

identity: {          

(property) ApiGatewayRequestContext.identity: Identity

sourceIp: '192.0.2.1',          

(property) Identity.sourceIp: string

userAgent: 'user-agent',          

(property) Identity.userAgent: string

clientCert: {          

(property) Identity.clientCert?: ClientCert | undefined

clientCertPem: 'CERT_CONTENT',          

(property) ClientCert.clientCertPem: string

subjectDN: 'www.example.com',          

(property) ClientCert.subjectDN: string

issuerDN: 'Example issuer',          

(property) ClientCert.issuerDN: string

serialNumber: 'a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1',          

(property) ClientCert.serialNumber: string

validity: {          

(property) ClientCert.validity: { notBefore: string; notAfter: string; }

notBefore: 'May 28 12:30:02 2019 GMT',          

(property) notBefore: string

notAfter: 'Aug 5 09:36:04 2021 GMT',          

(property) notAfter: string

}, }, }, path: '/my/path',          

(property) ApiGatewayRequestContext.path: string

protocol: 'HTTP/1.1',          

(property) ApiGatewayRequestContext.protocol: string

requestId: 'id=',          

(property) requestId: string

requestTime: '04/Mar/2020:19:15:17 +0000',          

(property) ApiGatewayRequestContext.requestTime: string

requestTimeEpoch: 1583349317135,          

(property) ApiGatewayRequestContext.requestTimeEpoch: number

resourcePath: '/my/path',          

(property) ApiGatewayRequestContext.resourcePath: string

stage: '$default',          

(property) stage: string

}, pathParameters: {},          

(property) APIGatewayProxyEvent.pathParameters?: Record<string, string> | undefined

stageVariables: {},          

(property) APIGatewayProxyEvent.stageVariables?: Record<string, string> | undefined

body: null,          

(property) body: null

isBase64Encoded: false,          

(property) isBase64Encoded: false

} const processor =

const processor: EventProcessor<LambdaEvent>

getProcessor

(alias) getProcessor(event: LambdaEvent): EventProcessor<LambdaEvent> import getProcessor

(event)          

const event: APIGatewayProxyEvent

const request =

const request: Request

processor

const processor: EventProcessor<LambdaEvent>

.createRequest

(method) EventProcessor<LambdaEvent>.createRequest(event: LambdaEvent): Request

(event)          

const event: APIGatewayProxyEvent

expect(request

const request: Request

.method).toEqual('GET')          

(property) Request.method: string Returns request's HTTP method, which is "GET" by default.

MDN Reference

expect(request

const request: Request

.url).toEqual(          

(property) Request.url: string Returns the URL of request as a string.

MDN Reference

'https://id.execute-api.us-east-1.amazonaws.com/my/path?parameter2=value' ) expect(Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.fromEntries

(method) ObjectConstructor.fromEntries<string>(entries: Iterable<readonly [PropertyKey, string]>): { [k: string]: string; } (+1 overload) Returns an object created by key-value entries for properties and methods

@param entries — An iterable object that contains key-value entries for properties and methods.

(request

const request: Request

.headers)).toEqual({          

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

'content-type': 'application/json', header1: 'value1',          

(property) header1: string

header2: 'value1, value2, value3',          

(property) header2: string

}) }) it('Should return valid Request object from version 2.0 API Gateway event', () => { const event:

const event: LambdaEvent

LambdaEvent = {          

(alias) type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent import LambdaEvent

version: '2.0',          

(property) version: string

routeKey: '$default',          

(property) APIGatewayProxyEventV2.routeKey: string

rawPath: '/my/path',          

(property) APIGatewayProxyEventV2.rawPath: string

rawQueryString: 'parameter1=value1¶meter1=value2¶meter2=value',          

(property) APIGatewayProxyEventV2.rawQueryString: string

cookies: ['cookie1', 'cookie2'],          

(property) APIGatewayProxyEventV2.cookies?: string[] | undefined

headers: {          

(property) headers: { 'content-type': string; header1: string; header2: string; }

'content-type': 'application/json', header1: 'value1',          

(property) header1: string

header2: 'value1,value2',          

(property) header2: string

}, queryStringParameters: {          

(property) queryStringParameters: { parameter1: string; parameter2: string; }

parameter1: 'value1,value2',          

(property) parameter1: string

parameter2: 'value',          

(property) parameter2: string

}, requestContext: {          

(property) requestContext: { accountId: string; apiId: string; authentication: null; authorizer: {}; domainName: string; domainPrefix: string; http: { method: string; path: string; protocol: string; sourceIp: string; userAgent: string; }; ... 4 more ...; timeEpoch: number; }

accountId: '123456789012',          

(property) accountId: string

apiId: 'api-id',          

(property) apiId: string

authentication: null,          

(property) ApiGatewayRequestContextV2.authentication: null

authorizer: {},          

(property) authorizer: {}

domainName: 'id.execute-api.us-east-1.amazonaws.com',          

(property) domainName: string

domainPrefix: 'id',          

(property) domainPrefix: string

http: {          

(property) ApiGatewayRequestContextV2.http: { method: string; path: string; protocol: string; sourceIp: string; userAgent: string; }

method: 'POST',          

(property) method: string

path: '/my/path',          

(property) path: string

protocol: 'HTTP/1.1',          

(property) protocol: string

sourceIp: '192.0.2.1',          

(property) sourceIp: string

userAgent: 'agent',          

(property) userAgent: string

}, requestId: 'id',          

(property) requestId: string

routeKey: '$default',          

(property) ApiGatewayRequestContextV2.routeKey: string

stage: '$default',          

(property) stage: string

time: '12/Mar/2020:19:03:58 +0000',          

(property) ApiGatewayRequestContextV2.time: string

timeEpoch: 1583348638390,          

(property) ApiGatewayRequestContextV2.timeEpoch: number

}, body: 'Hello from Lambda',          

(property) body: string

pathParameters: {          

(property) pathParameters: { parameter1: string; }

parameter1: 'value1',          

(property) parameter1: string

}, isBase64Encoded: false,          

(property) isBase64Encoded: false

stageVariables: {          

(property) stageVariables: { stageVariable1: string; stageVariable2: string; }

stageVariable1: 'value1',          

(property) stageVariable1: string

stageVariable2: 'value2',          

(property) stageVariable2: string

}, } const processor =

const processor: EventProcessor<LambdaEvent>

getProcessor

(alias) getProcessor(event: LambdaEvent): EventProcessor<LambdaEvent> import getProcessor

(event)          

const event: APIGatewayProxyEventV2

const request =

const request: Request

processor

const processor: EventProcessor<LambdaEvent>

.createRequest

(method) EventProcessor<LambdaEvent>.createRequest(event: LambdaEvent): Request

(event)          

const event: APIGatewayProxyEventV2

expect(request

const request: Request

.method).toEqual('POST')          

(property) Request.method: string Returns request's HTTP method, which is "GET" by default.

MDN Reference

expect(request

const request: Request

.url).toEqual(          

(property) Request.url: string Returns the URL of request as a string.

MDN Reference

'https://id.execute-api.us-east-1.amazonaws.com/my/path?parameter1=value1¶meter1=value2¶meter2=value' ) expect(Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.fromEntries

(method) ObjectConstructor.fromEntries<string>(entries: Iterable<readonly [PropertyKey, string]>): { [k: string]: string; } (+1 overload) Returns an object created by key-value entries for properties and methods

@param entries — An iterable object that contains key-value entries for properties and methods.

(request

const request: Request

.headers)).toEqual({          

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

'content-type': 'application/json', cookie: 'cookie1; cookie2',          

(property) cookie: string

header1: 'value1',          

(property) header1: string

header2: 'value1,value2',          

(property) header2: string

}) }) })
src/adapter/aws-lambda/handler.ts
            
                import crypto from 'node:crypto'
                import type { Hono } from '../../hono'
                import type { Env, Schema } from '../../types'
                import { decodeBase64, encodeBase64 } from '../../utils/encode'
                import type {
                  ALBRequestContext,
                  ApiGatewayRequestContext,
                  ApiGatewayRequestContextV2,
                  Handler,
                  LambdaContext,
                } from './types'
                
                // eslint-disable-next-line @typescript-eslint/ban-ts-comment
                // @ts-ignore
                globalThis.crypto ??= crypto          

var crypto: Crypto MDN Reference

export type LambdaEvent =

type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent

APIGatewayProxyEvent |

interface APIGatewayProxyEvent

APIGatewayProxyEventV2 |

interface APIGatewayProxyEventV2

ALBProxyEvent          

interface ALBProxyEvent

// When calling HTTP API or Lambda directly through function urls export interface APIGatewayProxyEventV2 {          

interface APIGatewayProxyEventV2

version: string          

(property) APIGatewayProxyEventV2.version: string

routeKey: string          

(property) APIGatewayProxyEventV2.routeKey: string

headers:

(property) APIGatewayProxyEventV2.headers: Record<string, string | undefined>

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

multiValueHeaders?: undefined          

(property) APIGatewayProxyEventV2.multiValueHeaders?: undefined

cookies?: string[]          

(property) APIGatewayProxyEventV2.cookies?: string[] | undefined

rawPath: string          

(property) APIGatewayProxyEventV2.rawPath: string

rawQueryString: string          

(property) APIGatewayProxyEventV2.rawQueryString: string

body: string | null          

(property) APIGatewayProxyEventV2.body: string | null

isBase64Encoded: boolean          

(property) APIGatewayProxyEventV2.isBase64Encoded: boolean

requestContext:

(property) APIGatewayProxyEventV2.requestContext: ApiGatewayRequestContextV2

ApiGatewayRequestContextV2          

(alias) interface ApiGatewayRequestContextV2 import ApiGatewayRequestContextV2

queryStringParameters?: {          

(property) APIGatewayProxyEventV2.queryStringParameters?: { [name: string]: string | undefined; } | undefined

[name: string]: string | undefined          

(parameter) name: string

} pathParameters?: {          

(property) APIGatewayProxyEventV2.pathParameters?: { [name: string]: string | undefined; } | undefined

[name: string]: string | undefined          

(parameter) name: string

} stageVariables?: {          

(property) APIGatewayProxyEventV2.stageVariables?: { [name: string]: string | undefined; } | undefined

[name: string]: string | undefined          

(parameter) name: string

} } // When calling Lambda through an API Gateway export interface APIGatewayProxyEvent {          

interface APIGatewayProxyEvent

version: string          

(property) APIGatewayProxyEvent.version: string

httpMethod: string          

(property) APIGatewayProxyEvent.httpMethod: string

headers:

(property) APIGatewayProxyEvent.headers: Record<string, string | undefined>

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

multiValueHeaders?: {          

(property) APIGatewayProxyEvent.multiValueHeaders?: { [headerKey: string]: string[]; } | undefined

[headerKey: string]: string[]          

(parameter) headerKey: string

} path: string          

(property) APIGatewayProxyEvent.path: string

body: string | null          

(property) APIGatewayProxyEvent.body: string | null

isBase64Encoded: boolean          

(property) APIGatewayProxyEvent.isBase64Encoded: boolean

queryStringParameters?:

(property) APIGatewayProxyEvent.queryStringParameters?: Record<string, string | undefined> | undefined

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

requestContext:

(property) APIGatewayProxyEvent.requestContext: ApiGatewayRequestContext

ApiGatewayRequestContext          

(alias) interface ApiGatewayRequestContext import ApiGatewayRequestContext

resource: string          

(property) APIGatewayProxyEvent.resource: string

multiValueQueryStringParameters?: {          

(property) APIGatewayProxyEvent.multiValueQueryStringParameters?: { [parameterKey: string]: string[]; } | undefined

[parameterKey: string]: string[]          

(parameter) parameterKey: string

} pathParameters?:

(property) APIGatewayProxyEvent.pathParameters?: Record<string, string> | undefined

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

stageVariables?:

(property) APIGatewayProxyEvent.stageVariables?: Record<string, string> | undefined

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

} // When calling Lambda through an Application Load Balancer export interface ALBProxyEvent {          

interface ALBProxyEvent

httpMethod: string          

(property) ALBProxyEvent.httpMethod: string

headers?:

(property) ALBProxyEvent.headers?: Record<string, string | undefined> | undefined

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

multiValueHeaders?:

(property) ALBProxyEvent.multiValueHeaders?: Record<string, string[] | undefined> | undefined

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

path: string          

(property) ALBProxyEvent.path: string

body: string | null          

(property) ALBProxyEvent.body: string | null

isBase64Encoded: boolean          

(property) ALBProxyEvent.isBase64Encoded: boolean

queryStringParameters?:

(property) ALBProxyEvent.queryStringParameters?: Record<string, string | undefined> | undefined

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

multiValueQueryStringParameters?: {          

(property) ALBProxyEvent.multiValueQueryStringParameters?: { [parameterKey: string]: string[]; } | undefined

[parameterKey: string]: string[]          

(parameter) parameterKey: string

} requestContext:

(property) ALBProxyEvent.requestContext: ALBRequestContext

ALBRequestContext          

(alias) interface ALBRequestContext import ALBRequestContext

} export interface APIGatewayProxyResult {          

interface APIGatewayProxyResult

statusCode: number          

(property) APIGatewayProxyResult.statusCode: number

statusDescription?: string          

(property) APIGatewayProxyResult.statusDescription?: string | undefined

body: string          

(property) APIGatewayProxyResult.body: string

headers:

(property) APIGatewayProxyResult.headers: Record<string, string>

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

cookies?: string[]          

(property) APIGatewayProxyResult.cookies?: string[] | undefined

multiValueHeaders?: {          

(property) APIGatewayProxyResult.multiValueHeaders?: { [headerKey: string]: string[]; } | undefined

[headerKey: string]: string[]          

(parameter) headerKey: string

} isBase64Encoded: boolean          

(property) APIGatewayProxyResult.isBase64Encoded: boolean

} const getRequestContext = (          

const getRequestContext: (event: LambdaEvent) => ApiGatewayRequestContext | ApiGatewayRequestContextV2 | ALBRequestContext

event:

(parameter) event: LambdaEvent

LambdaEvent          

type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent

): ApiGatewayRequestContext |

(alias) interface ApiGatewayRequestContext import ApiGatewayRequestContext

ApiGatewayRequestContextV2 |

(alias) interface ApiGatewayRequestContextV2 import ApiGatewayRequestContextV2

ALBRequestContext => {          

(alias) interface ALBRequestContext import ALBRequestContext

return event

(parameter) event: LambdaEvent

.requestContext          

(property) requestContext: ApiGatewayRequestContext | ApiGatewayRequestContextV2 | ALBRequestContext

} const streamToNodeStream = async (          

const streamToNodeStream: (reader: ReadableStreamDefaultReader<Uint8Array>, writer: NodeJS.WritableStream) => Promise<void>

reader:

(parameter) reader: ReadableStreamDefaultReader<Uint8Array>

ReadableStreamDefaultReader

interface ReadableStreamDefaultReader<R = any> MDN Reference

<Uint8Array>,          

interface Uint8Array A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.

writer:

(parameter) writer: NodeJS.WritableStream

NodeJS.WritableStream          

type NodeJS.WritableStream = /*unresolved*/ any

): Promise => {          

interface Promise<T> Represents the completion of an asynchronous operation

let readResult = await

let readResult: ReadableStreamReadResult<Uint8Array>

reader

(parameter) reader: ReadableStreamDefaultReader<Uint8Array>

.read()          

(method) ReadableStreamDefaultReader<Uint8Array>.read(): Promise<ReadableStreamReadResult<Uint8Array>> MDN Reference

while (!readResult

let readResult: ReadableStreamReadResult<Uint8Array>

.done) {          

(property) done: boolean

writer.write

(parameter) writer: NodeJS.WritableStream

(readResult

let readResult: ReadableStreamReadValueResult<Uint8Array>

.value)          

(property) ReadableStreamReadValueResult<Uint8Array>.value: Uint8Array

readResult = await

let readResult: ReadableStreamReadResult<Uint8Array>

reader

(parameter) reader: ReadableStreamDefaultReader<Uint8Array>

.read()          

(method) ReadableStreamDefaultReader<Uint8Array>.read(): Promise<ReadableStreamReadResult<Uint8Array>> MDN Reference

} writer.end()          

(parameter) writer: NodeJS.WritableStream

} export const streamHandle = <          

const streamHandle: <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>) => Handler

E extends

(type parameter) E in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>): Handler

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env,          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

S extends

(type parameter) S in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>): Handler

Schema = {},          

(alias) type Schema = { [Path: string]: { [Method: `$${Lowercase<string>}`]: Endpoint; }; } import Schema

BasePath extends string = '/'          

(type parameter) BasePath in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>): Handler

>( app:

(parameter) app: Hono<E, S, BasePath>

Hono

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

<E,

(type parameter) E in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>): Handler

S,

(type parameter) S in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>): Handler

BasePath>          

(type parameter) BasePath in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>): Handler

): Handler => {          

(alias) type Handler<TEvent = any, TResult = any> = (event: TEvent, context: LambdaContext, callback: Callback<TResult>) => void | Promise<TResult> import Handler

// @ts-expect-error awslambda is not a standard API return awslambda.streamifyResponse( async (event:

(parameter) event: LambdaEvent

LambdaEvent,

type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent

responseStream:

(parameter) responseStream: NodeJS.WritableStream

NodeJS.WritableStream,

type NodeJS.WritableStream = /*unresolved*/ any

context:

(parameter) context: LambdaContext

LambdaContext) => {          

(alias) interface LambdaContext import LambdaContext Handler context parameter. See AWS documentation.

const processor =

const processor: EventProcessor<LambdaEvent>

getProcessor

const getProcessor: (event: LambdaEvent) => EventProcessor<LambdaEvent>

(event)          

(parameter) event: LambdaEvent

try { const req =

const req: Request

processor

const processor: EventProcessor<LambdaEvent>

.createRequest

(method) EventProcessor<LambdaEvent>.createRequest(event: LambdaEvent): Request

(event)          

(parameter) event: LambdaEvent

const requestContext =

const requestContext: ApiGatewayRequestContext | ApiGatewayRequestContextV2 | ALBRequestContext

getRequestContext

const getRequestContext: (event: LambdaEvent) => ApiGatewayRequestContext | ApiGatewayRequestContextV2 | ALBRequestContext

(event)          

(parameter) event: LambdaEvent

const res = await

const res: Response

app

(parameter) app: Hono<E, S, BasePath>

.fetch

(property) Hono<E, S, BasePath>.fetch: (request: Request, Env?: {} | E["Bindings"] | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .fetch() will be entry point of your app.

@see — https://hono.dev/docs/api/hono#fetch

@param request — request Object of request

@param Env — env Object

@param — - context of execution

@returns — response of request

(req, {          

const req: Request

event,          

(property) event: LambdaEvent

requestContext,          

(property) requestContext: ApiGatewayRequestContext | ApiGatewayRequestContextV2 | ALBRequestContext

context,          

(property) context: LambdaContext

}) const headers:

const headers: Record<string, string>

Record = {}          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

const cookies: string[] = []          

const cookies: string[]

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.forEach(

(method) Headers.forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void

(value,

(parameter) value: string

name) => {          

(parameter) name: string

if (name === 'set-cookie') {          

(parameter) name: string

cookies

const cookies: string[]

.push

(method) Array<string>.push(...items: string[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(value)          

(parameter) value: string

} else { headers

const headers: Record<string, string>

[name] =

(parameter) name: string

value          

(parameter) value: string

} }) // Check content type const httpResponseMetadata = {          

const httpResponseMetadata: { statusCode: number; headers: Record<string, string>; cookies: string[]; }

statusCode:

(property) statusCode: number

res

const res: Response

.status,          

(property) Response.status: number MDN Reference

headers,          

(property) headers: Record<string, string>

cookies,          

(property) cookies: string[]

} // Update response stream // @ts-expect-error awslambda is not a standard API responseStream = awslambda.HttpResponseStream.from

(parameter) responseStream: NodeJS.WritableStream

(responseStream,

(parameter) responseStream: NodeJS.WritableStream

httpResponseMetadata)          

const httpResponseMetadata: { statusCode: number; headers: Record<string, string>; cookies: string[]; }

if (res

const res: Response

.body) {          

(property) Body.body: ReadableStream<Uint8Array> | null MDN Reference

await streamToNodeStream

const streamToNodeStream: (reader: ReadableStreamDefaultReader<Uint8Array>, writer: NodeJS.WritableStream) => Promise<void>

(res

const res: Response

.body

(property) Body.body: ReadableStream<Uint8Array> MDN Reference

.getReader(),

(method) ReadableStream<Uint8Array>.getReader(): ReadableStreamDefaultReader<Uint8Array> (+2 overloads) MDN Reference

responseStream)          

(parameter) responseStream: NodeJS.WritableStream

} else { responseStream.write('')          

(parameter) responseStream: NodeJS.WritableStream

} } catch (error) {          

(local var) error: unknown

console

var console: Console

.error('Error processing request:',

(method) Console.error(...data: any[]): void MDN Reference

error)          

(local var) error: unknown

responseStream.write('Internal Server Error')          

(parameter) responseStream: NodeJS.WritableStream

} finally { responseStream.end()          

(parameter) responseStream: NodeJS.WritableStream

} } ) } /** * Accepts events from API Gateway/ELB(`APIGatewayProxyEvent`) and directly through Function Url(`APIGatewayProxyEventV2`) */ export const handle =

const handle: <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>) => ((event: LambdaEvent, lambdaContext?: LambdaContext) => Promise<APIGatewayProxyResult>) Accepts events from API Gateway/ELB(APIGatewayProxyEvent) and directly through Function Url(APIGatewayProxyEventV2)

<E extends

(type parameter) E in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>): ((event: LambdaEvent, lambdaContext?: LambdaContext) => Promise<APIGatewayProxyResult>)

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env,

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

S extends

(type parameter) S in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>): ((event: LambdaEvent, lambdaContext?: LambdaContext) => Promise<APIGatewayProxyResult>)

Schema = {},

(alias) type Schema = { [Path: string]: { [Method: `$${Lowercase<string>}`]: Endpoint; }; } import Schema

BasePath extends string = '/'>(          

(type parameter) BasePath in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>): ((event: LambdaEvent, lambdaContext?: LambdaContext) => Promise<APIGatewayProxyResult>)

app:

(parameter) app: Hono<E, S, BasePath>

Hono

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

<E,

(type parameter) E in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>): ((event: LambdaEvent, lambdaContext?: LambdaContext) => Promise<APIGatewayProxyResult>)

S,

(type parameter) S in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>): ((event: LambdaEvent, lambdaContext?: LambdaContext) => Promise<APIGatewayProxyResult>)

BasePath>          

(type parameter) BasePath in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>): ((event: LambdaEvent, lambdaContext?: LambdaContext) => Promise<APIGatewayProxyResult>)

): ((event:

(parameter) event: LambdaEvent

LambdaEvent,

type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent

lambdaContext?:

(parameter) lambdaContext: LambdaContext | undefined

LambdaContext) =>

(alias) interface LambdaContext import LambdaContext Handler context parameter. See AWS documentation.

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<APIGatewayProxyResult>) => {          

interface APIGatewayProxyResult

return async (event,

(parameter) event: LambdaEvent

lambdaContext?) => {          

(parameter) lambdaContext: LambdaContext | undefined

const processor =

const processor: EventProcessor<LambdaEvent>

getProcessor

const getProcessor: (event: LambdaEvent) => EventProcessor<LambdaEvent>

(event)          

(parameter) event: LambdaEvent

const req =

const req: Request

processor

const processor: EventProcessor<LambdaEvent>

.createRequest

(method) EventProcessor<LambdaEvent>.createRequest(event: LambdaEvent): Request

(event)          

(parameter) event: LambdaEvent

const requestContext =

const requestContext: ApiGatewayRequestContext | ApiGatewayRequestContextV2 | ALBRequestContext

getRequestContext

const getRequestContext: (event: LambdaEvent) => ApiGatewayRequestContext | ApiGatewayRequestContextV2 | ALBRequestContext

(event)          

(parameter) event: LambdaEvent

const res = await

const res: Response

app

(parameter) app: Hono<E, S, BasePath>

.fetch

(property) Hono<E, S, BasePath>.fetch: (request: Request, Env?: {} | E["Bindings"] | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .fetch() will be entry point of your app.

@see — https://hono.dev/docs/api/hono#fetch

@param request — request Object of request

@param Env — env Object

@param — - context of execution

@returns — response of request

(req, {          

const req: Request

event,          

(property) event: LambdaEvent

requestContext,          

(property) requestContext: ApiGatewayRequestContext | ApiGatewayRequestContextV2 | ALBRequestContext

lambdaContext,          

(property) lambdaContext: LambdaContext | undefined

}) return processor

const processor: EventProcessor<LambdaEvent>

.createResult

(method) EventProcessor<LambdaEvent>.createResult(event: LambdaEvent, res: Response): Promise<APIGatewayProxyResult>

(event,

(parameter) event: LambdaEvent

res)          

const res: Response

} } abstract class EventProcessor

class EventProcessor<E extends LambdaEvent>

<E extends

(type parameter) E in EventProcessor<E extends LambdaEvent>

LambdaEvent> {          

type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent

protected abstract getPath

(method) EventProcessor<E extends LambdaEvent>.getPath(event: E): string

(event:

(parameter) event: E extends LambdaEvent

E): string          

(type parameter) E in EventProcessor<E extends LambdaEvent>

protected abstract getMethod

(method) EventProcessor<E extends LambdaEvent>.getMethod(event: E): string

(event:

(parameter) event: E extends LambdaEvent

E): string          

(type parameter) E in EventProcessor<E extends LambdaEvent>

protected abstract getQueryString

(method) EventProcessor<E extends LambdaEvent>.getQueryString(event: E): string

(event:

(parameter) event: E extends LambdaEvent

E): string          

(type parameter) E in EventProcessor<E extends LambdaEvent>

protected abstract getHeaders

(method) EventProcessor<E extends LambdaEvent>.getHeaders(event: E): Headers

(event:

(parameter) event: E extends LambdaEvent

E):

(type parameter) E in EventProcessor<E extends LambdaEvent>

Headers          

interface Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

protected abstract getCookies

(method) EventProcessor<E extends LambdaEvent>.getCookies(event: E, headers: Headers): void

(event:

(parameter) event: E extends LambdaEvent

E,

(type parameter) E in EventProcessor<E extends LambdaEvent>

headers:

(parameter) headers: Headers

Headers): void          

interface Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

protected abstract setCookiesToResult(          

(method) EventProcessor<E extends LambdaEvent>.setCookiesToResult(event: E, result: APIGatewayProxyResult, cookies: string[]): void

event:

(parameter) event: E extends LambdaEvent

E,          

(type parameter) E in EventProcessor<E extends LambdaEvent>

result:

(parameter) result: APIGatewayProxyResult

APIGatewayProxyResult,          

interface APIGatewayProxyResult

cookies: string[]          

(parameter) cookies: string[]

): void createRequest

(method) EventProcessor<E extends LambdaEvent>.createRequest(event: E): Request

(event:

(parameter) event: E extends LambdaEvent

E):

(type parameter) E in EventProcessor<E extends LambdaEvent>

Request {          

interface Request This Fetch API interface represents a resource request.

MDN Reference

const queryString = this

const queryString: string

.getQueryString

(method) EventProcessor<E extends LambdaEvent>.getQueryString(event: E): string

(event)          

(parameter) event: E extends LambdaEvent

const domainName =          

const domainName: string | undefined

event

(parameter) event: LambdaEvent

.requestContext && 'domainName' in

(property) requestContext: ApiGatewayRequestContext | ApiGatewayRequestContextV2 | ALBRequestContext

event

(parameter) event: LambdaEvent

.requestContext          

(property) requestContext: ApiGatewayRequestContext | ApiGatewayRequestContextV2 | ALBRequestContext

? event

(parameter) event: LambdaEvent

.requestContext

(property) requestContext: ApiGatewayRequestContext | ApiGatewayRequestContextV2

.domainName          

(property) domainName: string

: event

(parameter) event: LambdaEvent

.headers?.['host'] ??

(property) headers?: Record<string, string | undefined> | undefined

event

(parameter) event: LambdaEvent

.multiValueHeaders?.['host']?.[0]          

(property) multiValueHeaders?: { [headerKey: string]: string[]; } | Record<string, string[] | undefined> | undefined

const path = this

const path: string

.getPath

(method) EventProcessor<E extends LambdaEvent>.getPath(event: E): string

(event)          

(parameter) event: E extends LambdaEvent

const urlPath = `https://$

const urlPath: string

{domainName}$

const domainName: string | undefined

{path}`          

const path: string

const url =

const url: string

queryString ? `$

const queryString: string

{urlPath}?$

const urlPath: string

{queryString}` :

const queryString: string

urlPath          

const urlPath: string

const headers = this

const headers: Headers

.getHeaders

(method) EventProcessor<E extends LambdaEvent>.getHeaders(event: E): Headers

(event)          

(parameter) event: E extends LambdaEvent

const method = this

const method: string

.getMethod

(method) EventProcessor<E extends LambdaEvent>.getMethod(event: E): string

(event)          

(parameter) event: E extends LambdaEvent

const requestInit:

const requestInit: RequestInit

RequestInit = {          

interface RequestInit

headers,          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

method,          

(property) RequestInit.method?: string | undefined A string to set request's method.

} if (event

(parameter) event: LambdaEvent

.body) {          

(property) body: string | null

requestInit

const requestInit: RequestInit

.body =

(property) RequestInit.body?: BodyInit | null | undefined A BodyInit object or null to set request's body.

event

(parameter) event: LambdaEvent

.isBase64Encoded ?

(property) isBase64Encoded: boolean

decodeBase64

(alias) decodeBase64(str: string): Uint8Array import decodeBase64

(event

(parameter) event: LambdaEvent

.body) :

(property) body: string

event

(parameter) event: LambdaEvent

.body          

(property) body: string

} return new Request

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

(url,

const url: string

requestInit)          

const requestInit: RequestInit

} async createResult

(method) EventProcessor<E extends LambdaEvent>.createResult(event: E, res: Response): Promise<APIGatewayProxyResult>

(event:

(parameter) event: E extends LambdaEvent

E,

(type parameter) E in EventProcessor<E extends LambdaEvent>

res:

(parameter) res: Response

Response):

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<APIGatewayProxyResult> {          

interface APIGatewayProxyResult

const contentType =

const contentType: string | null

res

(parameter) res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('content-type')          

(method) Headers.get(name: string): string | null MDN Reference

let isBase64Encoded =

let isBase64Encoded: boolean

contentType &&

const contentType: string | null

isContentTypeBinary

const isContentTypeBinary: (contentType: string) => boolean

(contentType) ? true : false          

const contentType: string

if (!isBase64Encoded) {          

let isBase64Encoded: boolean

const contentEncoding =

const contentEncoding: string | null

res

(parameter) res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('content-encoding')          

(method) Headers.get(name: string): string | null MDN Reference

isBase64Encoded =

let isBase64Encoded: boolean

isContentEncodingBinary

const isContentEncodingBinary: (contentEncoding: string | null) => boolean

(contentEncoding)          

const contentEncoding: string | null

} const body =

const body: string

isBase64Encoded ?

let isBase64Encoded: boolean

encodeBase64(await

(alias) encodeBase64(buf: ArrayBufferLike): string import encodeBase64

res

(parameter) res: Response

.arrayBuffer()) : await

(method) Body.arrayBuffer(): Promise<ArrayBuffer> MDN Reference

res

(parameter) res: Response

.text()          

(method) Body.text(): Promise<string> MDN Reference

const result:

const result: APIGatewayProxyResult

APIGatewayProxyResult = {          

interface APIGatewayProxyResult

body:

(property) APIGatewayProxyResult.body: string

body,          

const body: string

headers: {},          

(property) APIGatewayProxyResult.headers: Record<string, string>

multiValueHeaders:

(property) APIGatewayProxyResult.multiValueHeaders?: { [headerKey: string]: string[]; } | undefined

event

(parameter) event: LambdaEvent

.multiValueHeaders ? {} : undefined,          

(property) multiValueHeaders?: { [headerKey: string]: string[]; } | Record<string, string[] | undefined> | undefined

statusCode:

(property) APIGatewayProxyResult.statusCode: number

res

(parameter) res: Response

.status,          

(property) Response.status: number MDN Reference

isBase64Encoded,          

(property) APIGatewayProxyResult.isBase64Encoded: boolean

} this.setCookies

(method) EventProcessor<E extends LambdaEvent>.setCookies(event: E, res: Response, result: APIGatewayProxyResult): void

(event,

(parameter) event: E extends LambdaEvent

res,

(parameter) res: Response

result)          

const result: APIGatewayProxyResult

res

(parameter) res: Response

.headers

(property) Response.headers: Headers MDN Reference

.forEach(

(method) Headers.forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void

(value,

(parameter) value: string

key) => {          

(parameter) key: string

result

const result: APIGatewayProxyResult

.headers

(property) APIGatewayProxyResult.headers: Record<string, string>

[key] =

(parameter) key: string

value          

(parameter) value: string

if (event

(parameter) event: LambdaEvent

.multiValueHeaders &&

(property) multiValueHeaders?: { [headerKey: string]: string[]; } | Record<string, string[] | undefined> | undefined

result

const result: APIGatewayProxyResult

.multiValueHeaders) {          

(property) APIGatewayProxyResult.multiValueHeaders?: { [headerKey: string]: string[]; } | undefined

result

const result: APIGatewayProxyResult

.multiValueHeaders

(property) APIGatewayProxyResult.multiValueHeaders?: { [headerKey: string]: string[]; }

[key] =

(parameter) key: string

[value]          

(parameter) value: string

} }) return result          

const result: APIGatewayProxyResult

} setCookies

(method) EventProcessor<E extends LambdaEvent>.setCookies(event: E, res: Response, result: APIGatewayProxyResult): void

(event:

(parameter) event: E extends LambdaEvent

E,

(type parameter) E in EventProcessor<E extends LambdaEvent>

res:

(parameter) res: Response

Response,

interface Response This Fetch API interface represents the response to a request.

MDN Reference

result:

(parameter) result: APIGatewayProxyResult

APIGatewayProxyResult) {          

interface APIGatewayProxyResult

if (res

(parameter) res: Response

.headers

(property) Response.headers: Headers MDN Reference

.has('set-cookie')) {          

(method) Headers.has(name: string): boolean MDN Reference

const cookies =

const cookies: string[]

res

(parameter) res: Response

.headers

(property) Response.headers: Headers MDN Reference

.getSetCookie          

(method) Headers.getSetCookie(): string[] MDN Reference

? res

(parameter) res: Response

.headers

(property) Response.headers: Headers MDN Reference

.getSetCookie()          

(method) Headers.getSetCookie(): string[] MDN Reference

: Array

var Array: ArrayConstructor

.from

(method) ArrayConstructor.from<[string, string]>(iterable: Iterable<[string, string]> | ArrayLike<[string, string]>): [string, string][] (+3 overloads) Creates an array from an iterable object.

@param iterable — An iterable object to convert to an array.

(res

(parameter) res: Response

.headers

(property) Response.headers: Headers MDN Reference

.entries())          

(method) Headers.entries(): HeadersIterator<[string, string]> Returns an iterator allowing to go through all key/value pairs contained in this object.

.filter((

(method) Array<[string, string]>.filter(predicate: (value: [string, string], index: number, array: [string, string][]) => unknown, thisArg?: any): [string, string][] (+1 overload) Returns the elements of an array that meet the condition specified in a callback function.

@param predicate — A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

[k]) =>

(parameter) k: string

k === 'set-cookie')          

(parameter) k: string

.map(([,

(method) Array<[string, string]>.map<string>(callbackfn: (value: [string, string], index: number, array: [string, string][]) => string, thisArg?: any): string[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

v]) =>

(parameter) v: string

v)          

(parameter) v: string

if (Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(cookies)) {          

const cookies: string[]

this.setCookiesToResult

(method) EventProcessor<E extends LambdaEvent>.setCookiesToResult(event: E, result: APIGatewayProxyResult, cookies: string[]): void

(event,

(parameter) event: E extends LambdaEvent

result,

(parameter) result: APIGatewayProxyResult

cookies)          

const cookies: string[]

res

(parameter) res: Response

.headers

(property) Response.headers: Headers MDN Reference

.delete('set-cookie')          

(method) Headers.delete(name: string): void MDN Reference

} } } } class EventV2Processor extends

class EventV2Processor

EventProcessor

class EventProcessor<E extends LambdaEvent>

<APIGatewayProxyEventV2> {          

interface APIGatewayProxyEventV2

protected getPath

(method) EventV2Processor.getPath(event: APIGatewayProxyEventV2): string

(event:

(parameter) event: APIGatewayProxyEventV2

APIGatewayProxyEventV2): string {          

interface APIGatewayProxyEventV2

return event

(parameter) event: APIGatewayProxyEventV2

.rawPath          

(property) APIGatewayProxyEventV2.rawPath: string

} protected getMethod

(method) EventV2Processor.getMethod(event: APIGatewayProxyEventV2): string

(event:

(parameter) event: APIGatewayProxyEventV2

APIGatewayProxyEventV2): string {          

interface APIGatewayProxyEventV2

return event

(parameter) event: APIGatewayProxyEventV2

.requestContext

(property) APIGatewayProxyEventV2.requestContext: ApiGatewayRequestContextV2

.http

(property) ApiGatewayRequestContextV2.http: { method: string; path: string; protocol: string; sourceIp: string; userAgent: string; }

.method          

(property) method: string

} protected getQueryString

(method) EventV2Processor.getQueryString(event: APIGatewayProxyEventV2): string

(event:

(parameter) event: APIGatewayProxyEventV2

APIGatewayProxyEventV2): string {          

interface APIGatewayProxyEventV2

return event

(parameter) event: APIGatewayProxyEventV2

.rawQueryString          

(property) APIGatewayProxyEventV2.rawQueryString: string

} protected getCookies

(method) EventV2Processor.getCookies(event: APIGatewayProxyEventV2, headers: Headers): void

(event:

(parameter) event: APIGatewayProxyEventV2

APIGatewayProxyEventV2,

interface APIGatewayProxyEventV2

headers:

(parameter) headers: Headers

Headers): void {          

interface Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

if (Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(event

(parameter) event: APIGatewayProxyEventV2

.cookies)) {          

(property) APIGatewayProxyEventV2.cookies?: string[] | undefined

headers

(parameter) headers: Headers

.set('Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

event

(parameter) event: APIGatewayProxyEventV2

.cookies

(property) APIGatewayProxyEventV2.cookies?: string[]

.join('; '))          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

} } protected setCookiesToResult(          

(method) EventV2Processor.setCookiesToResult(_: APIGatewayProxyEventV2, result: APIGatewayProxyResult, cookies: string[]): void

_:

(parameter) _: APIGatewayProxyEventV2

APIGatewayProxyEventV2,          

interface APIGatewayProxyEventV2

result:

(parameter) result: APIGatewayProxyResult

APIGatewayProxyResult,          

interface APIGatewayProxyResult

cookies: string[]          

(parameter) cookies: string[]

): void { result

(parameter) result: APIGatewayProxyResult

.cookies =

(property) APIGatewayProxyResult.cookies?: string[] | undefined

cookies          

(parameter) cookies: string[]

} protected getHeaders

(method) EventV2Processor.getHeaders(event: APIGatewayProxyEventV2): Headers

(event:

(parameter) event: APIGatewayProxyEventV2

APIGatewayProxyEventV2):

interface APIGatewayProxyEventV2

Headers {          

interface Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

const headers = new

const headers: Headers

Headers()          

var Headers: new (init?: HeadersInit) => Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

this.getCookies

(method) EventV2Processor.getCookies(event: APIGatewayProxyEventV2, headers: Headers): void

(event,

(parameter) event: APIGatewayProxyEventV2

headers)          

const headers: Headers

if (event

(parameter) event: APIGatewayProxyEventV2

.headers) {          

(property) APIGatewayProxyEventV2.headers: Record<string, string | undefined>

for (const [k,

const k: string

v] of

const v: string | undefined

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string | undefined>(o: { [s: string]: string | undefined; } | ArrayLike<string | undefined>): [string, string | undefined][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(event

(parameter) event: APIGatewayProxyEventV2

.headers)) {          

(property) APIGatewayProxyEventV2.headers: Record<string, string | undefined>

if (v) {          

const v: string | undefined

headers

const headers: Headers

.set

(method) Headers.set(name: string, value: string): void MDN Reference

(k,

const k: string

v)          

const v: string

} } } return headers          

const headers: Headers

} } const v2Processor:

const v2Processor: EventV2Processor

EventV2Processor = new

class EventV2Processor

EventV2Processor()          

constructor EventV2Processor<APIGatewayProxyEventV2>(): EventV2Processor

class EventV1Processor extends

class EventV1Processor

EventProcessor

class EventProcessor<E extends LambdaEvent>

<Exclude

type Exclude<T, U> = T extends U ? never : T Exclude from T those types that are assignable to U

<LambdaEvent,

type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent

APIGatewayProxyEventV2>> {          

interface APIGatewayProxyEventV2

protected getPath

(method) EventV1Processor.getPath(event: Exclude<LambdaEvent, APIGatewayProxyEventV2>): string

(event:

(parameter) event: APIGatewayProxyEvent | ALBProxyEvent

Exclude

type Exclude<T, U> = T extends U ? never : T Exclude from T those types that are assignable to U

<LambdaEvent,

type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent

APIGatewayProxyEventV2>): string {          

interface APIGatewayProxyEventV2

return event

(parameter) event: APIGatewayProxyEvent | ALBProxyEvent

.path          

(property) path: string

} protected getMethod

(method) EventV1Processor.getMethod(event: Exclude<LambdaEvent, APIGatewayProxyEventV2>): string

(event:

(parameter) event: APIGatewayProxyEvent | ALBProxyEvent

Exclude

type Exclude<T, U> = T extends U ? never : T Exclude from T those types that are assignable to U

<LambdaEvent,

type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent

APIGatewayProxyEventV2>): string {          

interface APIGatewayProxyEventV2

return event

(parameter) event: APIGatewayProxyEvent | ALBProxyEvent

.httpMethod          

(property) httpMethod: string

} protected getQueryString

(method) EventV1Processor.getQueryString(event: Exclude<LambdaEvent, APIGatewayProxyEventV2>): string

(event:

(parameter) event: APIGatewayProxyEvent | ALBProxyEvent

Exclude

type Exclude<T, U> = T extends U ? never : T Exclude from T those types that are assignable to U

<LambdaEvent,

type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent

APIGatewayProxyEventV2>): string {          

interface APIGatewayProxyEventV2

return Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string | undefined>(o: { [s: string]: string | undefined; } | ArrayLike<string | undefined>): [string, string | undefined][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(event

(parameter) event: APIGatewayProxyEvent | ALBProxyEvent

.queryStringParameters || {})          

(property) queryStringParameters?: Record<string, string | undefined> | undefined

.filter(([,

(method) Array<[string, string | undefined]>.filter(predicate: (value: [string, string | undefined], index: number, array: [string, string | undefined][]) => unknown, thisArg?: any): [string, string | undefined][] (+1 overload) Returns the elements of an array that meet the condition specified in a callback function.

@param predicate — A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

value]) =>

(parameter) value: string | undefined

value)          

(parameter) value: string | undefined

.map((

(method) Array<[string, string | undefined]>.map<string>(callbackfn: (value: [string, string | undefined], index: number, array: [string, string | undefined][]) => string, thisArg?: any): string[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

[key,

(parameter) key: string

value]) => `$

(parameter) value: string | undefined

{key}=$

(parameter) key: string

{value}`)          

(parameter) value: string | undefined

.join('&')          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

} protected getCookies(          

(method) EventV1Processor.getCookies(event: Exclude<LambdaEvent, APIGatewayProxyEventV2>, headers: Headers): void

// eslint-disable-next-line @typescript-eslint/no-unused-vars event:

(parameter) event: APIGatewayProxyEvent | ALBProxyEvent

Exclude

type Exclude<T, U> = T extends U ? never : T Exclude from T those types that are assignable to U

<LambdaEvent,

type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent

APIGatewayProxyEventV2>,          

interface APIGatewayProxyEventV2

// eslint-disable-next-line @typescript-eslint/no-unused-vars headers:

(parameter) headers: Headers

Headers          

interface Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

): void { // nop } protected getHeaders

(method) EventV1Processor.getHeaders(event: APIGatewayProxyEvent): Headers

(event:

(parameter) event: APIGatewayProxyEvent

APIGatewayProxyEvent):

interface APIGatewayProxyEvent

Headers {          

interface Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

const headers = new

const headers: Headers

Headers()          

var Headers: new (init?: HeadersInit) => Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

this.getCookies

(method) EventV1Processor.getCookies(event: Exclude<LambdaEvent, APIGatewayProxyEventV2>, headers: Headers): void

(event,

(parameter) event: APIGatewayProxyEvent

headers)          

const headers: Headers

if (event

(parameter) event: APIGatewayProxyEvent

.headers) {          

(property) APIGatewayProxyEvent.headers: Record<string, string | undefined>

for (const [k,

const k: string

v] of

const v: string | undefined

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string | undefined>(o: { [s: string]: string | undefined; } | ArrayLike<string | undefined>): [string, string | undefined][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(event

(parameter) event: APIGatewayProxyEvent

.headers)) {          

(property) APIGatewayProxyEvent.headers: Record<string, string | undefined>

if (v) {          

const v: string | undefined

headers

const headers: Headers

.set

(method) Headers.set(name: string, value: string): void MDN Reference

(k,

const k: string

v)          

const v: string

} } } if (event

(parameter) event: APIGatewayProxyEvent

.multiValueHeaders) {          

(property) APIGatewayProxyEvent.multiValueHeaders?: { [headerKey: string]: string[]; } | undefined

for (const [k,

const k: string

values] of

const values: string[]

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string[]>(o: { [s: string]: string[]; } | ArrayLike<string[]>): [string, string[]][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(event

(parameter) event: APIGatewayProxyEvent

.multiValueHeaders)) {          

(property) APIGatewayProxyEvent.multiValueHeaders?: { [headerKey: string]: string[]; }

if (values) {          

const values: string[]

// avoid duplicating already set headers const foundK =

const foundK: string | null

headers

const headers: Headers

.get

(method) Headers.get(name: string): string | null MDN Reference

(k)          

const k: string

values

const values: string[]

.forEach(

(method) Array<string>.forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(v) => (

(parameter) v: string

!foundK ||

const foundK: string | null

!foundK

const foundK: string

.includes

(method) String.includes(searchString: string, position?: number): boolean Returns true if searchString appears as a substring of the result of converting this object to a String, at one or more positions that are greater than or equal to position; otherwise, returns false.

@param searchString — search string

@param position — If position is undefined, 0 is assumed, so as to search all of the String.

(v)) &&

(parameter) v: string

headers

const headers: Headers

.append

(method) Headers.append(name: string, value: string): void MDN Reference

(k,

const k: string

v))          

(parameter) v: string

} } } return headers          

const headers: Headers

} protected setCookiesToResult(          

(method) EventV1Processor.setCookiesToResult(_: APIGatewayProxyEvent, result: APIGatewayProxyResult, cookies: string[]): void

_:

(parameter) _: APIGatewayProxyEvent

APIGatewayProxyEvent,          

interface APIGatewayProxyEvent

result:

(parameter) result: APIGatewayProxyResult

APIGatewayProxyResult,          

interface APIGatewayProxyResult

cookies: string[]          

(parameter) cookies: string[]

): void { result

(parameter) result: APIGatewayProxyResult

.multiValueHeaders = {          

(property) APIGatewayProxyResult.multiValueHeaders?: { [headerKey: string]: string[]; } | undefined

'set-cookie': cookies,          

(parameter) cookies: string[]

} } } const v1Processor:

const v1Processor: EventV1Processor

EventV1Processor = new

class EventV1Processor

EventV1Processor()          

constructor EventV1Processor<APIGatewayProxyEvent | ALBProxyEvent>(): EventV1Processor

class ALBProcessor extends

class ALBProcessor

EventProcessor

class EventProcessor<E extends LambdaEvent>

<ALBProxyEvent> {          

interface ALBProxyEvent

protected getHeaders

(method) ALBProcessor.getHeaders(event: ALBProxyEvent): Headers

(event:

(parameter) event: ALBProxyEvent

ALBProxyEvent):

interface ALBProxyEvent

Headers {          

interface Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

const headers = new

const headers: Headers

Headers()          

var Headers: new (init?: HeadersInit) => Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

// if multiValueHeaders is present the ALB will use it instead of the headers field // https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html#multi-value-headers if (event

(parameter) event: ALBProxyEvent

.multiValueHeaders) {          

(property) ALBProxyEvent.multiValueHeaders?: Record<string, string[] | undefined> | undefined

for (const [key,

const key: string

values] of

const values: string[] | undefined

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string[] | undefined>(o: { [s: string]: string[] | undefined; } | ArrayLike<string[] | undefined>): [string, string[] | undefined][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(event

(parameter) event: ALBProxyEvent

.multiValueHeaders)) {          

(property) ALBProxyEvent.multiValueHeaders?: Record<string, string[] | undefined>

if (values &&

const values: string[] | undefined

Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(values)) {          

const values: string[]

// https://www.rfc-editor.org/rfc/rfc9110.html#name-common-rules-for-defining-f headers

const headers: Headers

.set

(method) Headers.set(name: string, value: string): void MDN Reference

(key,

const key: string

values

const values: string[]

.join('; '))          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

} } } else { for (const [key,

const key: string

value] of

const value: string | undefined

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string | undefined>(o: { [s: string]: string | undefined; } | ArrayLike<string | undefined>): [string, string | undefined][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(event

(parameter) event: ALBProxyEvent

.headers ?? {})) {          

(property) ALBProxyEvent.headers?: Record<string, string | undefined> | undefined

if (value) {          

const value: string | undefined

headers

const headers: Headers

.set

(method) Headers.set(name: string, value: string): void MDN Reference

(key,

const key: string

value)          

const value: string

} } } return headers          

const headers: Headers

} protected getPath

(method) ALBProcessor.getPath(event: ALBProxyEvent): string

(event:

(parameter) event: ALBProxyEvent

ALBProxyEvent): string {          

interface ALBProxyEvent

return event

(parameter) event: ALBProxyEvent

.path          

(property) ALBProxyEvent.path: string

} protected getMethod

(method) ALBProcessor.getMethod(event: ALBProxyEvent): string

(event:

(parameter) event: ALBProxyEvent

ALBProxyEvent): string {          

interface ALBProxyEvent

return event

(parameter) event: ALBProxyEvent

.httpMethod          

(property) ALBProxyEvent.httpMethod: string

} protected getQueryString

(method) ALBProcessor.getQueryString(event: ALBProxyEvent): string

(event:

(parameter) event: ALBProxyEvent

ALBProxyEvent): string {          

interface ALBProxyEvent

// In the case of ALB Integration either queryStringParameters or multiValueQueryStringParameters can be present not both /* In other cases like when using the serverless framework, the event object does contain both queryStringParameters and multiValueQueryStringParameters: Below is an example event object for this URL: /payment/b8c55e69?select=amount&select=currency { ... queryStringParameters: { select: 'currency' }, multiValueQueryStringParameters: { select: [ 'amount', 'currency' ] }, } The expected results is for select to be an array with two items. However the pre-fix code is only returning one item ('currency') in the array. A simple fix would be to invert the if statement and check the multiValueQueryStringParameters first. */ if (event

(parameter) event: ALBProxyEvent

.multiValueQueryStringParameters) {          

(property) ALBProxyEvent.multiValueQueryStringParameters?: { [parameterKey: string]: string[]; } | undefined

return Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string[]>(o: { [s: string]: string[]; } | ArrayLike<string[]>): [string, string[]][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(event

(parameter) event: ALBProxyEvent

.multiValueQueryStringParameters || {})          

(property) ALBProxyEvent.multiValueQueryStringParameters?: { [parameterKey: string]: string[]; }

.filter(([,

(method) Array<[string, string[]]>.filter(predicate: (value: [string, string[]], index: number, array: [string, string[]][]) => unknown, thisArg?: any): [string, string[]][] (+1 overload) Returns the elements of an array that meet the condition specified in a callback function.

@param predicate — A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

value]) =>

(parameter) value: string[]

value)          

(parameter) value: string[]

.map((

(method) Array<[string, string[]]>.map<string>(callbackfn: (value: [string, string[]], index: number, array: [string, string[]][]) => string, thisArg?: any): string[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

[key,

(parameter) key: string

value]) => `$

(parameter) value: string[]

{key}=$

(parameter) key: string

{value

(parameter) value: string[]

.join(`&$

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

{key}=`)}`)          

(parameter) key: string

.join('&')          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

} else { return Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string | undefined>(o: { [s: string]: string | undefined; } | ArrayLike<string | undefined>): [string, string | undefined][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(event

(parameter) event: ALBProxyEvent

.queryStringParameters || {})          

(property) ALBProxyEvent.queryStringParameters?: Record<string, string | undefined> | undefined

.filter(([,

(method) Array<[string, string | undefined]>.filter(predicate: (value: [string, string | undefined], index: number, array: [string, string | undefined][]) => unknown, thisArg?: any): [string, string | undefined][] (+1 overload) Returns the elements of an array that meet the condition specified in a callback function.

@param predicate — A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

value]) =>

(parameter) value: string | undefined

value)          

(parameter) value: string | undefined

.map((

(method) Array<[string, string | undefined]>.map<string>(callbackfn: (value: [string, string | undefined], index: number, array: [string, string | undefined][]) => string, thisArg?: any): string[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

[key,

(parameter) key: string

value]) => `$

(parameter) value: string | undefined

{key}=$

(parameter) key: string

{value}`)          

(parameter) value: string | undefined

.join('&')          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

} } protected getCookies

(method) ALBProcessor.getCookies(event: ALBProxyEvent, headers: Headers): void

(event:

(parameter) event: ALBProxyEvent

ALBProxyEvent,

interface ALBProxyEvent

headers:

(parameter) headers: Headers

Headers): void {          

interface Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

let cookie          

let cookie: any

if (event

(parameter) event: ALBProxyEvent

.multiValueHeaders) {          

(property) ALBProxyEvent.multiValueHeaders?: Record<string, string[] | undefined> | undefined

cookie =

let cookie: any

event

(parameter) event: ALBProxyEvent

.multiValueHeaders['cookie']?

(property) ALBProxyEvent.multiValueHeaders?: Record<string, string[] | undefined>

.join('; ')          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

} else { cookie =

let cookie: any

event

(parameter) event: ALBProxyEvent

.headers ?

(property) ALBProxyEvent.headers?: Record<string, string | undefined> | undefined

event

(parameter) event: ALBProxyEvent

.headers['cookie'] : undefined          

(property) ALBProxyEvent.headers?: Record<string, string | undefined>

} if (cookie) {          

let cookie: string | undefined

headers

(parameter) headers: Headers

.append('Cookie',

(method) Headers.append(name: string, value: string): void MDN Reference

cookie)          

let cookie: string

} } protected setCookiesToResult(          

(method) ALBProcessor.setCookiesToResult(event: ALBProxyEvent, result: APIGatewayProxyResult, cookies: string[]): void

event:

(parameter) event: ALBProxyEvent

ALBProxyEvent,          

interface ALBProxyEvent

result:

(parameter) result: APIGatewayProxyResult

APIGatewayProxyResult,          

interface APIGatewayProxyResult

cookies: string[]          

(parameter) cookies: string[]

): void { // when multi value headers is enabled if (event

(parameter) event: ALBProxyEvent

.multiValueHeaders &&

(property) ALBProxyEvent.multiValueHeaders?: Record<string, string[] | undefined> | undefined

result

(parameter) result: APIGatewayProxyResult

.multiValueHeaders) {          

(property) APIGatewayProxyResult.multiValueHeaders?: { [headerKey: string]: string[]; } | undefined

result

(parameter) result: APIGatewayProxyResult

.multiValueHeaders['set-cookie'] =

(property) APIGatewayProxyResult.multiValueHeaders?: { [headerKey: string]: string[]; }

cookies          

(parameter) cookies: string[]

} else { // otherwise serialize the set-cookie result

(parameter) result: APIGatewayProxyResult

.headers['set-cookie'] =

(property) APIGatewayProxyResult.headers: Record<string, string>

cookies

(parameter) cookies: string[]

.join(', ')          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

} } } const albProcessor:

const albProcessor: ALBProcessor

ALBProcessor = new

class ALBProcessor

ALBProcessor()          

constructor ALBProcessor<ALBProxyEvent>(): ALBProcessor

export const getProcessor =

const getProcessor: (event: LambdaEvent) => EventProcessor<LambdaEvent>

(event:

(parameter) event: LambdaEvent

LambdaEvent):

type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent

EventProcessor

class EventProcessor<E extends LambdaEvent>

<LambdaEvent> => {          

type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent

if (isProxyEventALB

const isProxyEventALB: (event: LambdaEvent) => event is ALBProxyEvent

(event)) {          

(parameter) event: LambdaEvent

return albProcessor          

const albProcessor: ALBProcessor

} if (isProxyEventV2

const isProxyEventV2: (event: LambdaEvent) => event is APIGatewayProxyEventV2

(event)) {          

(parameter) event: APIGatewayProxyEvent | APIGatewayProxyEventV2

return v2Processor          

const v2Processor: EventV2Processor

} return v1Processor          

const v1Processor: EventV1Processor

} const isProxyEventALB =

const isProxyEventALB: (event: LambdaEvent) => event is ALBProxyEvent

(event:

(parameter) event: LambdaEvent

LambdaEvent):

type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent

event is

(parameter) event: LambdaEvent

ALBProxyEvent => {          

interface ALBProxyEvent

return Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.hasOwn

(method) ObjectConstructor.hasOwn(o: object, v: PropertyKey): boolean Determines whether an object has a property with the specified name.

@param o — An object.

@param v — A property name.

(event

(parameter) event: LambdaEvent

.requestContext, 'elb')          

(property) requestContext: ApiGatewayRequestContext | ApiGatewayRequestContextV2 | ALBRequestContext

} const isProxyEventV2 =

const isProxyEventV2: (event: LambdaEvent) => event is APIGatewayProxyEventV2

(event:

(parameter) event: LambdaEvent

LambdaEvent):

type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent

event is

(parameter) event: LambdaEvent

APIGatewayProxyEventV2 => {          

interface APIGatewayProxyEventV2

return Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.hasOwn

(method) ObjectConstructor.hasOwn(o: object, v: PropertyKey): boolean Determines whether an object has a property with the specified name.

@param o — An object.

@param v — A property name.

(event, 'rawPath')          

(parameter) event: LambdaEvent

} export const isContentTypeBinary =

const isContentTypeBinary: (contentType: string) => boolean

(contentType: string) => {          

(parameter) contentType: string

return !/^(text\/(plain|html|css|javascript|csv).*|application\/(.*json|.*xml).*|image\/svg\+xml.*)$/.test(          

(method) RegExp.test(string: string): boolean Returns a Boolean value that indicates whether or not a pattern exists in a searched string.

@param string — String on which to perform the search.

contentType          

(parameter) contentType: string

) } export const isContentEncodingBinary =

const isContentEncodingBinary: (contentEncoding: string | null) => boolean

(contentEncoding: string | null) => {          

(parameter) contentEncoding: string | null

if (contentEncoding === null) {          

(parameter) contentEncoding: string | null

return false } return /^(gzip|deflate|compress|br)/.test

(method) RegExp.test(string: string): boolean Returns a Boolean value that indicates whether or not a pattern exists in a searched string.

@param string — String on which to perform the search.

(contentEncoding)          

(parameter) contentEncoding: string

}
src/adapter/aws-lambda/index.ts
            
                /**
                 * @module
                 * AWS Lambda Adapter for Hono.
                 */
                
                export { handle,

(alias) const handle: <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>) => ((event: LambdaEvent, lambdaContext?: LambdaContext) => Promise<APIGatewayProxyResult>) export handle Accepts events from API Gateway/ELB(APIGatewayProxyEvent) and directly through Function Url(APIGatewayProxyEventV2)

streamHandle } from './handler'          

(alias) const streamHandle: <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>) => Handler export streamHandle

export type { APIGatewayProxyResult,

(alias) interface APIGatewayProxyResult export APIGatewayProxyResult

LambdaEvent } from './handler'          

(alias) type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2 | ALBProxyEvent export LambdaEvent

export type { ApiGatewayRequestContext,          

(alias) interface ApiGatewayRequestContext export ApiGatewayRequestContext

ApiGatewayRequestContextV2,          

(alias) interface ApiGatewayRequestContextV2 export ApiGatewayRequestContextV2

ALBRequestContext,          

(alias) interface ALBRequestContext export ALBRequestContext

LambdaContext,          

(alias) interface LambdaContext export LambdaContext Handler context parameter. See AWS documentation.

} from './types'
src/adapter/aws-lambda/types.ts
            
                /* eslint-disable @typescript-eslint/no-explicit-any */
                
                export interface CognitoIdentity {          

interface CognitoIdentity

cognitoIdentityId: string          

(property) CognitoIdentity.cognitoIdentityId: string

cognitoIdentityPoolId: string          

(property) CognitoIdentity.cognitoIdentityPoolId: string

} export interface ClientContext {          

interface ClientContext

client:

(property) ClientContext.client: ClientContextClient

ClientContextClient          

interface ClientContextClient

Custom?: any          

(property) ClientContext.Custom?: any

env:

(property) ClientContext.env: ClientContextEnv

ClientContextEnv          

interface ClientContextEnv

} export interface ClientContextClient {          

interface ClientContextClient

installationId: string          

(property) ClientContextClient.installationId: string

appTitle: string          

(property) ClientContextClient.appTitle: string

appVersionName: string          

(property) ClientContextClient.appVersionName: string

appVersionCode: string          

(property) ClientContextClient.appVersionCode: string

appPackageName: string          

(property) ClientContextClient.appPackageName: string

} export interface ClientContextEnv {          

interface ClientContextEnv

platformVersion: string          

(property) ClientContextEnv.platformVersion: string

platform: string          

(property) ClientContextEnv.platform: string

make: string          

(property) ClientContextEnv.make: string

model: string          

(property) ClientContextEnv.model: string

locale: string          

(property) ClientContextEnv.locale: string

} /** * {@link Handler} context parameter. * See {@link https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html AWS documentation}. */ export interface LambdaContext {          

interface LambdaContext Handler context parameter. See AWS documentation.

callbackWaitsForEmptyEventLoop: boolean          

(property) LambdaContext.callbackWaitsForEmptyEventLoop: boolean

functionName: string          

(property) LambdaContext.functionName: string

functionVersion: string          

(property) LambdaContext.functionVersion: string

invokedFunctionArn: string          

(property) LambdaContext.invokedFunctionArn: string

memoryLimitInMB: string          

(property) LambdaContext.memoryLimitInMB: string

awsRequestId: string          

(property) LambdaContext.awsRequestId: string

logGroupName: string          

(property) LambdaContext.logGroupName: string

logStreamName: string          

(property) LambdaContext.logStreamName: string

identity?:

(property) LambdaContext.identity?: CognitoIdentity | undefined

CognitoIdentity | undefined          

interface CognitoIdentity

clientContext?:

(property) LambdaContext.clientContext?: ClientContext | undefined

ClientContext | undefined          

interface ClientContext

getRemainingTimeInMillis(): number          

(method) LambdaContext.getRemainingTimeInMillis(): number

} type Callback

type Callback<TResult = any> = (error?: Error | string | null, result?: TResult) => void

<TResult = any> =

(type parameter) TResult in type Callback<TResult = any>

(error?:

(parameter) error: string | Error | null | undefined

Error | string | null,

interface Error

result?:

(parameter) result: TResult | undefined

TResult) => void          

(type parameter) TResult in type Callback<TResult = any>

export type Handler

type Handler<TEvent = any, TResult = any> = (event: TEvent, context: LambdaContext, callback: Callback<TResult>) => void | Promise<TResult>

<TEvent = any,

(type parameter) TEvent in type Handler<TEvent = any, TResult = any>

TResult = any> = (          

(type parameter) TResult in type Handler<TEvent = any, TResult = any>

event:

(parameter) event: TEvent = any

TEvent,          

(type parameter) TEvent in type Handler<TEvent = any, TResult = any>

context:

(parameter) context: LambdaContext

LambdaContext,          

interface LambdaContext Handler context parameter. See AWS documentation.

callback:

(parameter) callback: Callback<TResult>

Callback

type Callback<TResult = any> = (error?: Error | string | null, result?: TResult) => void

<TResult>          

(type parameter) TResult in type Handler<TEvent = any, TResult = any>

) => void | Promise

interface Promise<T> Represents the completion of an asynchronous operation

<TResult>          

(type parameter) TResult in type Handler<TEvent = any, TResult = any>

interface ClientCert {          

interface ClientCert

clientCertPem: string          

(property) ClientCert.clientCertPem: string

subjectDN: string          

(property) ClientCert.subjectDN: string

issuerDN: string          

(property) ClientCert.issuerDN: string

serialNumber: string          

(property) ClientCert.serialNumber: string

validity: {          

(property) ClientCert.validity: { notBefore: string; notAfter: string; }

notBefore: string          

(property) notBefore: string

notAfter: string          

(property) notAfter: string

} } interface Identity {          

interface Identity

accessKey?: string          

(property) Identity.accessKey?: string | undefined

accountId?: string          

(property) Identity.accountId?: string | undefined

caller?: string          

(property) Identity.caller?: string | undefined

cognitoAuthenticationProvider?: string          

(property) Identity.cognitoAuthenticationProvider?: string | undefined

cognitoAuthenticationType?: string          

(property) Identity.cognitoAuthenticationType?: string | undefined

cognitoIdentityId?: string          

(property) Identity.cognitoIdentityId?: string | undefined

cognitoIdentityPoolId?: string          

(property) Identity.cognitoIdentityPoolId?: string | undefined

principalOrgId?: string          

(property) Identity.principalOrgId?: string | undefined

sourceIp: string          

(property) Identity.sourceIp: string

user?: string          

(property) Identity.user?: string | undefined

userAgent: string          

(property) Identity.userAgent: string

userArn?: string          

(property) Identity.userArn?: string | undefined

clientCert?:

(property) Identity.clientCert?: ClientCert | undefined

ClientCert          

interface ClientCert

} export interface ApiGatewayRequestContext {          

interface ApiGatewayRequestContext

accountId: string          

(property) ApiGatewayRequestContext.accountId: string

apiId: string          

(property) ApiGatewayRequestContext.apiId: string

authorizer: {          

(property) ApiGatewayRequestContext.authorizer: { claims?: unknown; scopes?: unknown; }

claims?: unknown          

(property) claims?: unknown

scopes?: unknown          

(property) scopes?: unknown

} domainName: string          

(property) ApiGatewayRequestContext.domainName: string

domainPrefix: string          

(property) ApiGatewayRequestContext.domainPrefix: string

extendedRequestId: string          

(property) ApiGatewayRequestContext.extendedRequestId: string

httpMethod: string          

(property) ApiGatewayRequestContext.httpMethod: string

identity:

(property) ApiGatewayRequestContext.identity: Identity

Identity          

interface Identity

path: string          

(property) ApiGatewayRequestContext.path: string

protocol: string          

(property) ApiGatewayRequestContext.protocol: string

requestId: string          

(property) ApiGatewayRequestContext.requestId: string

requestTime: string          

(property) ApiGatewayRequestContext.requestTime: string

requestTimeEpoch: number          

(property) ApiGatewayRequestContext.requestTimeEpoch: number

resourceId?: string          

(property) ApiGatewayRequestContext.resourceId?: string | undefined

resourcePath: string          

(property) ApiGatewayRequestContext.resourcePath: string

stage: string          

(property) ApiGatewayRequestContext.stage: string

} interface Authorizer {          

interface Authorizer

iam?: {          

(property) Authorizer.iam?: { accessKey: string; accountId: string; callerId: string; cognitoIdentity: null; principalOrgId: null; userArn: string; userId: string; } | undefined

accessKey: string          

(property) accessKey: string

accountId: string          

(property) accountId: string

callerId: string          

(property) callerId: string

cognitoIdentity: null          

(property) cognitoIdentity: null

principalOrgId: null          

(property) principalOrgId: null

userArn: string          

(property) userArn: string

userId: string          

(property) userId: string

} } export interface ApiGatewayRequestContextV2 {          

interface ApiGatewayRequestContextV2

accountId: string          

(property) ApiGatewayRequestContextV2.accountId: string

apiId: string          

(property) ApiGatewayRequestContextV2.apiId: string

authentication: null          

(property) ApiGatewayRequestContextV2.authentication: null

authorizer:

(property) ApiGatewayRequestContextV2.authorizer: Authorizer

Authorizer          

interface Authorizer

domainName: string          

(property) ApiGatewayRequestContextV2.domainName: string

domainPrefix: string          

(property) ApiGatewayRequestContextV2.domainPrefix: string

http: {          

(property) ApiGatewayRequestContextV2.http: { method: string; path: string; protocol: string; sourceIp: string; userAgent: string; }

method: string          

(property) method: string

path: string          

(property) path: string

protocol: string          

(property) protocol: string

sourceIp: string          

(property) sourceIp: string

userAgent: string          

(property) userAgent: string

} requestId: string          

(property) ApiGatewayRequestContextV2.requestId: string

routeKey: string          

(property) ApiGatewayRequestContextV2.routeKey: string

stage: string          

(property) ApiGatewayRequestContextV2.stage: string

time: string          

(property) ApiGatewayRequestContextV2.time: string

timeEpoch: number          

(property) ApiGatewayRequestContextV2.timeEpoch: number

} export interface ALBRequestContext {          

interface ALBRequestContext

elb: {          

(property) ALBRequestContext.elb: { targetGroupArn: string; }

targetGroupArn: string          

(property) targetGroupArn: string

} }
src/adapter/bun/conninfo.test.ts
            
                import { Context } from '../../context'
                import type { AddressType } from '../../helper/conninfo'
                import { getConnInfo } from './conninfo'
                
                const createRandomBunServer = ({          

const createRandomBunServer: ({ address, port, family, }?: { address?: string; port?: number; family?: AddressType | string; }) => { address: string; port: number; server: { requestIP(): { address: string; family: string; port: number; }; }; }

address =

(parameter) address: string

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random()

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

.toString(),          

(method) Number.toString(radix?: number): string Returns a string representation of an object.

@param radix — Specifies a radix for converting numeric values to strings. This value is only used for numbers.

port =

(parameter) port: number

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.floor

(method) Math.floor(x: number): number Returns the greatest integer less than or equal to its numeric argument.

@param x — A numeric expression.

(Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random() * (65535 + 1)),          

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

family = 'IPv6',          

(parameter) family: string

}: { address?: string          

(property) address?: string | undefined

port?: number          

(property) port?: number | undefined

family?:

(property) family?: string | undefined

AddressType | string          

(alias) type AddressType = "IPv6" | "IPv4" | undefined import AddressType

} = {}) => { return { address,          

(property) address: string

port,          

(property) port: number

server: {          

(property) server: { requestIP(): { address: string; family: string; port: number; }; }

requestIP() {          

(method) requestIP(): { address: string; family: string; port: number; }

return { address,          

(property) address: string

family,          

(property) family: string

port,          

(property) port: number

} }, }, } } describe('getConnInfo', () => { it('Should info is valid', () => { const { port,

const port: number

server,

const server: { requestIP(): { address: string; family: string; port: number; }; }

address } =

const address: string

createRandomBunServer()          

const createRandomBunServer: ({ address, port, family, }?: { address?: string; port?: number; family?: AddressType | string; }) => { address: string; port: number; server: { requestIP(): { address: string; family: string; port: number; }; }; }

const c = new

const c: Context<any, any, {}>

Context(new

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

Request('http://localhost/'), {

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

env:

(property) env: any Bindings for the environment.

server })          

const server: { requestIP(): { address: string; family: string; port: number; }; }

const info =

const info: ConnInfo

getConnInfo

(alias) getConnInfo(c: Context): ConnInfo import getConnInfo Get ConnInfo with Bun

@param c — Context

@returns — ConnInfo

(c)          

const c: Context<any, any, {}>

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.port).toBe

(property) port?: number | undefined Transport port number

(port)          

const port: number

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.address).toBe

(property) address?: string | undefined Host name such as IP Addr

(address)          

const address: string

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.addressType).toBe('IPv6')          

(property) addressType?: AddressType Host name type

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.transport).toBeUndefined()          

(property) transport?: "tcp" | "udp" | undefined Transport protocol type

}) it('Should getConnInfo works when env is { server: server }', () => { const { port,

const port: number

server,

const server: { requestIP(): { address: string; family: string; port: number; }; }

address } =

const address: string

createRandomBunServer()          

const createRandomBunServer: ({ address, port, family, }?: { address?: string; port?: number; family?: AddressType | string; }) => { address: string; port: number; server: { requestIP(): { address: string; family: string; port: number; }; }; }

const c = new

const c: Context<any, any, {}>

Context(new

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

Request('http://localhost/'), {

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

env: {

(property) env: any Bindings for the environment.

server } })          

(property) server: { requestIP(): { address: string; family: string; port: number; }; }

const info =

const info: ConnInfo

getConnInfo

(alias) getConnInfo(c: Context): ConnInfo import getConnInfo Get ConnInfo with Bun

@param c — Context

@returns — ConnInfo

(c)          

const c: Context<any, any, {}>

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.port).toBe

(property) port?: number | undefined Transport port number

(port)          

const port: number

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.address).toBe

(property) address?: string | undefined Host name such as IP Addr

(address)          

const address: string

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.addressType).toBe('IPv6')          

(property) addressType?: AddressType Host name type

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.transport).toBeUndefined()          

(property) transport?: "tcp" | "udp" | undefined Transport protocol type

}) it('should return undefined when addressType is invalid string', () => { const { server } =

const server: { requestIP(): { address: string; family: string; port: number; }; }

createRandomBunServer({

const createRandomBunServer: ({ address, port, family, }?: { address?: string; port?: number; family?: AddressType | string; }) => { address: string; port: number; server: { requestIP(): { address: string; family: string; port: number; }; }; }

family: 'invalid' })          

(property) family?: string | undefined

const c = new

const c: Context<any, any, {}>

Context(new

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

Request('http://localhost/'), {

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

env: {

(property) env: any Bindings for the environment.

server } })          

(property) server: { requestIP(): { address: string; family: string; port: number; }; }

const info =

const info: ConnInfo

getConnInfo

(alias) getConnInfo(c: Context): ConnInfo import getConnInfo Get ConnInfo with Bun

@param c — Context

@returns — ConnInfo

(c)          

const c: Context<any, any, {}>

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.addressType).toBeUndefined()          

(property) addressType?: AddressType Host name type

}) it('Should throw error when user did not give server', () => { const c = new

const c: Context<any, any, {}>

Context(new

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

Request('http://localhost/'), {

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

env: {} })          

(property) env: any Bindings for the environment.

expect(() => getConnInfo

(alias) getConnInfo(c: Context): ConnInfo import getConnInfo Get ConnInfo with Bun

@param c — Context

@returns — ConnInfo

(c)).toThrowError

const c: Context<any, any, {}>

(TypeError)          

var TypeError: TypeErrorConstructor

}) it('Should throw error when requestIP is not function', () => { const c = new

const c: Context<any, any, {}>

Context(new

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

Request('http://localhost/'), {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

env: {          

(property) env: any Bindings for the environment.

requestIP: 0,          

(property) requestIP: number

}, }) expect(() => getConnInfo

(alias) getConnInfo(c: Context): ConnInfo import getConnInfo Get ConnInfo with Bun

@param c — Context

@returns — ConnInfo

(c)).toThrowError

const c: Context<any, any, {}>

(TypeError)          

var TypeError: TypeErrorConstructor

}) })
src/adapter/bun/conninfo.ts
            
                import type { Context } from '../..'
                import type { GetConnInfo } from '../../helper/conninfo'
                import { getBunServer } from './server'
                
                /**
                 * Get ConnInfo with Bun
                 * @param c Context
                 * @returns ConnInfo
                 */
                export const getConnInfo:

const getConnInfo: GetConnInfo Get ConnInfo with Bun

@param c — Context

@returns — ConnInfo

GetConnInfo =

(alias) type GetConnInfo = (c: Context) => ConnInfo import GetConnInfo Helper type

(c:

(parameter) c: Context<any, any, {}> Context

@param c — Context

Context) => {          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

const server =

const server: BunServer | undefined

getBunServer

(alias) getBunServer(c: Context): BunServer | undefined import getBunServer Get Bun Server Object from Context

@param c — Context

@returns — Bun Server

(c)          

(parameter) c: Context<any, any, {}> Context

@param c — Context

if (!server) {          

const server: BunServer | undefined

throw new TypeError('env has to include the 2nd argument of fetch.')          

var TypeError: TypeErrorConstructor new (message?: string, options?: ErrorOptions) => TypeError (+3 overloads)

} if (typeof server

const server: BunServer

.requestIP !== 'function') {          

(property) BunServer.requestIP?: ((req: Request) => { address: string; family: string; port: number; }) | undefined

throw new TypeError('server.requestIP is not a function.')          

var TypeError: TypeErrorConstructor new (message?: string, options?: ErrorOptions) => TypeError (+3 overloads)

} const info =

const info: { address: string; family: string; port: number; }

server

const server: BunServer

.requestIP

(property) BunServer.requestIP?: (req: Request) => { address: string; family: string; port: number; }

(c

(parameter) c: Context<any, any, {}> Context

@param c — Context

.req

(property) Context<any, any, {}>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.raw)          

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

return { remote: {          

(property) ConnInfo.remote: NetAddrInfo Remote information

address:

(property) address: string

info

const info: { address: string; family: string; port: number; }

.address,          

(property) address: string

addressType:

(property) addressType: "IPv6" | "IPv4" | undefined

info

const info: { address: string; family: string; port: number; }

.family === 'IPv6' ||

(property) family: string

info

const info: { address: string; family: string; port: number; }

.family === 'IPv4' ?

(property) family: string

info

const info: { address: string; family: string; port: number; }

.family : undefined,          

(property) family: "IPv6" | "IPv4"

port:

(property) port?: number | undefined Transport port number

info

const info: { address: string; family: string; port: number; }

.port,          

(property) port: number

}, } }
src/adapter/bun/index.ts
            
                /**
                 * @module
                 * Bun Adapter for Hono.
                 */
                
                export { serveStatic } from './serve-static'          

(alias) const serveStatic: <E extends Env = Env>(options: ServeStaticOptions<E>) => MiddlewareHandler export serveStatic

export { bunFileSystemModule,

(alias) const bunFileSystemModule: FileSystemModule export bunFileSystemModule

@experimental
bunFileSystemModule is an experimental feature. The API might be changed.

toSSG } from './ssg'          

(alias) const toSSG: ToSSGAdaptorInterface<Env, {}, "/"> export toSSG

@experimental
toSSG is an experimental feature. The API might be changed.

export { createBunWebSocket } from './websocket'          

(alias) const createBunWebSocket: <T>() => CreateWebSocket<T> export createBunWebSocket

export { getConnInfo } from './conninfo'          

(alias) const getConnInfo: GetConnInfo export getConnInfo Get ConnInfo with Bun

@param c — Context

@returns — ConnInfo

src/adapter/bun/serve-static.ts
            
                /* eslint-disable @typescript-eslint/ban-ts-comment */
                import { stat } from 'node:fs/promises'
                import { serveStatic as baseServeStatic } from '../../middleware/serve-static'
                import type { ServeStaticOptions } from '../../middleware/serve-static'
                import type { Env, MiddlewareHandler } from '../../types'
                
                export const serveStatic = 

const serveStatic: <E extends Env = Env>(options: ServeStaticOptions<E>) => MiddlewareHandler

<E extends

(type parameter) E in <E extends Env = Env>(options: ServeStaticOptions<E>): MiddlewareHandler

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env>(          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

options:

(parameter) options: ServeStaticOptions<E>

ServeStaticOptions

(alias) type ServeStaticOptions<E extends Env = Env> = { root?: string; path?: string; precompressed?: boolean; mimes?: Record<string, string>; rewriteRequestPath?: (path: string) => string; onFound?: (path: string, c: Context<E>) => void | Promise<void>; onNotFound?: (path: string, c: Context<E>) => void | Promise<void>; } import ServeStaticOptions

<E>          

(type parameter) E in <E extends Env = Env>(options: ServeStaticOptions<E>): MiddlewareHandler

): MiddlewareHandler => {          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

return async function serveStatic

(local function) serveStatic(c: Context<any, string, {}>, next: Next): Promise<void | Response>

(c,

(parameter) c: Context<any, string, {}>

next) {          

(parameter) next: Next

const getContent = async

const getContent: (path: string) => Promise<any>

(path: string) => {          

(parameter) path: string

path =

(parameter) path: string

path

(parameter) path: string

.startsWith('/') ?

(method) String.startsWith(searchString: string, position?: number): boolean Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false.

path : `./$

(parameter) path: string

{path}`          

(parameter) path: string

// @ts-ignore const file = Bun.file

const file: any

(path)          

(parameter) path: string

return (await file.exists()) ?

const file: any

file : null          

const file: any

} const pathResolve =

const pathResolve: (path: string) => string

(path: string) => {          

(parameter) path: string

return path

(parameter) path: string

.startsWith('/') ?

(method) String.startsWith(searchString: string, position?: number): boolean Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false.

path : `./$

(parameter) path: string

{path}`          

(parameter) path: string

} const isDir = async

const isDir: (path: string) => Promise<any>

(path: string) => {          

(parameter) path: string

let isDir          

let isDir: any

try { const stats = await stat

const stats: any

(path)          

(parameter) path: string

isDir =

let isDir: any

stats.isDirectory()          

const stats: any

} catch {} return isDir          

let isDir: any

} return baseServeStatic({          

(alias) baseServeStatic<E>(options: ServeStaticOptions<E> & { getContent: (path: string, c: Context<E, any, {}>) => Promise<Data | Response | null>; pathResolve?: (path: string) => string; isDir?: (path: string) => boolean | undefined | Promise<boolean | undefined>; }): MiddlewareHandler import baseServeStatic This middleware is not directly used by the user. Create a wrapper specifying getContent() by the environment such as Deno or Bun.

...options,          

(parameter) options: ServeStaticOptions<E>

getContent,          

(property) getContent: (path: string, c: Context<E, any, {}>) => Promise<Data | Response | null>

pathResolve,          

(property) pathResolve?: ((path: string) => string) | undefined

isDir,          

(property) isDir?: ((path: string) => boolean | undefined | Promise<boolean | undefined>) | undefined

})(c,

(parameter) c: Context<any, string, {}>

next)          

(parameter) next: Next

} }
src/adapter/bun/server.test.ts
            
                import { Context } from '../../context'
                import { getBunServer } from './server'
                import type { BunServer } from './server'
                
                describe('getBunServer', () => {
                  it('Should success to pick Server', () => {
                    const server = {} as

const server: BunServer

BunServer          

(alias) interface BunServer import BunServer Bun Server Object

expect(getBunServer(new

(alias) getBunServer(c: Context): BunServer | undefined import getBunServer Get Bun Server Object from Context

@param c — Context

@returns — Bun Server

Context(new

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

Request('http://localhost/'), {

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

env:

(property) env: any Bindings for the environment.

server }))).toBe(          

const server: BunServer

server          

const server: BunServer

) expect(getBunServer(new

(alias) getBunServer(c: Context): BunServer | undefined import getBunServer Get Bun Server Object from Context

@param c — Context

@returns — Bun Server

Context(new

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

Request('http://localhost/'), {

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

env: {

(property) env: any Bindings for the environment.

server } }))).toBe(          

(property) server: BunServer

server          

const server: BunServer

) }) })
src/adapter/bun/server.ts
            
                /**
                 * Getting Bun Server Object for Bun adapters
                 * @module
                 */
                import type { Context } from '../../context'
                
                /**
                 * Bun Server Object
                 */
                export interface BunServer {          

interface BunServer Bun Server Object

requestIP?:

(property) BunServer.requestIP?: ((req: Request) => { address: string; family: string; port: number; }) | undefined

(req:

(parameter) req: Request

Request) => {          

interface Request This Fetch API interface represents a resource request.

MDN Reference

address: string          

(property) address: string

family: string          

(property) family: string

port: number          

(property) port: number

} upgrade

(method) BunServer.upgrade<T>(req: Request, options?: { data: T; }): boolean

<T>(          

(type parameter) T in BunServer.upgrade<T>(req: Request, options?: { data: T; }): boolean

req:

(parameter) req: Request

Request,          

interface Request This Fetch API interface represents a resource request.

MDN Reference

options?: {          

(parameter) options: { data: T; } | undefined

data:

(property) data: T

T          

(type parameter) T in BunServer.upgrade<T>(req: Request, options?: { data: T; }): boolean

} ): boolean } /** * Get Bun Server Object from Context * @param c Context * @returns Bun Server */ export const getBunServer =

const getBunServer: (c: Context) => BunServer | undefined Get Bun Server Object from Context

@param c — Context

@returns — Bun Server

(c:

(parameter) c: Context<any, any, {}> Context

@param c — Context

Context):

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

BunServer | undefined =>          

interface BunServer Bun Server Object

('server' in c

(parameter) c: Context<any, any, {}> Context

@param c — Context

.env ?

(property) Context<any, any, {}>.env: any .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

c

(parameter) c: Context<any, any, {}> Context

@param c — Context

.env.server :

(property) Context<any, any, {}>.env: any .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

c

(parameter) c: Context<any, any, {}> Context

@param c — Context

.env) as

(property) Context<any, any, {}>.env: any .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

BunServer | undefined          

interface BunServer Bun Server Object

src/adapter/bun/ssg.ts
            
                /* eslint-disable @typescript-eslint/ban-ts-comment */
                import { toSSG as baseToSSG } from '../../helper/ssg'
                import type { FileSystemModule, ToSSGAdaptorInterface } from '../../helper/ssg'
                
                // @ts-ignore
                const { write } = Bun          

const write: any

/** * @experimental * `bunFileSystemModule` is an experimental feature. * The API might be changed. */ export const bunFileSystemModule:

const bunFileSystemModule: FileSystemModule

@experimental
bunFileSystemModule is an experimental feature. The API might be changed.

FileSystemModule = {          

(alias) interface FileSystemModule import FileSystemModule

@experimental
FileSystemModule is an experimental feature. The API might be changed.

writeFile: async

(method) FileSystemModule.writeFile(path: string, data: string | Uint8Array): Promise<void>

(path,

(parameter) path: string

data) => {          

(parameter) data: string | Uint8Array

await write

const write: any

(path,

(parameter) path: string

data)          

(parameter) data: string | Uint8Array

}, mkdir: async () => {},          

(method) FileSystemModule.mkdir(path: string, options: { recursive: boolean; }): Promise<void | string>

} /** * @experimental * `toSSG` is an experimental feature. * The API might be changed. */ export const toSSG:

const toSSG: ToSSGAdaptorInterface<Env, {}, "/">

@experimental
toSSG is an experimental feature. The API might be changed.

ToSSGAdaptorInterface = async

(alias) interface ToSSGAdaptorInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/"> import ToSSGAdaptorInterface

@experimental
ToSSGAdaptorInterface is an experimental feature. The API might be changed.

(app,

(parameter) app: Hono<Env, {}, "/">

options) => {          

(parameter) options: ToSSGOptions | undefined

return baseToSSG

(alias) baseToSSG(app: Hono<any, any, any>, fsModule: FileSystemModule, options?: ToSSGOptions): Promise<ToSSGResult> import baseToSSG

@experimental
toSSG is an experimental feature. The API might be changed.

(app,

(parameter) app: Hono<Env, {}, "/">

bunFileSystemModule,

const bunFileSystemModule: FileSystemModule

@experimental
bunFileSystemModule is an experimental feature. The API might be changed.

options)          

(parameter) options: ToSSGOptions | undefined

}
src/adapter/bun/websocket.ts
            
                import { createWSMessageEvent } from '../../helper/websocket'
                import type {
                  UpgradeWebSocket,
                  WSContext,
                  WSEvents,
                  WSMessageReceive,
                } from '../../helper/websocket'
                import { getBunServer } from './server'
                
                interface BunServerWebSocket

interface BunServerWebSocket<T>

<T> {          

(type parameter) T in BunServerWebSocket<T>

send

(method) BunServerWebSocket<T>.send(data: string | ArrayBufferLike, compress?: boolean): void

(data: string |

(parameter) data: string | ArrayBufferLike

ArrayBufferLike,

type ArrayBufferLike = ArrayBuffer | SharedArrayBuffer

compress?: boolean): void          

(parameter) compress: boolean | undefined

close

(method) BunServerWebSocket<T>.close(code?: number, reason?: string): void

(code?: number,

(parameter) code: number | undefined

reason?: string): void          

(parameter) reason: string | undefined

data:

(property) BunServerWebSocket<T>.data: T

T          

(type parameter) T in BunServerWebSocket<T>

readyState: 0 | 1 | 2 | 3          

(property) BunServerWebSocket<T>.readyState: 0 | 2 | 1 | 3

} interface BunWebSocketHandler

interface BunWebSocketHandler<T>

<T> {          

(type parameter) T in BunWebSocketHandler<T>

open

(method) BunWebSocketHandler<T>.open(ws: BunServerWebSocket<T>): void

(ws:

(parameter) ws: BunServerWebSocket<T>

BunServerWebSocket

interface BunServerWebSocket<T>

<T>): void          

(type parameter) T in BunWebSocketHandler<T>

close

(method) BunWebSocketHandler<T>.close(ws: BunServerWebSocket<T>, code?: number, reason?: string): void

(ws:

(parameter) ws: BunServerWebSocket<T>

BunServerWebSocket

interface BunServerWebSocket<T>

<T>,

(type parameter) T in BunWebSocketHandler<T>

code?: number,

(parameter) code: number | undefined

reason?: string): void          

(parameter) reason: string | undefined

message

(method) BunWebSocketHandler<T>.message(ws: BunServerWebSocket<T>, message: string | Uint8Array): void

(ws:

(parameter) ws: BunServerWebSocket<T>

BunServerWebSocket

interface BunServerWebSocket<T>

<T>,

(type parameter) T in BunWebSocketHandler<T>

message: string |

(parameter) message: string | Uint8Array

Uint8Array): void          

interface Uint8Array A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.

} interface CreateWebSocket

interface CreateWebSocket<T>

<T> {          

(type parameter) T in CreateWebSocket<T>

upgradeWebSocket:

(property) CreateWebSocket<T>.upgradeWebSocket: UpgradeWebSocket<T>

UpgradeWebSocket

(alias) type UpgradeWebSocket<T = unknown, U = any> = (createEvents: (c: Context) => WSEvents<T> | Promise<WSEvents<T>>, options?: U) => MiddlewareHandler<any, string, { outputFormat: "ws"; }> import UpgradeWebSocket Upgrade WebSocket Type

<T>          

(type parameter) T in CreateWebSocket<T>

websocket:

(property) CreateWebSocket<T>.websocket: BunWebSocketHandler<BunWebSocketData>

BunWebSocketHandler

interface BunWebSocketHandler<T>

<BunWebSocketData>          

interface BunWebSocketData

} export interface BunWebSocketData {          

interface BunWebSocketData

connId: number          

(property) BunWebSocketData.connId: number

url:

(property) BunWebSocketData.url: URL

URL          

interface URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

protocol: string          

(property) BunWebSocketData.protocol: string

} const createWSContext =

const createWSContext: (ws: BunServerWebSocket<BunWebSocketData>) => WSContext

(ws:

(parameter) ws: BunServerWebSocket<BunWebSocketData>

BunServerWebSocket

interface BunServerWebSocket<T>

<BunWebSocketData>):

interface BunWebSocketData

WSContext => {          

(alias) type WSContext<T = unknown> = { send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void; raw?: T; binaryType: BinaryType; readyState: WSReadyState; url: URL | null; protocol: string | null; close(code?: number, reason?: string): void; } import WSContext

return { send:

(method) send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void

(source,

(parameter) source: string | ArrayBuffer | Uint8Array

options) => {          

(parameter) options: { compress: boolean; } | undefined

const sendingData =          

const sendingData: string | ArrayBuffer

typeof source === 'string' ?

(parameter) source: string | ArrayBuffer | Uint8Array

source :

(parameter) source: string

source instanceof

(parameter) source: ArrayBuffer | Uint8Array

Uint8Array ?

var Uint8Array: Uint8ArrayConstructor A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.

source

(parameter) source: Uint8Array

.buffer :

(property) Uint8Array.buffer: ArrayBufferLike The ArrayBuffer instance referenced by the array.

source          

(parameter) source: ArrayBuffer

ws

(parameter) ws: BunServerWebSocket<BunWebSocketData>

.send

(method) BunServerWebSocket<BunWebSocketData>.send(data: string | ArrayBufferLike, compress?: boolean): void

(sendingData,

const sendingData: string | ArrayBuffer

options?

(parameter) options: { compress: boolean; } | undefined

.compress)          

(property) compress: boolean | undefined

}, raw:

(property) raw?: unknown

ws,          

(parameter) ws: BunServerWebSocket<BunWebSocketData>

binaryType: 'arraybuffer',          

(property) binaryType: BinaryType

readyState:

(property) readyState: WSReadyState

ws

(parameter) ws: BunServerWebSocket<BunWebSocketData>

.readyState,          

(property) BunServerWebSocket<T>.readyState: 0 | 2 | 1 | 3

url:

(property) url: URL | null

ws

(parameter) ws: BunServerWebSocket<BunWebSocketData>

.data

(property) BunServerWebSocket<BunWebSocketData>.data: BunWebSocketData

.url,          

(property) BunWebSocketData.url: URL

protocol:

(property) protocol: string | null

ws

(parameter) ws: BunServerWebSocket<BunWebSocketData>

.data

(property) BunServerWebSocket<BunWebSocketData>.data: BunWebSocketData

.protocol,          

(property) BunWebSocketData.protocol: string

close

(method) close(code?: number, reason?: string): void

(code,

(parameter) code: number | undefined

reason) {          

(parameter) reason: string | undefined

ws

(parameter) ws: BunServerWebSocket<BunWebSocketData>

.close

(method) BunServerWebSocket<BunWebSocketData>.close(code?: number, reason?: string): void

(code,

(parameter) code: number | undefined

reason)          

(parameter) reason: string | undefined

}, } } export const createBunWebSocket =

const createBunWebSocket: <T>() => CreateWebSocket<T>

<T>():

(type parameter) T in <T>(): CreateWebSocket<T>

CreateWebSocket

interface CreateWebSocket<T>

<T> => {          

(type parameter) T in <T>(): CreateWebSocket<T>

const websocketConns:

const websocketConns: WSEvents<unknown>[]

WSEvents[] = []          

(alias) interface WSEvents<T = unknown> import WSEvents WebSocket Event Listeners type

// eslint-disable-next-line @typescript-eslint/no-explicit-any const upgradeWebSocket:

const upgradeWebSocket: UpgradeWebSocket<any>

UpgradeWebSocket =

(alias) type UpgradeWebSocket<T = unknown, U = any> = (createEvents: (c: Context) => WSEvents<T> | Promise<WSEvents<T>>, options?: U) => MiddlewareHandler<any, string, { outputFormat: "ws"; }> import UpgradeWebSocket Upgrade WebSocket Type

(createEvents) => {          

(parameter) createEvents: (c: Context) => WSEvents<any> | Promise<WSEvents<any>>

return async (c,

(parameter) c: Context<any, string, { outputFormat: "ws"; }>

next) => {          

(parameter) next: Next

const server =

const server: BunServer | undefined

getBunServer

(alias) getBunServer(c: Context): BunServer | undefined import getBunServer Get Bun Server Object from Context

@param c — Context

@returns — Bun Server

(c)          

(parameter) c: Context<any, string, { outputFormat: "ws"; }>

if (!server) {          

const server: BunServer | undefined

throw new TypeError('env has to include the 2nd argument of fetch.')          

var TypeError: TypeErrorConstructor new (message?: string, options?: ErrorOptions) => TypeError (+3 overloads)

} const connId =

const connId: number

websocketConns

const websocketConns: WSEvents<unknown>[]

.push(await

(method) Array<WSEvents<unknown>>.push(...items: WSEvents<unknown>[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

createEvents

(parameter) createEvents: (c: Context) => WSEvents<any> | Promise<WSEvents<any>>

(c)) - 1          

(parameter) c: Context<any, string, { outputFormat: "ws"; }>

const upgradeResult =

const upgradeResult: boolean

server

const server: BunServer

.upgrade

(method) BunServer.upgrade<BunWebSocketData>(req: Request, options?: { data: BunWebSocketData; } | undefined): boolean

<BunWebSocketData>

interface BunWebSocketData

(c

(parameter) c: Context<any, string, { outputFormat: "ws"; }>

.req

(property) Context<any, string, { outputFormat: "ws"; }>.req: HonoRequest<string, unknown> .req is the instance of HonoRequest.

.raw, {          

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

data: {          

(property) data: BunWebSocketData

connId,          

(property) BunWebSocketData.connId: number

url: new

(property) BunWebSocketData.url: URL

URL

var URL: new (url: string | URL, base?: string | URL) => URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

(c

(parameter) c: Context<any, string, { outputFormat: "ws"; }>

.req

(property) Context<any, string, { outputFormat: "ws"; }>.req: HonoRequest<string, unknown> .req is the instance of HonoRequest.

.url),          

(property) HonoRequest<string, unknown>.url: string .url() can get the request url strings.

@see — https://hono.dev/docs/api/request#url

@example
ts app.get('/about/me', (c) => { const url = c.req.url // `http://localhost:8787/about/me` ... })

protocol:

(property) BunWebSocketData.protocol: string

c

(parameter) c: Context<any, string, { outputFormat: "ws"; }>

.req

(property) Context<any, string, { outputFormat: "ws"; }>.req: HonoRequest<string, unknown> .req is the instance of HonoRequest.

.url,          

(property) HonoRequest<string, unknown>.url: string .url() can get the request url strings.

@see — https://hono.dev/docs/api/request#url

@example
ts app.get('/about/me', (c) => { const url = c.req.url // `http://localhost:8787/about/me` ... })

}, }) if (upgradeResult) {          

const upgradeResult: boolean

return new Response(null)          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

} await next() // Failed          

(parameter) next: () => Promise<void>

} } const websocket:

const websocket: BunWebSocketHandler<BunWebSocketData>

BunWebSocketHandler

interface BunWebSocketHandler<T>

<BunWebSocketData> = {          

interface BunWebSocketData

open

(method) BunWebSocketHandler<BunWebSocketData>.open(ws: BunServerWebSocket<BunWebSocketData>): void

(ws) {          

(parameter) ws: BunServerWebSocket<BunWebSocketData>

const websocketListeners =

const websocketListeners: WSEvents<unknown>

websocketConns

const websocketConns: WSEvents<unknown>[]

[ws

(parameter) ws: BunServerWebSocket<BunWebSocketData>

.data

(property) BunServerWebSocket<BunWebSocketData>.data: BunWebSocketData

.connId]          

(property) BunWebSocketData.connId: number

if (websocketListeners

const websocketListeners: WSEvents<unknown>

.onOpen) {          

(property) WSEvents<unknown>.onOpen?: ((evt: Event, ws: WSContext<unknown>) => void) | undefined

websocketListeners

const websocketListeners: WSEvents<unknown>

.onOpen(new

(property) WSEvents<unknown>.onOpen?: (evt: Event, ws: WSContext<unknown>) => void

Event('open'),

var Event: new (type: string, eventInitDict?: EventInit) => Event An event which takes place in the DOM.

MDN Reference

createWSContext

const createWSContext: (ws: BunServerWebSocket<BunWebSocketData>) => WSContext

(ws))          

(parameter) ws: BunServerWebSocket<BunWebSocketData>

} }, close

(method) BunWebSocketHandler<BunWebSocketData>.close(ws: BunServerWebSocket<BunWebSocketData>, code?: number, reason?: string): void

(ws,

(parameter) ws: BunServerWebSocket<BunWebSocketData>

code,

(parameter) code: number | undefined

reason) {          

(parameter) reason: string | undefined

const websocketListeners =

const websocketListeners: WSEvents<unknown>

websocketConns

const websocketConns: WSEvents<unknown>[]

[ws

(parameter) ws: BunServerWebSocket<BunWebSocketData>

.data

(property) BunServerWebSocket<BunWebSocketData>.data: BunWebSocketData

.connId]          

(property) BunWebSocketData.connId: number

if (websocketListeners

const websocketListeners: WSEvents<unknown>

.onClose) {          

(property) WSEvents<unknown>.onClose?: ((evt: CloseEvent, ws: WSContext<unknown>) => void) | undefined

websocketListeners

const websocketListeners: WSEvents<unknown>

.onClose(          

(property) WSEvents<unknown>.onClose?: (evt: CloseEvent, ws: WSContext<unknown>) => void

new CloseEvent('close', {          

var CloseEvent: new (type: string, eventInitDict?: CloseEventInit) => CloseEvent A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.

MDN Reference

code,          

(property) CloseEventInit.code?: number | undefined

reason,          

(property) CloseEventInit.reason?: string | undefined

}), createWSContext

const createWSContext: (ws: BunServerWebSocket<BunWebSocketData>) => WSContext

(ws)          

(parameter) ws: BunServerWebSocket<BunWebSocketData>

) } }, message

(method) BunWebSocketHandler<BunWebSocketData>.message(ws: BunServerWebSocket<BunWebSocketData>, message: string | Uint8Array): void

(ws,

(parameter) ws: BunServerWebSocket<BunWebSocketData>

message) {          

(parameter) message: string | Uint8Array

const websocketListeners =

const websocketListeners: WSEvents<unknown>

websocketConns

const websocketConns: WSEvents<unknown>[]

[ws

(parameter) ws: BunServerWebSocket<BunWebSocketData>

.data

(property) BunServerWebSocket<BunWebSocketData>.data: BunWebSocketData

.connId]          

(property) BunWebSocketData.connId: number

if (websocketListeners

const websocketListeners: WSEvents<unknown>

.onMessage) {          

(property) WSEvents<unknown>.onMessage?: ((evt: MessageEvent<WSMessageReceive>, ws: WSContext<unknown>) => void) | undefined

const normalizedReceiveData =          

const normalizedReceiveData: string | ArrayBuffer

typeof message === 'string' ?

(parameter) message: string | Uint8Array

message :

(parameter) message: string

(message

(parameter) message: Uint8Array

.buffer satisfies

(property) Uint8Array.buffer: ArrayBufferLike The ArrayBuffer instance referenced by the array.

WSMessageReceive)          

(alias) type WSMessageReceive = string | Blob | ArrayBufferLike import WSMessageReceive

websocketListeners

const websocketListeners: WSEvents<unknown>

.onMessage(          

(property) WSEvents<unknown>.onMessage?: (evt: MessageEvent<WSMessageReceive>, ws: WSContext<unknown>) => void

createWSMessageEvent

(alias) createWSMessageEvent(source: WSMessageReceive): MessageEvent<WSMessageReceive> import createWSMessageEvent

(normalizedReceiveData),          

const normalizedReceiveData: string | ArrayBuffer

createWSContext

const createWSContext: (ws: BunServerWebSocket<BunWebSocketData>) => WSContext

(ws)          

(parameter) ws: BunServerWebSocket<BunWebSocketData>

) } }, } return { upgradeWebSocket,          

(property) CreateWebSocket<T>.upgradeWebSocket: UpgradeWebSocket<T>

websocket,          

(property) CreateWebSocket<T>.websocket: BunWebSocketHandler<BunWebSocketData>

} }
src/adapter/cloudflare-pages/handler.test.ts
            
                import { getCookie } from '../../helper/cookie'
                import { Hono } from '../../hono'
                import { HTTPException } from '../../http-exception'
                import type { EventContext } from './handler'
                import { handle, handleMiddleware, serveStatic } from './handler'
                
                type Env = {          

type Env = { Bindings: { TOKEN: string; }; }

Bindings: {          

(property) Bindings: { TOKEN: string; }

TOKEN: string          

(property) TOKEN: string

} } function createEventContext(          

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

context:

(parameter) context: Partial<EventContext<{ TOKEN: string; }>>

Partial

type Partial<T> = { [P in keyof T]?: T[P] | undefined; } Make all properties in T optional

<EventContext

(alias) type EventContext<Env = {}, P extends string = any, Data = Record<string, unknown>> = { request: Request; functionPath: string; waitUntil: (promise: Promise<unknown>) => void; passThroughOnException: () => void; next: (input?: Request | string, init?: RequestInit) => Promise<Response>; env: Env & { ASSETS: { fetch: typeof fetch; }; }; params: Params<...>; data: Data; } import EventContext

<Env['Bindings']>>          

type Env = { Bindings: { TOKEN: string; }; }

): EventContext

(alias) type EventContext<Env = {}, P extends string = any, Data = Record<string, unknown>> = { request: Request; functionPath: string; waitUntil: (promise: Promise<unknown>) => void; passThroughOnException: () => void; next: (input?: Request | string, init?: RequestInit) => Promise<Response>; env: Env & { ASSETS: { fetch: typeof fetch; }; }; params: Params<...>; data: Data; } import EventContext

<Env['Bindings']> {          

type Env = { Bindings: { TOKEN: string; }; }

return { data: {},          

(property) data: Record<string, unknown>

env: {          

(property) env: { TOKEN: string; } & { ASSETS: { fetch: typeof fetch; }; }

...context

(parameter) context: Partial<EventContext<{ TOKEN: string; }>>

.env,          

(property) env?: ({ TOKEN: string; } & { ASSETS: { fetch: typeof fetch; }; }) | undefined

ASSETS: {

(property) ASSETS: { fetch: typeof fetch; }

fetch: vi.fn(), ..

(property) fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>

.context

(parameter) context: Partial<EventContext<{ TOKEN: string; }>>

.env?

(property) env?: ({ TOKEN: string; } & { ASSETS: { fetch: typeof fetch; }; }) | undefined

.ASSETS },          

(property) ASSETS: { fetch: typeof fetch; } | undefined

TOKEN:

(property) TOKEN: string

context

(parameter) context: Partial<EventContext<{ TOKEN: string; }>>

.env?

(property) env?: ({ TOKEN: string; } & { ASSETS: { fetch: typeof fetch; }; }) | undefined

.TOKEN ?? 'HONOISCOOL',          

(property) TOKEN: string | undefined

}, functionPath: '_worker.js',          

(property) functionPath: string

next: vi.fn(),          

(property) next: (input?: Request | string, init?: RequestInit) => Promise<Response>

params: {},          

(property) params: Params<any>

passThroughOnException: vi.fn(),          

(property) passThroughOnException: () => void

request: new

(property) request: Request

Request('http://localhost/api/foo'),          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

waitUntil: vi.fn(),          

(property) waitUntil: (promise: Promise<unknown>) => void

...context,          

(parameter) context: Partial<EventContext<{ TOKEN: string; }>>

} } describe('Adapter for Cloudflare Pages', () => { it('Should return 200 response', async () => { const request = new

const request: Request

Request('http://localhost/api/foo')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const env = {          

const env: { ASSETS: { fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>; }; TOKEN: string; }

ASSETS: {

(property) ASSETS: { fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>; }

fetch },          

(property) fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>

TOKEN: 'HONOISCOOL',          

(property) TOKEN: string

} const waitUntil = vi.fn()          

const waitUntil: any

const passThroughOnException = vi.fn()          

const passThroughOnException: any

const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({          

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

request,          

(property) request?: Request | undefined

env,          

(property) env?: ({ TOKEN: string; } & { ASSETS: { fetch: typeof fetch; }; }) | undefined

waitUntil,          

(property) waitUntil?: ((promise: Promise<unknown>) => void) | undefined

passThroughOnException,          

(property) passThroughOnException?: (() => void) | undefined

}) const app = new

const app: Hono<Env, BlankSchema, "/">

Hono

(alias) new Hono<Env, BlankSchema, "/">(options?: HonoOptions<Env>): Hono<Env, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

<Env>()          

type Env = { Bindings: { TOKEN: string; }; }

const appFetchSpy = vi.spyOn

const appFetchSpy: any

(app, 'fetch')          

const app: Hono<Env, BlankSchema, "/">

app

const app: Hono<Env, BlankSchema, "/">

.get('/api/foo',

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/api/foo", "/api/foo", JSONRespondReturn<{ TOKEN: string; requestURL: string; }, StatusCode>, BlankInput, Env>(path: "/api/foo", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<Env, "/api/foo", BlankInput>

return c

(parameter) c: Context<Env, "/api/foo", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ TOKEN: string; requestURL: string; }, StatusCode>(object: { TOKEN: string; requestURL: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

TOKEN:

(property) TOKEN: string

c

(parameter) c: Context<Env, "/api/foo", BlankInput>

.env

(property) Context<Env, "/api/foo", BlankInput>.env: { TOKEN: string; } .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

.TOKEN,

(property) TOKEN: string

requestURL:

(property) requestURL: string

c

(parameter) c: Context<Env, "/api/foo", BlankInput>

.req

(property) Context<Env, "/api/foo", BlankInput>.req: HonoRequest<"/api/foo", unknown> .req is the instance of HonoRequest.

.url })          

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.url: string .url() can get the request url strings.

@see — https://hono.dev/docs/api/request#url

@example
ts app.get('/about/me', (c) => { const url = c.req.url // `http://localhost:8787/about/me` ... })

}) const handler =

const handler: PagesFunction<{ TOKEN: string; }, any, Record<string, unknown>>

handle

(alias) handle<Env, BlankSchema, "/">(app: Hono<Env, BlankSchema, "/">): PagesFunction<{ TOKEN: string; }, any, Record<string, unknown>> import handle

(app)          

const app: Hono<Env, BlankSchema, "/">

const res = await

const res: Response

handler

const handler: (context: EventContext<{ TOKEN: string; }, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)          

const eventContext: EventContext<{ TOKEN: string; }>

expect(appFetchSpy).toHaveBeenCalledWith(          

const appFetchSpy: any

request,          

const request: Request

{ ...env,

const env: { ASSETS: { fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>; }; TOKEN: string; }

eventContext },          

(property) eventContext: EventContext<{ TOKEN: string; }>

{ waitUntil,

(property) waitUntil: any

passThroughOnException }          

(property) passThroughOnException: any

) expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

TOKEN: 'HONOISCOOL',          

(property) TOKEN: string

requestURL: 'http://localhost/api/foo',          

(property) requestURL: string

}) }) it('Should not use `basePath()` if path argument is not passed', async () => { const request = new

const request: Request

Request('http://localhost/api/error')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

request })          

(property) request?: Request | undefined

const app = new

const app: Hono<BlankEnv, BlankSchema, "/api">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.basePath('/api')          

(method) Hono<BlankEnv, BlankSchema, "/">.basePath<"/api">(path: "/api"): Hono<BlankEnv, BlankSchema, "/api"> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

app

const app: Hono<BlankEnv, BlankSchema, "/api">

.onError(

(property) Hono<BlankEnv, BlankSchema, "/api">.onError: (handler: ErrorHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/api"> .onError() handles an error and returns a customized Response.

@see — https://hono.dev/docs/api/hono#error-handling

@param handler — request Handler for error

@returns — changed Hono instance

@example
ts app.onError((err, c) => { console.error(`${err}`) return c.text('Custom Error Message', 500) })

(e) => {          

(parameter) e: Error | HTTPResponseError

throw e          

(parameter) e: Error | HTTPResponseError

}) app

const app: Hono<BlankEnv, BlankSchema, "/api">

.get('/error', () => {          

(property) Hono<BlankEnv, BlankSchema, "/api">.get: HandlerInterface <"/error", "/api/error", never, BlankInput, BlankEnv>(path: "/error", handler: H<BlankEnv, "/api/error", BlankInput, never>) => Hono<...> (+22 overloads)

throw new Error('Custom Error')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) const handler =

const handler: PagesFunction<unknown, any, Record<string, unknown>>

handle

(alias) handle<BlankEnv, BlankSchema, "" | "/api">(app: Hono<BlankEnv, BlankSchema, "" | "/api">): PagesFunction<unknown, any, Record<string, unknown>> import handle

(app)          

const app: Hono<BlankEnv, BlankSchema, "/api">

// It does throw the error if app is NOT "subApp" expect(() => handler

const handler: (context: EventContext<unknown, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)).toThrowError('Custom Error')          

const eventContext: EventContext<{ TOKEN: string; }>

}) }) describe('Middleware adapter for Cloudflare Pages', () => { it('Should return the middleware response', async () => { const request = new

const request: Request

Request('http://localhost/api/foo', {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

Cookie: 'my_cookie=1234',          

(property) Cookie: string

}, }) const next = vi.fn().mockResolvedValue

const next: any

(Response

var Response: { new (body?: BodyInit | null, init?: ResponseInit): Response; prototype: Response; error(): Response; json(data: any, init?: ResponseInit): Response; redirect(url: string | URL, status?: number): Response; } This Fetch API interface represents the response to a request.

MDN Reference

.json('From Cloudflare Pages'))          

(method) json(data: any, init?: ResponseInit): Response MDN Reference

const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

request,

(property) request?: Request | undefined

next })          

(property) next?: ((input?: Request | string, init?: RequestInit) => Promise<Response>) | undefined

const handler =

const handler: PagesFunction<unknown, any, Record<string, unknown>>

handleMiddleware(async

(alias) handleMiddleware<{}, any, {}>(middleware: MiddlewareHandler<{ Bindings: { eventContext: EventContext; }; }, any, {}>): PagesFunction<unknown, any, Record<string, unknown>> import handleMiddleware

(c,

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

next) => {          

(parameter) next: Next

const cookie =

const cookie: string | undefined

getCookie

(alias) getCookie(c: Context, key: string): string | undefined (+2 overloads) import getCookie

(c, 'my_cookie')          

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

await next()          

(parameter) next: () => Promise<void>

return c

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ cookie: string | undefined; response: any; }, StatusCode>(object: { cookie: string | undefined; response: any; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

cookie,

(property) cookie: string | undefined

response: await

(property) response: any

c

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

.res

(property) Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.json() })          

(method) Body.json(): Promise<any> MDN Reference

}) const res = await

const res: Response

handler

const handler: (context: EventContext<unknown, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)          

const eventContext: EventContext<{ TOKEN: string; }>

expect(next).toHaveBeenCalled()          

const next: any

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

cookie: '1234',          

(property) cookie: string

response: 'From Cloudflare Pages',          

(property) response: string

}) }) it('Should return the middleware response when exceptions are handled', async () => { const request = new

const request: Request

Request('http://localhost/api/foo')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const handler =

const handler: PagesFunction<unknown, any, Record<string, unknown>>

handleMiddleware(async

(alias) handleMiddleware<{}, any, {}>(middleware: MiddlewareHandler<{ Bindings: { eventContext: EventContext; }; }, any, {}>): PagesFunction<unknown, any, Record<string, unknown>> import handleMiddleware

(c,

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

return c

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ error: string | undefined; }, StatusCode>(object: { error: string | undefined; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

error:

(property) error: string | undefined

c

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

.error?

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.error: Error | undefined .error can get the error object from the middleware if the Handler throws an error.

@see — https://hono.dev/docs/api/context#error

@example
ts app.use('*', async (c, next) => { await next() if (c.error) { // do something... } })

.message })          

(property) Error.message: string | undefined

}) const next = vi.fn().mockRejectedValue(new

const next: any

Error('Error from next()'))          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

request,

(property) request?: Request | undefined

next })          

(property) next?: ((input?: Request | string, init?: RequestInit) => Promise<Response>) | undefined

const res = await

const res: Response

handler

const handler: (context: EventContext<unknown, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)          

const eventContext: EventContext<{ TOKEN: string; }>

expect(next).toHaveBeenCalled()          

const next: any

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

error: 'Error from next()',          

(property) error: string

}) }) it('Should return the middleware response if next() is not called', async () => { const request = new

const request: Request

Request('http://localhost/api/foo')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const handler =

const handler: PagesFunction<unknown, any, Record<string, unknown>>

handleMiddleware(async

(alias) handleMiddleware<{}, any, {}>(middleware: MiddlewareHandler<{ Bindings: { eventContext: EventContext; }; }, any, {}>): PagesFunction<unknown, any, Record<string, unknown>> import handleMiddleware

(c) => {          

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

return c

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ response: string; }, StatusCode>(object: { response: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

response: 'Skip Cloudflare Pages' })          

(property) response: string

}) const next = vi.fn()          

const next: any

const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

request,

(property) request?: Request | undefined

next })          

(property) next?: ((input?: Request | string, init?: RequestInit) => Promise<Response>) | undefined

const res = await

const res: Response

handler

const handler: (context: EventContext<unknown, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)          

const eventContext: EventContext<{ TOKEN: string; }>

expect(next).not.toHaveBeenCalled()          

const next: any

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

response: 'Skip Cloudflare Pages',          

(property) response: string

}) }) it('Should return the Pages response if the middleware does not return a response', async () => { const request = new

const request: Request

Request('http://localhost/api/foo')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const handler =

const handler: PagesFunction<unknown, any, Record<string, unknown>>

handleMiddleware(

(alias) handleMiddleware<{}, any, {}>(middleware: MiddlewareHandler<{ Bindings: { eventContext: EventContext; }; }, any, {}>): PagesFunction<unknown, any, Record<string, unknown>> import handleMiddleware

(c,

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

next) =>

(parameter) next: Next

next())          

(parameter) next: () => Promise<void>

const next = vi.fn().mockResolvedValue

const next: any

(Response

var Response: { new (body?: BodyInit | null, init?: ResponseInit): Response; prototype: Response; error(): Response; json(data: any, init?: ResponseInit): Response; redirect(url: string | URL, status?: number): Response; } This Fetch API interface represents the response to a request.

MDN Reference

.json('From Cloudflare Pages'))          

(method) json(data: any, init?: ResponseInit): Response MDN Reference

const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

request,

(property) request?: Request | undefined

next })          

(property) next?: ((input?: Request | string, init?: RequestInit) => Promise<Response>) | undefined

const res = await

const res: Response

handler

const handler: (context: EventContext<unknown, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)          

const eventContext: EventContext<{ TOKEN: string; }>

expect(next).toHaveBeenCalled()          

const next: any

expect(await res

const res: Response

.json()).toEqual('From Cloudflare Pages')          

(method) Body.json(): Promise<any> MDN Reference

}) it('Should handle a HTTPException by returning error.getResponse()', async () => { const request = new

const request: Request

Request('http://localhost/api/foo')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const handler =

const handler: PagesFunction<unknown, any, Record<string, unknown>>

handleMiddleware(() => {          

(alias) handleMiddleware<{}, any, {}>(middleware: MiddlewareHandler<{ Bindings: { eventContext: EventContext; }; }, any, {}>): PagesFunction<unknown, any, Record<string, unknown>> import handleMiddleware

const res = new

const res: Response

Response('Unauthorized', {

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 401 })          

(property) ResponseInit.status?: number | undefined

throw new HTTPException(401, {

(alias) new HTTPException(status?: StatusCode, options?: HTTPExceptionOptions): HTTPException import HTTPException Creates an instance of HTTPException.

@param status — HTTP status code for the exception. Defaults to 500.

@param options — Additional options for the exception.

res })          

(property) res?: Response | undefined

}) const next = vi.fn()          

const next: any

const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

request,

(property) request?: Request | undefined

next })          

(property) next?: ((input?: Request | string, init?: RequestInit) => Promise<Response>) | undefined

const res = await

const res: Response

handler

const handler: (context: EventContext<unknown, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)          

const eventContext: EventContext<{ TOKEN: string; }>

expect(next).not.toHaveBeenCalled()          

const next: any

expect(res

const res: Response

.status).toBe(401)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Unauthorized')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should handle an HTTPException thrown by next()', async () => { const request = new

const request: Request

Request('http://localhost/api/foo')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const handler =

const handler: PagesFunction<unknown, any, Record<string, unknown>>

handleMiddleware(

(alias) handleMiddleware<{}, any, {}>(middleware: MiddlewareHandler<{ Bindings: { eventContext: EventContext; }; }, any, {}>): PagesFunction<unknown, any, Record<string, unknown>> import handleMiddleware

(c,

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

next) =>

(parameter) next: Next

next())          

(parameter) next: () => Promise<void>

const next = vi          

const next: any

.fn() .mockRejectedValue(new HTTPException(401, {

(alias) new HTTPException(status?: StatusCode, options?: HTTPExceptionOptions): HTTPException import HTTPException Creates an instance of HTTPException.

@param status — HTTP status code for the exception. Defaults to 500.

@param options — Additional options for the exception.

res:

(property) res?: Response | undefined

Response

var Response: { new (body?: BodyInit | null, init?: ResponseInit): Response; prototype: Response; error(): Response; json(data: any, init?: ResponseInit): Response; redirect(url: string | URL, status?: number): Response; } This Fetch API interface represents the response to a request.

MDN Reference

.json('Unauthorized') }))          

(method) json(data: any, init?: ResponseInit): Response MDN Reference

const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

request,

(property) request?: Request | undefined

next })          

(property) next?: ((input?: Request | string, init?: RequestInit) => Promise<Response>) | undefined

const res = await

const res: Response

handler

const handler: (context: EventContext<unknown, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)          

const eventContext: EventContext<{ TOKEN: string; }>

expect(next).toHaveBeenCalled()          

const next: any

expect(await res

const res: Response

.json()).toEqual('Unauthorized')          

(method) Body.json(): Promise<any> MDN Reference

}) it('Should handle an Error thrown by next()', async () => { const request = new

const request: Request

Request('http://localhost/api/foo')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const handler =

const handler: PagesFunction<unknown, any, Record<string, unknown>>

handleMiddleware(

(alias) handleMiddleware<{}, any, {}>(middleware: MiddlewareHandler<{ Bindings: { eventContext: EventContext; }; }, any, {}>): PagesFunction<unknown, any, Record<string, unknown>> import handleMiddleware

(c,

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

next) =>

(parameter) next: Next

next())          

(parameter) next: () => Promise<void>

const next = vi.fn().mockRejectedValue(new

const next: any

Error('Error from next()'))          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

request,

(property) request?: Request | undefined

next })          

(property) next?: ((input?: Request | string, init?: RequestInit) => Promise<Response>) | undefined

await expect(handler

const handler: (context: EventContext<unknown, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)).rejects.toThrowError('Error from next()')          

const eventContext: EventContext<{ TOKEN: string; }>

expect(next).toHaveBeenCalled()          

const next: any

}) it('Should handle a non-Error thrown by next()', async () => { const request = new

const request: Request

Request('http://localhost/api/foo')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const handler =

const handler: PagesFunction<unknown, any, Record<string, unknown>>

handleMiddleware(

(alias) handleMiddleware<{}, any, {}>(middleware: MiddlewareHandler<{ Bindings: { eventContext: EventContext; }; }, any, {}>): PagesFunction<unknown, any, Record<string, unknown>> import handleMiddleware

(c,

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

next) =>

(parameter) next: Next

next())          

(parameter) next: () => Promise<void>

const next = vi.fn().mockRejectedValue('Error from next()')          

const next: any

const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

request,

(property) request?: Request | undefined

next })          

(property) next?: ((input?: Request | string, init?: RequestInit) => Promise<Response>) | undefined

await expect(handler

const handler: (context: EventContext<unknown, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)).rejects.toThrowError('Error from next()')          

const eventContext: EventContext<{ TOKEN: string; }>

expect(next).toHaveBeenCalled()          

const next: any

}) it('Should rethrow an Error', async () => { const request = new

const request: Request

Request('http://localhost/api/foo')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const handler =

const handler: PagesFunction<unknown, any, Record<string, unknown>>

handleMiddleware(() => {          

(alias) handleMiddleware<{}, any, {}>(middleware: MiddlewareHandler<{ Bindings: { eventContext: EventContext; }; }, any, {}>): PagesFunction<unknown, any, Record<string, unknown>> import handleMiddleware

throw new Error('Something went wrong')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) const next = vi.fn()          

const next: any

const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

request,

(property) request?: Request | undefined

next })          

(property) next?: ((input?: Request | string, init?: RequestInit) => Promise<Response>) | undefined

await expect(handler

const handler: (context: EventContext<unknown, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)).rejects.toThrowError('Something went wrong')          

const eventContext: EventContext<{ TOKEN: string; }>

expect(next).not.toHaveBeenCalled()          

const next: any

}) it('Should rethrow non-Error exceptions', async () => { const request = new

const request: Request

Request('http://localhost/api/foo')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const handler =

const handler: PagesFunction<unknown, any, Record<string, unknown>>

handleMiddleware(() =>

(alias) handleMiddleware<{}, any, {}>(middleware: MiddlewareHandler<{ Bindings: { eventContext: EventContext; }; }, any, {}>): PagesFunction<unknown, any, Record<string, unknown>> import handleMiddleware

Promise

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

.reject('Something went wrong'))          

(method) PromiseConstructor.reject<void | Response>(reason?: any): Promise<void | Response> Creates a new rejected promise for the provided reason.

@param reason — The reason the promise was rejected.

@returns — A new rejected Promise.

const next = vi.fn()          

const next: any

const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

request,

(property) request?: Request | undefined

next })          

(property) next?: ((input?: Request | string, init?: RequestInit) => Promise<Response>) | undefined

await expect(handler

const handler: (context: EventContext<unknown, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)).rejects.toThrowError('Something went wrong')          

const eventContext: EventContext<{ TOKEN: string; }>

expect(next).not.toHaveBeenCalled()          

const next: any

}) it('Should set the data in eventContext.data', async () => { const next = vi.fn()          

const next: any

const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

next })          

(property) next?: ((input?: Request | string, init?: RequestInit) => Promise<Response>) | undefined

const handler =

const handler: PagesFunction<unknown, any, Record<string, unknown>>

handleMiddleware(async

(alias) handleMiddleware<{}, any, {}>(middleware: MiddlewareHandler<{ Bindings: { eventContext: EventContext; }; }, any, {}>): PagesFunction<unknown, any, Record<string, unknown>> import handleMiddleware

(c,

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>

.env

(property) Context<{ Bindings: { eventContext: EventContext; }; }, any, {}>.env: { eventContext: EventContext; } .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

.eventContext

(property) eventContext: EventContext<{}, any, Record<string, unknown>>

.data.user = 'Joe'          

(property) data: Record<string, unknown>

await next()          

(parameter) next: () => Promise<void>

}) expect(eventContext

const eventContext: EventContext<{ TOKEN: string; }>

.data.user).toBeUndefined()          

(property) data: Record<string, unknown>

await handler

const handler: (context: EventContext<unknown, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)          

const eventContext: EventContext<{ TOKEN: string; }>

expect(eventContext

const eventContext: EventContext<{ TOKEN: string; }>

.data.user).toBe('Joe')          

(property) data: Record<string, unknown>

}) }) describe('serveStatic()', () => { it('Should pass the raw request to ASSETS.fetch', async () => { const assetsFetch = vi.fn().mockResolvedValue(new

const assetsFetch: any

Response('foo.png'))          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

const request = new

const request: Request

Request('http://localhost/foo.png')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const env = {          

const env: { ASSETS: { fetch: any; }; TOKEN: string; }

ASSETS: {

(property) ASSETS: { fetch: any; }

fetch:

(property) fetch: any

assetsFetch },          

const assetsFetch: any

TOKEN: 'HONOISCOOL',          

(property) TOKEN: string

} const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

request,

(property) request?: Request | undefined

env })          

(property) env?: ({ TOKEN: string; } & { ASSETS: { fetch: typeof fetch; }; }) | undefined

const app = new

const app: Hono<Env, BlankSchema, "/">

Hono

(alias) new Hono<Env, BlankSchema, "/">(options?: HonoOptions<Env>): Hono<Env, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

<Env>()          

type Env = { Bindings: { TOKEN: string; }; }

app

const app: Hono<Env, BlankSchema, "/">

.use

(property) Hono<Env, BlankSchema, "/">.use: MiddlewareHandlerInterface <any>(...handlers: MiddlewareHandler<any, never, {}>[]) => Hono<Env, BlankSchema, "/"> (+20 overloads)

(serveStatic())          

(alias) serveStatic(): MiddlewareHandler import serveStatic

@description
serveStatic() is for advanced mode: https://developers.cloudflare.com/pages/platform/functions/advanced-mode/#set-up-a-function

const handler =

const handler: PagesFunction<{ TOKEN: string; }, any, Record<string, unknown>>

handle

(alias) handle<Env, BlankSchema, "/">(app: Hono<Env, BlankSchema, "/">): PagesFunction<{ TOKEN: string; }, any, Record<string, unknown>> import handle

(app)          

const app: Hono<Env, BlankSchema, "/">

const res = await

const res: Response

handler

const handler: (context: EventContext<{ TOKEN: string; }, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)          

const eventContext: EventContext<{ TOKEN: string; }>

expect(assetsFetch).toHaveBeenCalledWith

const assetsFetch: any

(request)          

const request: Request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('foo.png')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should respond with 404 if ASSETS.fetch returns a 404 response', async () => { const assetsFetch = vi.fn().mockResolvedValue(new

const assetsFetch: any

Response(null, {

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 404 }))          

(property) ResponseInit.status?: number | undefined

const request = new

const request: Request

Request('http://localhost/foo.png')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const env = {          

const env: { ASSETS: { fetch: any; }; TOKEN: string; }

ASSETS: {

(property) ASSETS: { fetch: any; }

fetch:

(property) fetch: any

assetsFetch },          

const assetsFetch: any

TOKEN: 'HONOISCOOL',          

(property) TOKEN: string

} const eventContext =

const eventContext: EventContext<{ TOKEN: string; }>

createEventContext({

function createEventContext(context: Partial<EventContext<Env["Bindings"]>>): EventContext<Env["Bindings"]>

request,

(property) request?: Request | undefined

env })          

(property) env?: ({ TOKEN: string; } & { ASSETS: { fetch: typeof fetch; }; }) | undefined

const app = new

const app: Hono<Env, BlankSchema, "/">

Hono

(alias) new Hono<Env, BlankSchema, "/">(options?: HonoOptions<Env>): Hono<Env, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

<Env>()          

type Env = { Bindings: { TOKEN: string; }; }

app

const app: Hono<Env, BlankSchema, "/">

.use

(property) Hono<Env, BlankSchema, "/">.use: MiddlewareHandlerInterface <any>(...handlers: MiddlewareHandler<any, never, {}>[]) => Hono<Env, BlankSchema, "/"> (+20 overloads)

(serveStatic())          

(alias) serveStatic(): MiddlewareHandler import serveStatic

@description
serveStatic() is for advanced mode: https://developers.cloudflare.com/pages/platform/functions/advanced-mode/#set-up-a-function

const handler =

const handler: PagesFunction<{ TOKEN: string; }, any, Record<string, unknown>>

handle

(alias) handle<Env, BlankSchema, "/">(app: Hono<Env, BlankSchema, "/">): PagesFunction<{ TOKEN: string; }, any, Record<string, unknown>> import handle

(app)          

const app: Hono<Env, BlankSchema, "/">

const res = await

const res: Response

handler

const handler: (context: EventContext<{ TOKEN: string; }, any, Record<string, unknown>>) => Response | Promise<Response>

(eventContext)          

const eventContext: EventContext<{ TOKEN: string; }>

expect(assetsFetch).toHaveBeenCalledWith

const assetsFetch: any

(request)          

const request: Request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) })
src/adapter/cloudflare-pages/handler.ts
            
                import { Context } from '../../context'
                import type { Hono } from '../../hono'
                import { HTTPException } from '../../http-exception'
                import type { BlankSchema, Env, Input, MiddlewareHandler, Schema } from '../../types'
                
                // Ref: https://github.com/cloudflare/workerd/blob/main/types/defines/pages.d.ts
                
                // eslint-disable-next-line @typescript-eslint/no-explicit-any
                type Params

type Params<P extends string = any> = { [P in P]: string | string[]; }

<P extends string = any> =

(type parameter) P in type Params<P extends string = any>

Record

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

<P, string | string[]>          

(type parameter) P in type Params<P extends string = any>

// eslint-disable-next-line @typescript-eslint/no-explicit-any export type EventContext

type EventContext<Env = {}, P extends string = any, Data = Record<string, unknown>> = { request: Request; functionPath: string; waitUntil: (promise: Promise<unknown>) => void; passThroughOnException: () => void; next: (input?: Request | string, init?: RequestInit) => Promise<Response>; env: Env & { ASSETS: { fetch: typeof fetch; }; }; params: Params<P>; data: Data; }

<Env = {},

(type parameter) Env in type EventContext<Env = {}, P extends string = any, Data = Record<string, unknown>>

P extends string = any,

(type parameter) P in type EventContext<Env = {}, P extends string = any, Data = Record<string, unknown>>

Data =

(type parameter) Data in type EventContext<Env = {}, P extends string = any, Data = Record<string, unknown>>

Record> = {          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

request:

(property) request: Request

Request          

interface Request This Fetch API interface represents a resource request.

MDN Reference

functionPath: string          

(property) functionPath: string

waitUntil:

(property) waitUntil: (promise: Promise<unknown>) => void

(promise:

(parameter) promise: Promise<unknown>

Promise) => void          

interface Promise<T> Represents the completion of an asynchronous operation

passThroughOnException: () => void          

(property) passThroughOnException: () => void

next:

(property) next: (input?: Request | string, init?: RequestInit) => Promise<Response>

(input?:

(parameter) input: string | Request | undefined

Request | string,

interface Request This Fetch API interface represents a resource request.

MDN Reference

init?:

(parameter) init: RequestInit | undefined

RequestInit) =>

interface RequestInit

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response>          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

env:

(property) env: Env & { ASSETS: { fetch: typeof fetch; }; }

Env & {

(type parameter) Env in type EventContext<Env = {}, P extends string = any, Data = Record<string, unknown>>

ASSETS: {

(property) ASSETS: { fetch: typeof fetch; }

fetch: typeof

(property) fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>

fetch } }          

function fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response> MDN Reference

params:

(property) params: Params<P>

Params

type Params<P extends string = any> = { [P in P]: string | string[]; }

<P>          

(type parameter) P in type EventContext<Env = {}, P extends string = any, Data = Record<string, unknown>>

data:

(property) data: Data = Record<string, unknown>

Data          

(type parameter) Data in type EventContext<Env = {}, P extends string = any, Data = Record<string, unknown>>

} declare type PagesFunction<          

type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>

Env = unknown,          

(type parameter) Env in type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>>

// eslint-disable-next-line @typescript-eslint/no-explicit-any Params extends string = any,          

(type parameter) Params in type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>>

Data extends

(type parameter) Data in type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>>

Record =

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

> = (context:

(parameter) context: EventContext<Env, Params, Data>

EventContext

type EventContext<Env = {}, P extends string = any, Data = Record<string, unknown>> = { request: Request; functionPath: string; waitUntil: (promise: Promise<unknown>) => void; passThroughOnException: () => void; next: (input?: Request | string, init?: RequestInit) => Promise<Response>; env: Env & { ASSETS: { fetch: typeof fetch; }; }; params: Params<P>; data: Data; }

<Env,

(type parameter) Env in type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>>

Params,

(type parameter) Params in type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>>

Data>) =>

(type parameter) Data in type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>>

Response |

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response>          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

export const handle =          

const handle: <E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = "/">(app: Hono<E, S, BasePath>) => PagesFunction<E["Bindings"]>

<E extends

(type parameter) E in <E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = "/">(app: Hono<E, S, BasePath>): PagesFunction<E["Bindings"]>

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env,

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

S extends

(type parameter) S in <E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = "/">(app: Hono<E, S, BasePath>): PagesFunction<E["Bindings"]>

Schema =

(alias) type Schema = { [Path: string]: { [Method: `$${Lowercase<string>}`]: Endpoint; }; } import Schema

BlankSchema,

(alias) type BlankSchema = {} import BlankSchema

BasePath extends string = '/'>(          

(type parameter) BasePath in <E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = "/">(app: Hono<E, S, BasePath>): PagesFunction<E["Bindings"]>

app:

(parameter) app: Hono<E, S, BasePath>

Hono

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

<E,

(type parameter) E in <E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = "/">(app: Hono<E, S, BasePath>): PagesFunction<E["Bindings"]>

S,

(type parameter) S in <E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = "/">(app: Hono<E, S, BasePath>): PagesFunction<E["Bindings"]>

BasePath>          

(type parameter) BasePath in <E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = "/">(app: Hono<E, S, BasePath>): PagesFunction<E["Bindings"]>

): PagesFunction

type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>

<E['Bindings']> =>          

(type parameter) E in <E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = "/">(app: Hono<E, S, BasePath>): PagesFunction<E["Bindings"]>

(eventContext) => {          

(parameter) eventContext: EventContext<E["Bindings"], any, Record<string, unknown>>

return app

(parameter) app: Hono<E, S, BasePath>

.fetch(          

(property) Hono<E, S, BasePath>.fetch: (request: Request, Env?: {} | E["Bindings"] | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .fetch() will be entry point of your app.

@see — https://hono.dev/docs/api/hono#fetch

@param request — request Object of request

@param Env — env Object

@param — - context of execution

@returns — response of request

eventContext

(parameter) eventContext: EventContext<E["Bindings"], any, Record<string, unknown>>

.request,          

(property) request: Request

{ ...eventContext

(parameter) eventContext: EventContext<E["Bindings"], any, Record<string, unknown>>

.env,

(property) env: E["Bindings"] & { ASSETS: { fetch: typeof fetch; }; }

eventContext },          

(property) eventContext: EventContext<E["Bindings"], any, Record<string, unknown>>

{ waitUntil:

(method) ExecutionContext.waitUntil(promise: Promise<unknown>): void Extends the lifetime of the event callback until the promise is settled.

@param promise — A promise to wait for.

eventContext

(parameter) eventContext: EventContext<E["Bindings"], any, Record<string, unknown>>

.waitUntil,          

(property) waitUntil: (promise: Promise<unknown>) => void

passThroughOnException:

(method) ExecutionContext.passThroughOnException(): void Allows the event to be passed through to subsequent event listeners.

eventContext

(parameter) eventContext: EventContext<E["Bindings"], any, Record<string, unknown>>

.passThroughOnException,          

(property) passThroughOnException: () => void

} ) } // eslint-disable-next-line @typescript-eslint/no-explicit-any export function handleMiddleware

function handleMiddleware<E extends Env = {}, P extends string = any, I extends Input = {}>(middleware: MiddlewareHandler<E & { Bindings: { eventContext: EventContext; }; }, P, I>): PagesFunction<E["Bindings"]>

<E extends

(type parameter) E in handleMiddleware<E extends Env = {}, P extends string = any, I extends Input = {}>(middleware: MiddlewareHandler<E & { Bindings: { eventContext: EventContext; }; }, P, I>): PagesFunction<E["Bindings"]>

Env = {},

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

P extends string = any,

(type parameter) P in handleMiddleware<E extends Env = {}, P extends string = any, I extends Input = {}>(middleware: MiddlewareHandler<E & { Bindings: { eventContext: EventContext; }; }, P, I>): PagesFunction<E["Bindings"]>

I extends

(type parameter) I in handleMiddleware<E extends Env = {}, P extends string = any, I extends Input = {}>(middleware: MiddlewareHandler<E & { Bindings: { eventContext: EventContext; }; }, P, I>): PagesFunction<E["Bindings"]>

Input = {}>(          

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

middleware:

(parameter) middleware: MiddlewareHandler<E & { Bindings: { eventContext: EventContext; }; }, P, I>

MiddlewareHandler<          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

E & {          

(type parameter) E in handleMiddleware<E extends Env = {}, P extends string = any, I extends Input = {}>(middleware: MiddlewareHandler<E & { Bindings: { eventContext: EventContext; }; }, P, I>): PagesFunction<E["Bindings"]>

Bindings: {          

(property) Bindings: { eventContext: EventContext; }

eventContext:

(property) eventContext: EventContext<{}, any, Record<string, unknown>>

EventContext          

type EventContext<Env = {}, P extends string = any, Data = Record<string, unknown>> = { request: Request; functionPath: string; waitUntil: (promise: Promise<unknown>) => void; passThroughOnException: () => void; next: (input?: Request | string, init?: RequestInit) => Promise<Response>; env: Env & { ASSETS: { fetch: typeof fetch; }; }; params: Params<P>; data: Data; }

} }, P,          

(type parameter) P in handleMiddleware<E extends Env = {}, P extends string = any, I extends Input = {}>(middleware: MiddlewareHandler<E & { Bindings: { eventContext: EventContext; }; }, P, I>): PagesFunction<E["Bindings"]>

I          

(type parameter) I in handleMiddleware<E extends Env = {}, P extends string = any, I extends Input = {}>(middleware: MiddlewareHandler<E & { Bindings: { eventContext: EventContext; }; }, P, I>): PagesFunction<E["Bindings"]>

> ): PagesFunction

type PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>

<E['Bindings']> {          

(type parameter) E in handleMiddleware<E extends Env = {}, P extends string = any, I extends Input = {}>(middleware: MiddlewareHandler<E & { Bindings: { eventContext: EventContext; }; }, P, I>): PagesFunction<E["Bindings"]>

return async (executionCtx) => {          

(parameter) executionCtx: EventContext<E["Bindings"], any, Record<string, unknown>>

const context = new

const context: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(executionCtx

(parameter) executionCtx: EventContext<E["Bindings"], any, Record<string, unknown>>

.request, {          

(property) request: Request

env: { ..

(property) env: any Bindings for the environment.

.executionCtx

(parameter) executionCtx: EventContext<E["Bindings"], any, Record<string, unknown>>

.env,

(property) env: object & { ASSETS: { fetch: typeof fetch; }; }

eventContext:

(property) eventContext: EventContext<E["Bindings"], any, Record<string, unknown>>

executionCtx },          

(parameter) executionCtx: EventContext<E["Bindings"], any, Record<string, unknown>>

executionCtx,          

(property) executionCtx?: FetchEventLike | ExecutionContext | undefined Execution context for the request.

}) let response:

let response: void | Response

Response | void = undefined          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

try { response = await

let response: void | Response

middleware

(parameter) middleware: (c: Context<E & { Bindings: { eventContext: EventContext; }; }, P, I>, next: Next) => Promise<Response | void>

(context, async () => {          

const context: Context<any, any, {}>

try { context

const context: Context<any, any, {}>

.res = await

(property) Context<any, any, {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

executionCtx

(parameter) executionCtx: EventContext<E["Bindings"], any, Record<string, unknown>>

.next()          

(property) next: (input?: Request | string, init?: RequestInit) => Promise<Response>

} catch (error) {          

(local var) error: unknown

if (error instanceof

(local var) error: unknown

Error) {          

var Error: ErrorConstructor

context

const context: Context<any, any, {}>

.error =

(property) Context<any, any, {}>.error: Error | undefined .error can get the error object from the middleware if the Handler throws an error.

@see — https://hono.dev/docs/api/context#error

@example
ts app.use('*', async (c, next) => { await next() if (c.error) { // do something... } })

error          

(local var) error: Error

} else { throw error          

(local var) error: unknown

} } }) } catch (error) {          

(local var) error: unknown

if (error instanceof

(local var) error: unknown

Error) {          

var Error: ErrorConstructor

context

const context: Context<any, any, {}>

.error =

(property) Context<any, any, {}>.error: Error | undefined .error can get the error object from the middleware if the Handler throws an error.

@see — https://hono.dev/docs/api/context#error

@example
ts app.use('*', async (c, next) => { await next() if (c.error) { // do something... } })

error          

(local var) error: Error

} else { throw error          

(local var) error: unknown

} } if (response) {          

let response: void | Response

return response          

let response: Response

} if (context

const context: Context<any, any, {}>

.error instanceof

(property) Context<any, any, {}>.error: Error | undefined .error can get the error object from the middleware if the Handler throws an error.

@see — https://hono.dev/docs/api/context#error

@example
ts app.use('*', async (c, next) => { await next() if (c.error) { // do something... } })

HTTPException) {          

(alias) class HTTPException import HTTPException HTTPException must be used when a fatal error such as authentication failure occurs.

@see — https://hono.dev/docs/api/exception

@param status — status code of HTTPException

@param options — options of HTTPException

@param options.res — response of options of HTTPException

@param options.message — message of options of HTTPException

@param options.cause — cause of options of HTTPException

@example
```ts import { HTTPException } from 'hono/http-exception'

// ...

app.post('/auth', async (c, next) => { // authentication if (authorized === false) { throw new HTTPException(401, { message: 'Custom error message' }) } await next() }) ```

return context

const context: Context<any, any, {}>

.error

(property) Context<any, any, {}>.error: HTTPException .error can get the error object from the middleware if the Handler throws an error.

@see — https://hono.dev/docs/api/context#error

@example
ts app.use('*', async (c, next) => { await next() if (c.error) { // do something... } })

.getResponse()          

(method) HTTPException.getResponse(): Response Returns the response object associated with the exception. If a response object is not provided, a new response is created with the error message and status code.

@returns — The response object.

} if (context

const context: Context<any, any, {}>

.error) {          

(property) Context<any, any, {}>.error: Error | undefined .error can get the error object from the middleware if the Handler throws an error.

@see — https://hono.dev/docs/api/context#error

@example
ts app.use('*', async (c, next) => { await next() if (c.error) { // do something... } })

throw context

const context: Context<any, any, {}>

.error          

(property) Context<any, any, {}>.error: Error .error can get the error object from the middleware if the Handler throws an error.

@see — https://hono.dev/docs/api/context#error

@example
ts app.use('*', async (c, next) => { await next() if (c.error) { // do something... } })

} return context

const context: Context<any, any, {}>

.res          

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

} } declare abstract class FetcherLike {          

class FetcherLike

fetch

(method) FetcherLike.fetch(input: RequestInfo, init?: RequestInit): Promise<Response>

(input:

(parameter) input: RequestInfo

RequestInfo,

type RequestInfo = string | Request

init?:

(parameter) init: RequestInit | undefined

RequestInit):

interface RequestInit

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response>          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

} /** * * @description `serveStatic()` is for advanced mode: * https://developers.cloudflare.com/pages/platform/functions/advanced-mode/#set-up-a-function * */ export const serveStatic = ():

const serveStatic: () => MiddlewareHandler

@description
serveStatic() is for advanced mode: https://developers.cloudflare.com/pages/platform/functions/advanced-mode/#set-up-a-function

MiddlewareHandler => {          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

return async (c) => {          

(parameter) c: Context<any, string, {}>

const env =

const env: { ASSETS: FetcherLike; }

c

(parameter) c: Context<any, string, {}>

.env as {

(property) Context<any, string, {}>.env: any .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

ASSETS:

(property) ASSETS: FetcherLike

FetcherLike }          

class FetcherLike

const res = await

const res: Response

env

const env: { ASSETS: FetcherLike; }

.ASSETS

(property) ASSETS: FetcherLike

.fetch

(method) FetcherLike.fetch(input: RequestInfo, init?: RequestInit): Promise<Response>

(c

(parameter) c: Context<any, string, {}>

.req

(property) Context<any, string, {}>.req: HonoRequest<string, unknown> .req is the instance of HonoRequest.

.raw)          

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

if (res

const res: Response

.status === 404) {          

(property) Response.status: number MDN Reference

return c

(parameter) c: Context<any, string, {}>

.notFound()          

(property) Context<any, string, {}>.notFound: () => Response | Promise<Response> .notFound() can return the Not Found Response.

@see — https://hono.dev/docs/api/context#notfound

@example
ts app.get('/notfound', (c) => { return c.notFound() })

} return res          

const res: Response

} }
src/adapter/cloudflare-pages/index.ts
            
                /**
                 * @module
                 * Cloudflare Pages Adapter for Hono.
                 */
                
                export { handle,

(alias) const handle: <E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = "/">(app: Hono<E, S, BasePath>) => PagesFunction<E["Bindings"], any, Record<string, unknown>> export handle

handleMiddleware,

(alias) function handleMiddleware<E extends Env = {}, P extends string = any, I extends Input = {}>(middleware: MiddlewareHandler<E & { Bindings: { eventContext: EventContext; }; }, P, I>): PagesFunction<...> export handleMiddleware

serveStatic } from './handler'          

(alias) const serveStatic: () => MiddlewareHandler export serveStatic

@description
serveStatic() is for advanced mode: https://developers.cloudflare.com/pages/platform/functions/advanced-mode/#set-up-a-function

export type { EventContext } from './handler'          

(alias) type EventContext<Env = {}, P extends string = any, Data = Record<string, unknown>> = { request: Request; functionPath: string; waitUntil: (promise: Promise<unknown>) => void; passThroughOnException: () => void; next: (input?: Request | string, init?: RequestInit) => Promise<Response>; env: Env & { ASSETS: { fetch: typeof fetch; }; }; params: Params<...>; data: Data; } export EventContext

src/adapter/cloudflare-workers/conninfo.test.ts
            
                import { Context } from '../../context'
                import { getConnInfo } from './conninfo'
                
                describe('getConnInfo', () => {
                  it('Should getConnInfo works', () => {
                    const address =

const address: string

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random()

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

.toString()          

(method) Number.toString(radix?: number): string Returns a string representation of an object.

@param radix — Specifies a radix for converting numeric values to strings. This value is only used for numbers.

const req = new

const req: Request

Request('http://localhost/', {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

'cf-connecting-ip': address,          

const address: string

}, }) const c = new

const c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

const info =

const info: ConnInfo

getConnInfo

(alias) getConnInfo(c: Context): ConnInfo import getConnInfo

(c)          

const c: Context<any, any, {}>

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.address).toBe

(property) address?: string | undefined Host name such as IP Addr

(address)          

const address: string

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.addressType).toBeUndefined()          

(property) addressType?: AddressType Host name type

}) })
src/adapter/cloudflare-workers/conninfo.ts
            
                import type { GetConnInfo } from '../../helper/conninfo'
                
                export const getConnInfo:

const getConnInfo: GetConnInfo

GetConnInfo =

(alias) type GetConnInfo = (c: Context) => ConnInfo import GetConnInfo Helper type

(c) => ({          

(parameter) c: Context<any, any, {}>

remote: {          

(property) ConnInfo.remote: NetAddrInfo Remote information

address:

(property) address: string | undefined

c

(parameter) c: Context<any, any, {}>

.req

(property) Context<any, any, {}>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.header('cf-connecting-ip'),          

(method) HonoRequest<any, unknown>.header(name: string): string | undefined (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

}, })
src/adapter/cloudflare-workers/index.ts
            
                /**
                 * @module
                 * Cloudflare Workers Adapter for Hono.
                 */
                
                export { serveStatic } from './serve-static-module'          

(alias) const serveStatic: <E extends Env = Env>(options: Omit<ServeStaticOptions<E>, "namespace">) => MiddlewareHandler export serveStatic

export { upgradeWebSocket } from './websocket'          

(alias) const upgradeWebSocket: UpgradeWebSocket<WebSocket> export upgradeWebSocket

export { getConnInfo } from './conninfo'          

(alias) const getConnInfo: GetConnInfo export getConnInfo

src/adapter/cloudflare-workers/serve-static-module.ts
            
                // For ES module mode
                import type { Env, MiddlewareHandler } from '../../types'
                import type { ServeStaticOptions } from './serve-static'
                import { serveStatic } from './serve-static'
                
                const module = 

const module: <E extends Env = Env>(options: Omit<ServeStaticOptions<E>, "namespace">) => MiddlewareHandler

<E extends

(type parameter) E in <E extends Env = Env>(options: Omit<ServeStaticOptions<E>, "namespace">): MiddlewareHandler

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env>(          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

options:

(parameter) options: Omit<ServeStaticOptions<E>, "namespace">

Omit

type Omit<T, K extends keyof any> = { [P in Exclude<keyof T, K>]: T[P]; } Construct a type with the properties of T except for those in type K.

<ServeStaticOptions

(alias) type ServeStaticOptions<E extends Env = Env> = ServeStaticOptions<E> & { namespace?: unknown; manifest: object | string; } import ServeStaticOptions

<E>, 'namespace'>          

(type parameter) E in <E extends Env = Env>(options: Omit<ServeStaticOptions<E>, "namespace">): MiddlewareHandler

): MiddlewareHandler => {          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

return serveStatic

(alias) serveStatic<E>(options: ServeStaticOptions<E>): MiddlewareHandler import serveStatic

@deprecated
serveStatic in the Cloudflare Workers adapter is deprecated. If you want to create an application serving static assets, please consider using Cloudflare Pages. You can start to create the Cloudflare Pages application with the npm create hono@latest command.

<E>

(type parameter) E in <E extends Env = Env>(options: Omit<ServeStaticOptions<E>, "namespace">): MiddlewareHandler

(options)          

(parameter) options: Omit<ServeStaticOptions<E>, "namespace">

} export { module as

const module: <E extends Env = Env>(options: Omit<ServeStaticOptions<E>, "namespace">) => MiddlewareHandler

serveStatic }          

(alias) const serveStatic: <E extends Env = Env>(options: Omit<ServeStaticOptions<E>, "namespace">) => MiddlewareHandler export serveStatic

src/adapter/cloudflare-workers/serve-static.test.ts
            
                import type { Context } from '../../context'
                import { Hono } from '../../hono'
                import type { Next } from '../../types'
                import { serveStatic } from './serve-static'
                
                // Mock
                const store:

const store: Record<string, string>

Record = {          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

'assets/static/plain.abcdef.txt': 'This is plain.txt', 'assets/static/hono.abcdef.html': '

Hono!

',
'assets/static/top/index.abcdef.html': '

Top

',
'static-no-root/plain.abcdef.txt': 'That is plain.txt', 'assets/static/options/foo.abcdef.txt': 'With options', 'assets/.static/plain.abcdef.txt': 'In the dot', 'assets/static/video/morning-routine.abcdef.m3u8': 'Good morning', 'assets/static/video/morning-routine1.abcdef.ts': 'Good', 'assets/static/video/introduction.abcdef.mp4': 'Let me introduce myself', 'assets/static/download': 'download', } const manifest =

const manifest: string

JSON

var JSON: JSON An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.

.stringify({          

(method) JSON.stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string (+1 overload) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.

@param value — A JavaScript value, usually an object or array, to be converted.

@param replacer — A function that transforms the results.

@param space — Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.

'assets/static/plain.txt': 'assets/static/plain.abcdef.txt', 'assets/static/hono.html': 'assets/static/hono.abcdef.html', 'assets/static/top/index.html': 'assets/static/top/index.abcdef.html', 'static-no-root/plain.txt': 'static-no-root/plain.abcdef.txt', 'assets/.static/plain.txt': 'assets/.static/plain.abcdef.txt', 'assets/static/download': 'assets/static/download', }) Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.assign(global, {

(method) ObjectConstructor.assign<any, { __STATIC_CONTENT_MANIFEST: string; }>(target: any, source: { __STATIC_CONTENT_MANIFEST: string; }): any (+3 overloads) Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object.

@param target — The target object to copy to.

@param source — The source object from which to copy properties.

__STATIC_CONTENT_MANIFEST:

(property) __STATIC_CONTENT_MANIFEST: string

manifest })          

const manifest: string

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.assign(global, {          

(method) ObjectConstructor.assign<any, { __STATIC_CONTENT: { get: (path: string) => string; }; }>(target: any, source: { __STATIC_CONTENT: { get: (path: string) => string; }; }): any (+3 overloads) Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object.

@param target — The target object to copy to.

@param source — The source object from which to copy properties.

__STATIC_CONTENT: {          

(property) __STATIC_CONTENT: { get: (path: string) => string; }

get:

(property) get: (path: string) => string

(path: string) => {          

(parameter) path: string

return store

const store: Record<string, string>

[path]          

(parameter) path: string

}, }, }) describe('ServeStatic Middleware', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const onNotFound = vi.fn(() => {})          

const onNotFound: any

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/static/*',

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/static/*", "/static/*", any>(path: "/static/*", handler: MiddlewareHandler<any, "/static/*", {}>) => Hono<{}, { "/static/*": {}; }, "/"> (+20 overloads)

serveStatic({

(alias) serveStatic<Env>(options: ServeStaticOptions<Env>): MiddlewareHandler import serveStatic

@deprecated
serveStatic in the Cloudflare Workers adapter is deprecated. If you want to create an application serving static assets, please consider using Cloudflare Pages. You can start to create the Cloudflare Pages application with the npm create hono@latest command.

root: './assets',

(property) root?: string | undefined

onNotFound,

(property) onNotFound?: ((path: string, c: Context<Env, any, {}>) => void | Promise<void>) | undefined

manifest }))          

(property) manifest: string | object

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/static-no-root/*',

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/static-no-root/*", "/static-no-root/*", any>(path: "/static-no-root/*", handler: MiddlewareHandler<any, "/static-no-root/*", {}>) => Hono<{}, { "/static-no-root/*": {}; }, "/"> (+20 overloads)

serveStatic({

(alias) serveStatic<Env>(options: ServeStaticOptions<Env>): MiddlewareHandler import serveStatic

@deprecated
serveStatic in the Cloudflare Workers adapter is deprecated. If you want to create an application serving static assets, please consider using Cloudflare Pages. You can start to create the Cloudflare Pages application with the npm create hono@latest command.

manifest }))          

(property) manifest: string | object

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use(          

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/dot-static/*", "/dot-static/*", any>(path: "/dot-static/*", handler: MiddlewareHandler<any, "/dot-static/*", {}>) => Hono<{}, { "/dot-static/*": {}; }, "/"> (+20 overloads)

'/dot-static/*', serveStatic({          

(alias) serveStatic<Env>(options: ServeStaticOptions<Env>): MiddlewareHandler import serveStatic

@deprecated
serveStatic in the Cloudflare Workers adapter is deprecated. If you want to create an application serving static assets, please consider using Cloudflare Pages. You can start to create the Cloudflare Pages application with the npm create hono@latest command.

root: './assets',          

(property) root?: string | undefined

rewriteRequestPath:

(property) rewriteRequestPath?: ((path: string) => string) | undefined

(path) =>

(parameter) path: string

path

(parameter) path: string

.replace(/^\/dot-static/, '/.static'),          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

manifest,          

(property) manifest: string | object

}) ) beforeEach(() => onNotFound.mockClear())          

const onNotFound: any

it('Should return plain.txt', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/static/plain.txt')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('This is plain.txt')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toBe('text/plain; charset=utf-8')          

(method) Headers.get(name: string): string | null MDN Reference

expect(onNotFound).not.toHaveBeenCalled()          

const onNotFound: any

}) it('Should return hono.html', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/static/hono.html')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('

Hono!

')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toBe('text/html; charset=utf-8')          

(method) Headers.get(name: string): string | null MDN Reference

expect(onNotFound).not.toHaveBeenCalled()          

const onNotFound: any

}) it('Should return 404 response', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/static/not-found.html')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(onNotFound).toHaveBeenCalledWith('assets/static/not-found.html', expect.anything())          

const onNotFound: any

}) it('Should return plan.txt', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/static-no-root/plain.txt')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('That is plain.txt')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toBe('text/plain; charset=utf-8')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Should return index.html', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/static/top')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('

Top

')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toBe('text/html; charset=utf-8')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Should return plain.txt with a rewriteRequestPath option', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/dot-static/plain.txt')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('In the dot')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toBe('text/plain; charset=utf-8')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('With options', () => { const manifest = {          

const manifest: { 'assets/static/options/foo.txt': string; }

'assets/static/options/foo.txt': 'assets/static/options/foo.abcdef.txt', } const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/static/*',

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/static/*", "/static/*", any>(path: "/static/*", handler: MiddlewareHandler<any, "/static/*", {}>) => Hono<{}, { "/static/*": {}; }, "/"> (+20 overloads)

serveStatic({

(alias) serveStatic<Env>(options: ServeStaticOptions<Env>): MiddlewareHandler import serveStatic

@deprecated
serveStatic in the Cloudflare Workers adapter is deprecated. If you want to create an application serving static assets, please consider using Cloudflare Pages. You can start to create the Cloudflare Pages application with the npm create hono@latest command.

root: './assets',

(property) root?: string | undefined

manifest:

(property) manifest: string | object

manifest }))          

const manifest: { 'assets/static/options/foo.txt': string; }

it('Should return foo.txt', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/static/options/foo.txt')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('With options')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toBe('text/plain; charset=utf-8')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('With `file` options', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/foo/*',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/foo/*", "/foo/*", HandlerResponse<any>, {}, any>(path: "/foo/*", handler: H<any, "/foo/*", {}, HandlerResponse<any>>) => Hono<BlankEnv, { ...; }, "/"> (+22 overloads)

serveStatic({

(alias) serveStatic<Env>(options: ServeStaticOptions<Env>): MiddlewareHandler import serveStatic

@deprecated
serveStatic in the Cloudflare Workers adapter is deprecated. If you want to create an application serving static assets, please consider using Cloudflare Pages. You can start to create the Cloudflare Pages application with the npm create hono@latest command.

path: './assets/static/hono.html',

(property) path?: string | undefined

manifest }))          

(property) manifest: string | object

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/bar/*',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/bar/*", "/bar/*", HandlerResponse<any>, {}, any>(path: "/bar/*", handler: H<any, "/bar/*", {}, HandlerResponse<any>>) => Hono<BlankEnv, { ...; }, "/"> (+22 overloads)

serveStatic({

(alias) serveStatic<Env>(options: ServeStaticOptions<Env>): MiddlewareHandler import serveStatic

@deprecated
serveStatic in the Cloudflare Workers adapter is deprecated. If you want to create an application serving static assets, please consider using Cloudflare Pages. You can start to create the Cloudflare Pages application with the npm create hono@latest command.

path: './static/hono.html',

(property) path?: string | undefined

root: './assets',

(property) root?: string | undefined

manifest }))          

(property) manifest: string | object

it('Should return hono.html', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/foo/fallback')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('

Hono!

')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return hono.html - with `root` option', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/bar/fallback')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('

Hono!

')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('With `mimes` options', () => { const mimes = {          

const mimes: { m3u8: string; ts: string; }

m3u8: 'application/vnd.apple.mpegurl',          

(property) m3u8: string

ts: 'video/mp2t',          

(property) ts: string

} const manifest = {          

const manifest: { 'assets/static/video/morning-routine.m3u8': string; 'assets/static/video/morning-routine1.ts': string; 'assets/static/video/introduction.mp4': string; }

'assets/static/video/morning-routine.m3u8': 'assets/static/video/morning-routine.abcdef.m3u8', 'assets/static/video/morning-routine1.ts': 'assets/static/video/morning-routine1.abcdef.ts', 'assets/static/video/introduction.mp4': 'assets/static/video/introduction.abcdef.mp4', } const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/static/*',

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/static/*", "/static/*", any>(path: "/static/*", handler: MiddlewareHandler<any, "/static/*", {}>) => Hono<{}, { "/static/*": {}; }, "/"> (+20 overloads)

serveStatic({

(alias) serveStatic<Env>(options: ServeStaticOptions<Env>): MiddlewareHandler import serveStatic

@deprecated
serveStatic in the Cloudflare Workers adapter is deprecated. If you want to create an application serving static assets, please consider using Cloudflare Pages. You can start to create the Cloudflare Pages application with the npm create hono@latest command.

root: './assets',

(property) root?: string | undefined

mimes,

(property) mimes?: Record<string, string> | undefined

manifest }))          

(property) manifest: string | object

it('Should return content-type of m3u8', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/static/video/morning-routine.m3u8')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toBe('application/vnd.apple.mpegurl')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Should return content-type of ts', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/static/video/morning-routine1.ts')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toBe('video/mp2t')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Should return content-type of default on Hono', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/static/video/introduction.mp4')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toBe('video/mp4')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('With middleware', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const md1 = async

const md1: (c: Context, next: Next) => Promise<void>

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

next:

(parameter) next: Next

Next) => {          

(alias) type Next = () => Promise<void> import Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.append('x-foo', 'bar')          

(method) Headers.append(name: string, value: string): void MDN Reference

} const md2 = async

const md2: (c: Context, next: Next) => Promise<void>

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

next:

(parameter) next: Next

Next) => {          

(alias) type Next = () => Promise<void> import Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.append('x-foo2', 'bar2')          

(method) Headers.append(name: string, value: string): void MDN Reference

} app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/static/*',

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/static/*", any, any>(path: "/static/*", handler: MiddlewareHandler<any, any, {}>) => Hono<{}, { [x: string]: {}; }, "/"> (+20 overloads)

md1)          

const md1: (c: Context, next: Next) => Promise<void>

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/static/*',

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/static/*", any, any>(path: "/static/*", handler: MiddlewareHandler<any, any, {}>) => Hono<{}, { [x: string]: {}; }, "/"> (+20 overloads)

md2)          

const md2: (c: Context, next: Next) => Promise<void>

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/static/*',

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/static/*", "/static/*", any>(path: "/static/*", handler: MiddlewareHandler<any, "/static/*", {}>) => Hono<{}, { "/static/*": {}; }, "/"> (+20 overloads)

serveStatic({

(alias) serveStatic<Env>(options: ServeStaticOptions<Env>): MiddlewareHandler import serveStatic

@deprecated
serveStatic in the Cloudflare Workers adapter is deprecated. If you want to create an application serving static assets, please consider using Cloudflare Pages. You can start to create the Cloudflare Pages application with the npm create hono@latest command.

root: './assets',

(property) root?: string | undefined

manifest }))          

(property) manifest: string | object

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/static/foo',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/static/foo", "/static/foo", Response & TypedResponse<"bar", StatusCode, "text">, BlankInput, BlankEnv>(path: "/static/foo", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/static/foo", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/static/foo", BlankInput>

.text('bar')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"bar", StatusCode>(text: "bar", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"bar", StatusCode, "text"> (+1 overload)

}) it('Should return plain.txt with correct headers', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/static/plain.txt')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('This is plain.txt')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toBe('text/plain; charset=utf-8')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-foo')).toBe('bar')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-foo2')).toBe('bar2')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Should return 200 Response', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/static/foo')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('bar')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should handle a file without an extension', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/static/download')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

}) }) describe('Types of middleware', () => { it('Should pass env type from generics of serveStatic', async () => { type Env = {          

type Env = { Bindings: { HOGE: string; }; }

Bindings: {          

(property) Bindings: { HOGE: string; }

HOGE: string          

(property) HOGE: string

} } const app = new

const app: Hono<Env, BlankSchema, "/">

Hono

(alias) new Hono<Env, BlankSchema, "/">(options?: HonoOptions<Env>): Hono<Env, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

<Env>()          

type Env = { Bindings: { HOGE: string; }; }

app

const app: Hono<Env, BlankSchema, "/">

.use(          

(property) Hono<Env, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/static/*", "/static/*", any>(path: "/static/*", handler: MiddlewareHandler<any, "/static/*", {}>) => Hono<Env, { "/static/*": {}; }, "/"> (+20 overloads)

'/static/*', serveStatic

(alias) serveStatic<Env>(options: ServeStaticOptions<Env>): MiddlewareHandler import serveStatic

@deprecated
serveStatic in the Cloudflare Workers adapter is deprecated. If you want to create an application serving static assets, please consider using Cloudflare Pages. You can start to create the Cloudflare Pages application with the npm create hono@latest command.

<Env>({          

type Env = { Bindings: { HOGE: string; }; }

root: './assets',          

(property) root?: string | undefined

onNotFound:

(property) onNotFound?: ((path: string, c: Context<Env, any, {}>) => void | Promise<void>) | undefined

(_,

(parameter) _: string

c) => {          

(parameter) c: Context<Env, any, {}>

expectTypeOf(c

(parameter) c: Context<Env, any, {}>

.env).toEqualTypeOf

(property) Context<Env, any, {}>.env: { HOGE: string; } .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

<Env['Bindings']>()          

type Env = { Bindings: { HOGE: string; }; }

}, manifest,          

(property) manifest: string | object

}) ) }) })
src/adapter/cloudflare-workers/serve-static.ts
            
                import { serveStatic as baseServeStatic } from '../../middleware/serve-static'
                import type { ServeStaticOptions as BaseServeStaticOptions } from '../../middleware/serve-static'
                import type { Env, MiddlewareHandler } from '../../types'
                import { getContentFromKVAsset } from './utils'
                
                export type ServeStaticOptions

type ServeStaticOptions<E extends Env = Env> = BaseServeStaticOptions<E> & { namespace?: unknown; manifest: object | string; }

<E extends

(type parameter) E in type ServeStaticOptions<E extends Env = Env>

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env> =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

BaseServeStaticOptions

(alias) type BaseServeStaticOptions<E extends Env = Env> = { root?: string; path?: string; precompressed?: boolean; mimes?: Record<string, string>; rewriteRequestPath?: (path: string) => string; onFound?: (path: string, c: Context<E>) => void | Promise<void>; onNotFound?: (path: string, c: Context<E>) => void | Promise<void>; } import BaseServeStaticOptions

<E> & {          

(type parameter) E in type ServeStaticOptions<E extends Env = Env>

// namespace is KVNamespace namespace?: unknown          

(property) namespace?: unknown

manifest: object | string          

(property) manifest: string | object

} /** * @deprecated * `serveStatic` in the Cloudflare Workers adapter is deprecated. * If you want to create an application serving static assets, please consider using Cloudflare Pages. * You can start to create the Cloudflare Pages application with the `npm create hono@latest` command. */ export const serveStatic =

const serveStatic: <E extends Env = Env>(options: ServeStaticOptions<E>) => MiddlewareHandler

@deprecated
serveStatic in the Cloudflare Workers adapter is deprecated. If you want to create an application serving static assets, please consider using Cloudflare Pages. You can start to create the Cloudflare Pages application with the npm create hono@latest command.

<E extends

(type parameter) E in <E extends Env = Env>(options: ServeStaticOptions<E>): MiddlewareHandler

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env>(          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

options:

(parameter) options: ServeStaticOptions<E>

ServeStaticOptions

type ServeStaticOptions<E extends Env = Env> = BaseServeStaticOptions<E> & { namespace?: unknown; manifest: object | string; }

<E>          

(type parameter) E in <E extends Env = Env>(options: ServeStaticOptions<E>): MiddlewareHandler

): MiddlewareHandler => {          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

return async function serveStatic

(local function) serveStatic(c: Context<any, string, {}>, next: Next): Promise<void | Response>

(c,

(parameter) c: Context<any, string, {}>

next) {          

(parameter) next: Next

const getContent = async

const getContent: (path: string) => Promise<ReadableStream<any> | null>

(path: string) => {          

(parameter) path: string

return getContentFromKVAsset

(alias) getContentFromKVAsset(path: string, options?: KVAssetOptions): Promise<ReadableStream | null> import getContentFromKVAsset

(path, {          

(parameter) path: string

manifest:

(property) manifest?: string | object | undefined

options

(parameter) options: ServeStaticOptions<E>

.manifest,          

(property) manifest: string | object

// eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore namespace:

(property) namespace?: unknown

options

(parameter) options: ServeStaticOptions<E>

.namespace          

(property) namespace?: unknown

? options

(parameter) options: ServeStaticOptions<E>

.namespace          

(property) namespace?: {}

: c

(parameter) c: Context<any, string, {}>

.env          

(property) Context<any, string, {}>.env: any .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

? c

(parameter) c: Context<any, string, {}>

.env.__STATIC_CONTENT          

(property) Context<any, string, {}>.env: any .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

: undefined, }) } return baseServeStatic({          

(alias) baseServeStatic<E>(options: BaseServeStaticOptions<E> & { getContent: (path: string, c: Context<E, any, {}>) => Promise<Data | Response | null>; pathResolve?: (path: string) => string; isDir?: (path: string) => boolean | undefined | Promise<boolean | undefined>; }): MiddlewareHandler import baseServeStatic This middleware is not directly used by the user. Create a wrapper specifying getContent() by the environment such as Deno or Bun.

...options,          

(parameter) options: ServeStaticOptions<E>

getContent,          

(property) getContent: (path: string, c: Context<E, any, {}>) => Promise<Data | Response | null>

})(c,

(parameter) c: Context<any, string, {}>

next)          

(parameter) next: Next

} }
src/adapter/cloudflare-workers/utils.test.ts
            
                import { getContentFromKVAsset } from './utils'
                
                // Mock
                const store: { 

const store: { [key: string]: string; }

[key: string]: string } = {          

(parameter) key: string

'index.abcdef.html': 'This is index', 'assets/static/plain.abcdef.txt': 'Asset text', } const manifest =

const manifest: string

JSON

var JSON: JSON An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.

.stringify({          

(method) JSON.stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string (+1 overload) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.

@param value — A JavaScript value, usually an object or array, to be converted.

@param replacer — A function that transforms the results.

@param space — Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.

'index.html': 'index.abcdef.html', 'assets/static/plain.txt': 'assets/static/plain.abcdef.txt', }) Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.assign(global, {

(method) ObjectConstructor.assign<any, { __STATIC_CONTENT_MANIFEST: string; }>(target: any, source: { __STATIC_CONTENT_MANIFEST: string; }): any (+3 overloads) Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object.

@param target — The target object to copy to.

@param source — The source object from which to copy properties.

__STATIC_CONTENT_MANIFEST:

(property) __STATIC_CONTENT_MANIFEST: string

manifest })          

const manifest: string

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.assign(global, {          

(method) ObjectConstructor.assign<any, { __STATIC_CONTENT: { get: (path: string) => string; }; }>(target: any, source: { __STATIC_CONTENT: { get: (path: string) => string; }; }): any (+3 overloads) Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object.

@param target — The target object to copy to.

@param source — The source object from which to copy properties.

__STATIC_CONTENT: {          

(property) __STATIC_CONTENT: { get: (path: string) => string; }

get:

(property) get: (path: string) => string

(path: string) => {          

(parameter) path: string

return store

const store: { [key: string]: string; }

[path]          

(parameter) path: string

}, }, }) describe('Utils for Cloudflare Workers', () => { it('getContentFromKVAsset', async () => { let content = await

let content: ReadableStream<any> | null

getContentFromKVAsset('not-found.txt')          

(alias) getContentFromKVAsset(path: string, options?: KVAssetOptions): Promise<ReadableStream | null> import getContentFromKVAsset

expect(content).toBeFalsy()          

let content: ReadableStream<any> | null

content = await

let content: ReadableStream<any> | null

getContentFromKVAsset('index.html')          

(alias) getContentFromKVAsset(path: string, options?: KVAssetOptions): Promise<ReadableStream | null> import getContentFromKVAsset

expect(content).toBeTruthy()          

let content: ReadableStream<any> | null

expect(content).toBe('This is index')          

let content: ReadableStream<any> | null

content = await

let content: ReadableStream<any> | null

getContentFromKVAsset('assets/static/plain.txt')          

(alias) getContentFromKVAsset(path: string, options?: KVAssetOptions): Promise<ReadableStream | null> import getContentFromKVAsset

expect(content).toBeTruthy()          

let content: ReadableStream<any> | null

expect(content).toBe('Asset text')          

let content: ReadableStream<any> | null

}) })
src/adapter/cloudflare-workers/utils.ts
            
                // __STATIC_CONTENT is KVNamespace
                declare const __STATIC_CONTENT: unknown          

const __STATIC_CONTENT: unknown

declare const __STATIC_CONTENT_MANIFEST: string          

const __STATIC_CONTENT_MANIFEST: string

export type KVAssetOptions = {          

type KVAssetOptions = { manifest?: object | string; namespace?: unknown; }

manifest?: object | string          

(property) manifest?: string | object | undefined

// namespace is KVNamespace namespace?: unknown          

(property) namespace?: unknown

} export const getContentFromKVAsset = async (          

const getContentFromKVAsset: (path: string, options?: KVAssetOptions) => Promise<ReadableStream | null>

path: string,          

(parameter) path: string

options?:

(parameter) options: KVAssetOptions | undefined

KVAssetOptions          

type KVAssetOptions = { manifest?: object | string; namespace?: unknown; }

): Promise

interface Promise<T> Represents the completion of an asynchronous operation

<ReadableStream | null> => {          

interface ReadableStream<R = any> This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.

MDN Reference

let ASSET_MANIFEST:

let ASSET_MANIFEST: Record<string, string>

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

if (options &&

(parameter) options: KVAssetOptions | undefined

options

(parameter) options: KVAssetOptions

.manifest) {          

(property) manifest?: string | object | undefined

if (typeof options

(parameter) options: KVAssetOptions

.manifest === 'string') {          

(property) manifest?: string | object

ASSET_MANIFEST =

let ASSET_MANIFEST: Record<string, string>

JSON

var JSON: JSON An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.

.parse

(method) JSON.parse(text: string, reviver?: (this: any, key: string, value: any) => any): any Converts a JavaScript Object Notation (JSON) string into an object.

@param text — A valid JSON string.

@param reviver
A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.

(options

(parameter) options: KVAssetOptions

.manifest)          

(property) manifest?: string

} else { ASSET_MANIFEST =

let ASSET_MANIFEST: Record<string, string>

options

(parameter) options: KVAssetOptions

.manifest as

(property) manifest?: object

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

} } else { if (typeof __STATIC_CONTENT_MANIFEST === 'string') {          

const __STATIC_CONTENT_MANIFEST: string

ASSET_MANIFEST =

let ASSET_MANIFEST: Record<string, string>

JSON

var JSON: JSON An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.

.parse

(method) JSON.parse(text: string, reviver?: (this: any, key: string, value: any) => any): any Converts a JavaScript Object Notation (JSON) string into an object.

@param text — A valid JSON string.

@param reviver
A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.

(__STATIC_CONTENT_MANIFEST)          

const __STATIC_CONTENT_MANIFEST: string

} else { ASSET_MANIFEST =

let ASSET_MANIFEST: Record<string, string>

__STATIC_CONTENT_MANIFEST          

const __STATIC_CONTENT_MANIFEST: never

} } // ASSET_NAMESPACE is KVNamespace let ASSET_NAMESPACE: unknown          

let ASSET_NAMESPACE: unknown

if (options &&

(parameter) options: KVAssetOptions | undefined

options

(parameter) options: KVAssetOptions

.namespace) {          

(property) namespace?: unknown

ASSET_NAMESPACE =

let ASSET_NAMESPACE: unknown

options

(parameter) options: KVAssetOptions

.namespace          

(property) namespace?: {}

} else { ASSET_NAMESPACE =

let ASSET_NAMESPACE: unknown

__STATIC_CONTENT          

const __STATIC_CONTENT: unknown

} const key =

const key: string

ASSET_MANIFEST

let ASSET_MANIFEST: Record<string, string>

[path] ||

(parameter) path: string

path          

(parameter) path: string

if (!key) {          

const key: string

return null } // @ts-expect-error ASSET_NAMESPACE is not typed const content = await

const content: any

ASSET_NAMESPACE.get

let ASSET_NAMESPACE: unknown

(key, {

const key: string

type: 'stream' })          

(property) type: string

if (!content) {          

const content: any

return null } return content as unknown as

const content: any

ReadableStream          

interface ReadableStream<R = any> This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.

MDN Reference

}
src/adapter/cloudflare-workers/websocket.test.ts
            
                import { Hono } from '../..'
                import { upgradeWebSocket } from '.'
                
                describe('upgradeWebSocket middleware', () => {
                  const server = new

const server: EventTarget

EventTarget()          

var EventTarget: new () => EventTarget EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.

MDN Reference

// @ts-expect-error Cloudflare API globalThis.WebSocketPair = class { 0: WebSocket // client          

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

1: WebSocket // server          

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

constructor() { this[0] = {} as WebSocket          

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

this[1] = server as

const server: EventTarget

WebSocket          

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

} } const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const wsPromise = new

const wsPromise: Promise<unknown>

Promise(

var Promise: PromiseConstructor new <unknown>(executor: (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void) => Promise<unknown> Creates a new Promise.

@param executor
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

(resolve) =>          

(parameter) resolve: (value: unknown) => void

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get(          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/ws", "/ws", HandlerResponse<any>, { outputFormat: "ws"; }, any>(path: "/ws", handler: H<any, "/ws", { outputFormat: "ws"; }, HandlerResponse<any>>) => Hono<...> (+22 overloads)

'/ws', upgradeWebSocket(() => ({          

(alias) upgradeWebSocket(createEvents: (c: Context) => WSEvents<WebSocket> | Promise<WSEvents<WebSocket>>, options?: any): MiddlewareHandler<any, string, { outputFormat: "ws"; }> import upgradeWebSocket

// eslint-disable-next-line @typescript-eslint/no-unused-vars onMessage

(property) WSEvents<WebSocket>.onMessage?: ((evt: MessageEvent<WSMessageReceive>, ws: WSContext<WebSocket>) => void) | undefined

(evt,

(parameter) evt: MessageEvent<WSMessageReceive>

ws) {          

(parameter) ws: WSContext<WebSocket>

resolve

(parameter) resolve: (value: unknown) => void

(evt

(parameter) evt: MessageEvent<WSMessageReceive>

.data)          

(property) MessageEvent<WSMessageReceive>.data: WSMessageReceive Returns the data of the message.

MDN Reference

}, })) ) ) it('Should receive message is valid', async () => { const sendingData =

const sendingData: string

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random()

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

.toString()          

(method) Number.toString(radix?: number): string Returns a string representation of an object.

@param radix — Specifies a radix for converting numeric values to strings. This value is only used for numbers.

await app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/ws', {          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

Upgrade: 'websocket',          

(property) Upgrade: string

}, }) server

const server: EventTarget

.dispatchEvent(          

(method) EventTarget.dispatchEvent(event: Event): boolean Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

MDN Reference

new MessageEvent('message', {          

var MessageEvent: new <string>(type: string, eventInitDict?: MessageEventInit<string> | undefined) => MessageEvent<string> A message received by a target object.

MDN Reference

data:

(property) MessageEventInit<string>.data?: string | undefined

sendingData,          

const sendingData: string

}) ) expect(sendingData).toBe(await

const sendingData: string

wsPromise)          

const wsPromise: Promise<unknown>

}) })
src/adapter/cloudflare-workers/websocket.ts
            
                import type { UpgradeWebSocket, WSContext, WSReadyState } from '../../helper/websocket'
                
                // Based on https://github.com/honojs/hono/issues/1153#issuecomment-1767321332
                export const upgradeWebSocket:

const upgradeWebSocket: UpgradeWebSocket<WebSocket>

UpgradeWebSocket

(alias) type UpgradeWebSocket<T = unknown, U = any> = (createEvents: (c: Context) => WSEvents<T> | Promise<WSEvents<T>>, options?: U) => MiddlewareHandler<any, string, { outputFormat: "ws"; }> import UpgradeWebSocket Upgrade WebSocket Type

<WebSocket> =

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

(createEvents) => async

(parameter) createEvents: (c: Context) => WSEvents<WebSocket> | Promise<WSEvents<WebSocket>>

(c,

(parameter) c: Context<any, string, { outputFormat: "ws"; }>

next) => {          

(parameter) next: Next

const events = await

const events: WSEvents<WebSocket>

createEvents

(parameter) createEvents: (c: Context) => WSEvents<WebSocket> | Promise<WSEvents<WebSocket>>

(c)          

(parameter) c: Context<any, string, { outputFormat: "ws"; }>

const upgradeHeader =

const upgradeHeader: string | undefined

c

(parameter) c: Context<any, string, { outputFormat: "ws"; }>

.req

(property) Context<any, string, { outputFormat: "ws"; }>.req: HonoRequest<string, unknown> .req is the instance of HonoRequest.

.header('Upgrade')          

(method) HonoRequest<string, unknown>.header(name: string): string | undefined (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

if (upgradeHeader !== 'websocket') {          

const upgradeHeader: string | undefined

return await next()          

(parameter) next: () => Promise<void>

} // @ts-expect-error WebSocketPair is not typed const webSocketPair = new WebSocketPair()          

const webSocketPair: any

const client:

const client: WebSocket

WebSocket =

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

webSocketPair[0]          

const webSocketPair: any

const server:

const server: WebSocket

WebSocket =

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

webSocketPair[1]          

const webSocketPair: any

const wsContext:

const wsContext: WSContext<WebSocket>

WSContext

(alias) type WSContext<T = unknown> = { send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void; raw?: T; binaryType: BinaryType; readyState: WSReadyState; url: URL | null; protocol: string | null; close(code?: number, reason?: string): void; } import WSContext

<WebSocket> = {          

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

binaryType: 'arraybuffer',          

(property) binaryType: BinaryType

close:

(method) close(code?: number, reason?: string): void

(code,

(parameter) code: number | undefined

reason) =>

(parameter) reason: string | undefined

server

const server: WebSocket

.close

(method) WebSocket.close(code?: number, reason?: string): void Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.

MDN Reference

(code,

(parameter) code: number | undefined

reason),          

(parameter) reason: string | undefined

get protocol() {          

(property) protocol: string | null

return server

const server: WebSocket

.protocol          

(property) WebSocket.protocol: string Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation.

MDN Reference

}, raw:

(property) raw?: WebSocket | undefined

server,          

const server: WebSocket

get readyState() {          

(property) readyState: WSReadyState

return server

const server: WebSocket

.readyState as

(property) WebSocket.readyState: number Returns the state of the WebSocket object's connection. It can have the values described below.

MDN Reference

WSReadyState          

(alias) type WSReadyState = 0 | 2 | 1 | 3 import WSReadyState

}, url:

(property) url: URL | null

server

const server: WebSocket

.url ? new

(property) WebSocket.url: string Returns the URL that was used to establish the WebSocket connection.

MDN Reference

URL

var URL: new (url: string | URL, base?: string | URL) => URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

(server

const server: WebSocket

.url) : null,          

(property) WebSocket.url: string Returns the URL that was used to establish the WebSocket connection.

MDN Reference

send:

(method) send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void

(source) =>

(parameter) source: string | ArrayBuffer | Uint8Array

server

const server: WebSocket

.send

(method) WebSocket.send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.

MDN Reference

(source),          

(parameter) source: string | ArrayBuffer | Uint8Array

} if (events

const events: WSEvents<WebSocket>

.onOpen) {          

(property) WSEvents<WebSocket>.onOpen?: ((evt: Event, ws: WSContext<WebSocket>) => void) | undefined

server

const server: WebSocket

.addEventListener('open',

(method) WebSocket.addEventListener<"open">(type: "open", listener: (this: WebSocket, ev: Event) => any, options?: boolean | AddEventListenerOptions): void (+1 overload) Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

MDN Reference

(evt:

(parameter) evt: Event

Event) =>

interface Event An event which takes place in the DOM.

MDN Reference

events

const events: WSEvents<WebSocket>

.onOpen?.

(property) WSEvents<WebSocket>.onOpen?: ((evt: Event, ws: WSContext<WebSocket>) => void) | undefined

(evt,

(parameter) evt: Event

wsContext))          

const wsContext: WSContext<WebSocket>

} if (events

const events: WSEvents<WebSocket>

.onClose) {          

(property) WSEvents<WebSocket>.onClose?: ((evt: CloseEvent, ws: WSContext<WebSocket>) => void) | undefined

server

const server: WebSocket

.addEventListener('close',

(method) WebSocket.addEventListener<"close">(type: "close", listener: (this: WebSocket, ev: CloseEvent) => any, options?: boolean | AddEventListenerOptions): void (+1 overload) Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

MDN Reference

(evt:

(parameter) evt: CloseEvent

CloseEvent) =>

interface CloseEvent A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.

MDN Reference

events

const events: WSEvents<WebSocket>

.onClose?.

(property) WSEvents<WebSocket>.onClose?: ((evt: CloseEvent, ws: WSContext<WebSocket>) => void) | undefined

(evt,

(parameter) evt: CloseEvent

wsContext))          

const wsContext: WSContext<WebSocket>

} if (events

const events: WSEvents<WebSocket>

.onMessage) {          

(property) WSEvents<WebSocket>.onMessage?: ((evt: MessageEvent<WSMessageReceive>, ws: WSContext<WebSocket>) => void) | undefined

server

const server: WebSocket

.addEventListener('message',

(method) WebSocket.addEventListener<"message">(type: "message", listener: (this: WebSocket, ev: MessageEvent<any>) => any, options?: boolean | AddEventListenerOptions): void (+1 overload) Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

MDN Reference

(evt:

(parameter) evt: MessageEvent<any>

MessageEvent) =>

interface MessageEvent<T = any> A message received by a target object.

MDN Reference

events

const events: WSEvents<WebSocket>

.onMessage?.

(property) WSEvents<WebSocket>.onMessage?: ((evt: MessageEvent<WSMessageReceive>, ws: WSContext<WebSocket>) => void) | undefined

(evt,

(parameter) evt: MessageEvent<any>

wsContext))          

const wsContext: WSContext<WebSocket>

} if (events

const events: WSEvents<WebSocket>

.onError) {          

(property) WSEvents<WebSocket>.onError?: ((evt: Event, ws: WSContext<WebSocket>) => void) | undefined

server

const server: WebSocket

.addEventListener('error',

(method) WebSocket.addEventListener<"error">(type: "error", listener: (this: WebSocket, ev: Event) => any, options?: boolean | AddEventListenerOptions): void (+1 overload) Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

MDN Reference

(evt:

(parameter) evt: Event

Event) =>

interface Event An event which takes place in the DOM.

MDN Reference

events

const events: WSEvents<WebSocket>

.onError?.

(property) WSEvents<WebSocket>.onError?: ((evt: Event, ws: WSContext<WebSocket>) => void) | undefined

(evt,

(parameter) evt: Event

wsContext))          

const wsContext: WSContext<WebSocket>

} // @ts-expect-error - server.accept is not typed server.accept?.()          

const server: WebSocket

return new Response(null, {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 101,          

(property) ResponseInit.status?: number | undefined

// @ts-expect-error - webSocket is not typed webSocket:

(property) webSocket: WebSocket

client,          

const client: WebSocket

}) }
src/adapter/deno/conninfo.test.ts
            
                import { Context } from '../../context'
                import { getConnInfo } from './conninfo'
                
                describe('getConnInfo', () => {
                  it('Should info is valid', () => {
                    const transport = 'tcp'          

const transport: "tcp"

const address =

const address: string

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random()

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

.toString()          

(method) Number.toString(radix?: number): string Returns a string representation of an object.

@param radix — Specifies a radix for converting numeric values to strings. This value is only used for numbers.

const port =

const port: number

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.floor

(method) Math.floor(x: number): number Returns the greatest integer less than or equal to its numeric argument.

@param x — A numeric expression.

(Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random() * (65535 + 1))          

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

const c = new

const c: Context<any, any, {}>

Context(new

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

Request('http://localhost/'), {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

env: {          

(property) env: any Bindings for the environment.

remoteAddr: {          

(property) remoteAddr: { transport: string; hostname: string; port: number; }

transport,          

(property) transport: string

hostname:

(property) hostname: string

address,          

const address: string

port,          

(property) port: number

}, }, }) const info =

const info: ConnInfo

getConnInfo

(alias) getConnInfo(c: Context): ConnInfo import getConnInfo Get conninfo with Deno

@param c — Context

@returns — ConnInfo

(c)          

const c: Context<any, any, {}>

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.port).toBe

(property) port?: number | undefined Transport port number

(port)          

const port: number

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.address).toBe

(property) address?: string | undefined Host name such as IP Addr

(address)          

const address: string

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.addressType).toBeUndefined()          

(property) addressType?: AddressType Host name type

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.transport).toBe

(property) transport?: "tcp" | "udp" | undefined Transport protocol type

(transport)          

const transport: "tcp"

}) })
src/adapter/deno/conninfo.ts
            
                import type { GetConnInfo } from '../../helper/conninfo'
                
                /**
                 * Get conninfo with Deno
                 * @param c Context
                 * @returns ConnInfo
                 */
                export const getConnInfo:

const getConnInfo: GetConnInfo Get conninfo with Deno

@param c — Context

@returns — ConnInfo

GetConnInfo =

(alias) type GetConnInfo = (c: Context) => ConnInfo import GetConnInfo Helper type

(c) => {          

(parameter) c: Context<any, any, {}> Context

@param c — Context

const { remoteAddr } =

const remoteAddr: any

c

(parameter) c: Context<any, any, {}> Context

@param c — Context

.env          

(property) Context<any, any, {}>.env: any .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

return { remote: {          

(property) ConnInfo.remote: NetAddrInfo Remote information

address:

(property) address: any

remoteAddr.hostname,          

const remoteAddr: any

port:

(property) port?: number | undefined Transport port number

remoteAddr.port,          

const remoteAddr: any

transport:

(property) transport?: "tcp" | "udp" | undefined Transport protocol type

remoteAddr.transport,          

const remoteAddr: any

}, } }
src/adapter/deno/deno.d.ts
            
                declare namespace Deno {          

namespace Deno

/** * Creates a new directory with the specified path. * * @param path The path to create a directory. * @param options Options for creating a directory. * @returns A promise that resolves when the directory is created. */ export function mkdir

function Deno.mkdir(path: string, options?: { recursive?: boolean; }): Promise<void> Creates a new directory with the specified path.

@param path — The path to create a directory.

@param options — Options for creating a directory.

@returns — A promise that resolves when the directory is created.

(path: string,

(parameter) path: string The path to create a directory.

@param path — The path to create a directory.

options?: {

(parameter) options: { recursive?: boolean; } | undefined Options for creating a directory.

@param options — Options for creating a directory.

recursive?: boolean }):

(property) recursive?: boolean | undefined

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

/** * Write a new file, with the specified path and data. * * @param path The path to the file to write. * @param data The data to write to the file. * @returns A promise that resolves when the file is written. */ export function writeFile

function Deno.writeFile(path: string, data: Uint8Array): Promise<void> Write a new file, with the specified path and data.

@param path — The path to the file to write.

@param data — The data to write to the file.

@returns — A promise that resolves when the file is written.

(path: string,

(parameter) path: string The path to the file to write.

@param path — The path to the file to write.

data:

(parameter) data: Uint8Array The data to write to the file.

@param data — The data to write to the file.

Uint8Array):

interface Uint8Array A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

export function upgradeWebSocket(          

function Deno.upgradeWebSocket(req: Request, options: any): { response: Response; socket: WebSocket; }

req:

(parameter) req: Request

Request,          

interface Request This Fetch API interface represents a resource request.

MDN Reference

// eslint-disable-next-line @typescript-eslint/no-explicit-any options: any          

(parameter) options: any

): { response:

(property) response: Response

Response          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

socket:

(property) socket: WebSocket

WebSocket          

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

} }
src/adapter/deno/index.ts
            
                /**
                 * @module
                 * Deno Adapter for Hono.
                 */
                
                export { serveStatic } from './serve-static'          

(alias) const serveStatic: <E extends Env = Env>(options: ServeStaticOptions<E>) => MiddlewareHandler export serveStatic

export { toSSG,

(alias) const toSSG: ToSSGAdaptorInterface<Env, {}, "/"> export toSSG

@experimental
toSSG is an experimental feature. The API might be changed.

denoFileSystemModule } from './ssg'          

(alias) const denoFileSystemModule: FileSystemModule export denoFileSystemModule

@experimental
denoFileSystemModule is an experimental feature. The API might be changed.

export { upgradeWebSocket } from './websocket'          

(alias) const upgradeWebSocket: UpgradeWebSocket<WebSocket, UpgradeWebSocketOptions> export upgradeWebSocket

export { getConnInfo } from './conninfo'          

(alias) const getConnInfo: GetConnInfo export getConnInfo Get conninfo with Deno

@param c — Context

@returns — ConnInfo

src/adapter/deno/serve-static.ts
            
                import type { ServeStaticOptions } from '../../middleware/serve-static'
                import { serveStatic as baseServeStatic } from '../../middleware/serve-static'
                import type { Env, MiddlewareHandler } from '../../types'
                
                // eslint-disable-next-line @typescript-eslint/ban-ts-comment
                // @ts-ignore
                const { open,

const open: any

lstatSync } =

const lstatSync: any

Deno          

namespace Deno

export const serveStatic =

const serveStatic: <E extends Env = Env>(options: ServeStaticOptions<E>) => MiddlewareHandler

<E extends

(type parameter) E in <E extends Env = Env>(options: ServeStaticOptions<E>): MiddlewareHandler

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env>(          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

options:

(parameter) options: ServeStaticOptions<E>

ServeStaticOptions

(alias) type ServeStaticOptions<E extends Env = Env> = { root?: string; path?: string; precompressed?: boolean; mimes?: Record<string, string>; rewriteRequestPath?: (path: string) => string; onFound?: (path: string, c: Context<E>) => void | Promise<void>; onNotFound?: (path: string, c: Context<E>) => void | Promise<void>; } import ServeStaticOptions

<E>          

(type parameter) E in <E extends Env = Env>(options: ServeStaticOptions<E>): MiddlewareHandler

): MiddlewareHandler => {          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

return async function serveStatic

(local function) serveStatic(c: Context<any, string, {}>, next: Next): Promise<void | Response>

(c,

(parameter) c: Context<any, string, {}>

next) {          

(parameter) next: Next

const getContent = async

const getContent: (path: string) => Promise<any>

(path: string) => {          

(parameter) path: string

try { const file = await

const file: any

open

const open: any

(path)          

(parameter) path: string

// eslint-disable-next-line @typescript-eslint/no-explicit-any return file ?

const file: any

(file.readable as any) : null          

const file: any

} catch (e) {          

(local var) e: unknown

console

var console: Console

.warn(`$

(method) Console.warn(...data: any[]): void MDN Reference

{e}`)          

(local var) e: unknown

} } const pathResolve =

const pathResolve: (path: string) => string

(path: string) => {          

(parameter) path: string

return path

(parameter) path: string

.startsWith('/') ?

(method) String.startsWith(searchString: string, position?: number): boolean Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false.

path : `./$

(parameter) path: string

{path}`          

(parameter) path: string

} const isDir =

const isDir: (path: string) => any

(path: string) => {          

(parameter) path: string

let isDir          

let isDir: any

try { const stat =

const stat: any

lstatSync

const lstatSync: any

(path)          

(parameter) path: string

isDir =

let isDir: any

stat.isDirectory          

const stat: any

} catch {} return isDir          

let isDir: any

} return baseServeStatic({          

(alias) baseServeStatic<E>(options: ServeStaticOptions<E> & { getContent: (path: string, c: Context<E, any, {}>) => Promise<Data | Response | null>; pathResolve?: (path: string) => string; isDir?: (path: string) => boolean | undefined | Promise<boolean | undefined>; }): MiddlewareHandler import baseServeStatic This middleware is not directly used by the user. Create a wrapper specifying getContent() by the environment such as Deno or Bun.

...options,          

(parameter) options: ServeStaticOptions<E>

getContent,          

(property) getContent: (path: string, c: Context<E, any, {}>) => Promise<Data | Response | null>

pathResolve,          

(property) pathResolve?: ((path: string) => string) | undefined

isDir,          

(property) isDir?: ((path: string) => boolean | undefined | Promise<boolean | undefined>) | undefined

})(c,

(parameter) c: Context<any, string, {}>

next)          

(parameter) next: Next

} }
src/adapter/deno/ssg.ts
            
                import { toSSG as baseToSSG } from '../../helper/ssg/index'
                import type { FileSystemModule, ToSSGAdaptorInterface } from '../../helper/ssg/index'
                
                /**
                 * @experimental
                 * `denoFileSystemModule` is an experimental feature.
                 * The API might be changed.
                 */
                export const denoFileSystemModule:

const denoFileSystemModule: FileSystemModule

@experimental
denoFileSystemModule is an experimental feature. The API might be changed.

FileSystemModule = {          

(alias) interface FileSystemModule import FileSystemModule

@experimental
FileSystemModule is an experimental feature. The API might be changed.

writeFile: async

(method) FileSystemModule.writeFile(path: string, data: string | Uint8Array): Promise<void>

(path,

(parameter) path: string

data) => {          

(parameter) data: string | Uint8Array

const uint8Data =          

const uint8Data: Uint8Array

typeof data === 'string' ? new

(parameter) data: string | Uint8Array

TextEncoder()

var TextEncoder: new () => TextEncoder TextEncoder takes a stream of code points as input and emits a stream of bytes. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays.

MDN Reference

.encode

(method) TextEncoder.encode(input?: string): Uint8Array Returns the result of running UTF-8's encoder.

MDN Reference

(data) : new

(parameter) data: string

Uint8Array

var Uint8Array: Uint8ArrayConstructor new (elements: Iterable<number>) => Uint8Array (+4 overloads)

(data)          

(parameter) data: Uint8Array

await Deno

namespace Deno

.writeFile

function Deno.writeFile(path: string, data: Uint8Array): Promise<void> Write a new file, with the specified path and data.

@param path — The path to the file to write.

@param data — The data to write to the file.

@returns — A promise that resolves when the file is written.

(path,

(parameter) path: string

uint8Data)          

const uint8Data: Uint8Array

}, mkdir: async

(method) FileSystemModule.mkdir(path: string, options: { recursive: boolean; }): Promise<void | string>

(path,

(parameter) path: string

options) => {          

(parameter) options: { recursive: boolean; }

return Deno

namespace Deno

.mkdir

function Deno.mkdir(path: string, options?: { recursive?: boolean; }): Promise<void> Creates a new directory with the specified path.

@param path — The path to create a directory.

@param options — Options for creating a directory.

@returns — A promise that resolves when the directory is created.

(path, {

(parameter) path: string

recursive:

(property) recursive?: boolean | undefined

options?

(parameter) options: { recursive: boolean; }

.recursive ?? false })          

(property) recursive: boolean

}, } /** * @experimental * `toSSG` is an experimental feature. * The API might be changed. */ export const toSSG:

const toSSG: ToSSGAdaptorInterface<Env, {}, "/">

@experimental
toSSG is an experimental feature. The API might be changed.

ToSSGAdaptorInterface = async

(alias) interface ToSSGAdaptorInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/"> import ToSSGAdaptorInterface

@experimental
ToSSGAdaptorInterface is an experimental feature. The API might be changed.

(app,

(parameter) app: Hono<Env, {}, "/">

options) => {          

(parameter) options: ToSSGOptions | undefined

return baseToSSG

(alias) baseToSSG(app: Hono<any, any, any>, fsModule: FileSystemModule, options?: ToSSGOptions): Promise<ToSSGResult> import baseToSSG

@experimental
toSSG is an experimental feature. The API might be changed.

(app,

(parameter) app: Hono<Env, {}, "/">

denoFileSystemModule,

const denoFileSystemModule: FileSystemModule

@experimental
denoFileSystemModule is an experimental feature. The API might be changed.

options)          

(parameter) options: ToSSGOptions | undefined

}
src/adapter/deno/websocket.test.ts
            
                import { Hono } from '../..'
                import { upgradeWebSocket } from './websocket'
                
                globalThis.Deno = {} as typeof

namespace Deno

Deno          

namespace Deno

describe('WebSockets', () => { let app:

let app: Hono<BlankEnv, BlankSchema, "/">

Hono          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

beforeEach(() => { app = new

let app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

}) it('Should receive data is valid', async () => { const messagePromise = new

const messagePromise: Promise<unknown>

Promise(

var Promise: PromiseConstructor new <unknown>(executor: (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void) => Promise<unknown> Creates a new Promise.

@param executor
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

(resolve) =>          

(parameter) resolve: (value: unknown) => void

app

let app: Hono<BlankEnv, BlankSchema, "/">

.get(          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/ws", "/ws", HandlerResponse<any>, { outputFormat: "ws"; }, any>(path: "/ws", handler: H<any, "/ws", { outputFormat: "ws"; }, HandlerResponse<any>>) => Hono<...> (+22 overloads)

'/ws', upgradeWebSocket(() => ({          

(alias) upgradeWebSocket(createEvents: (c: Context) => WSEvents<WebSocket> | Promise<WSEvents<WebSocket>>, options?: UpgradeWebSocketOptions | undefined): MiddlewareHandler<any, string, { outputFormat: "ws"; }> import upgradeWebSocket

onMessage:

(property) WSEvents<WebSocket>.onMessage?: ((evt: MessageEvent<WSMessageReceive>, ws: WSContext<WebSocket>) => void) | undefined

(evt) =>

(parameter) evt: MessageEvent<WSMessageReceive>

resolve

(parameter) resolve: (value: unknown) => void

(evt

(parameter) evt: MessageEvent<WSMessageReceive>

.data),          

(property) MessageEvent<WSMessageReceive>.data: WSMessageReceive Returns the data of the message.

MDN Reference

})) ) ) const socket = new

const socket: WebSocket

EventTarget() as

var EventTarget: new () => EventTarget EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.

MDN Reference

WebSocket          

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

Deno

namespace Deno

.upgradeWebSocket = () => {          

function Deno.upgradeWebSocket(req: Request, options: any): { response: Response; socket: WebSocket; }

return { response: new

(property) response: Response

Response(),          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

socket,          

(property) socket: WebSocket

} } await app

let app: Hono<BlankEnv, BlankSchema, "/">

.request('/ws', {          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

upgrade: 'websocket',          

(property) upgrade: string

}, }) const data =

const data: string

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random()

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

.toString()          

(method) Number.toString(radix?: number): string Returns a string representation of an object.

@param radix — Specifies a radix for converting numeric values to strings. This value is only used for numbers.

socket

const socket: WebSocket

.onmessage &&          

(property) WebSocket.onmessage: ((this: WebSocket, ev: MessageEvent) => any) | null MDN Reference

socket

const socket: WebSocket

.onmessage(          

(property) WebSocket.onmessage: (this: WebSocket, ev: MessageEvent) => any MDN Reference

new MessageEvent('message', {          

var MessageEvent: new <string>(type: string, eventInitDict?: MessageEventInit<string> | undefined) => MessageEvent<string> A message received by a target object.

MDN Reference

data,          

(property) MessageEventInit<string>.data?: string | undefined

}) ) expect(await messagePromise).toBe

const messagePromise: Promise<unknown>

(data)          

const data: string

}) it('Should receive data is valid with Options', async () => { const messagePromise = new

const messagePromise: Promise<unknown>

Promise(

var Promise: PromiseConstructor new <unknown>(executor: (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void) => Promise<unknown> Creates a new Promise.

@param executor
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

(resolve) =>          

(parameter) resolve: (value: unknown) => void

app

let app: Hono<BlankEnv, BlankSchema, "/">

.get(          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/ws", "/ws", HandlerResponse<any>, { outputFormat: "ws"; }, any>(path: "/ws", handler: H<any, "/ws", { outputFormat: "ws"; }, HandlerResponse<any>>) => Hono<...> (+22 overloads)

'/ws', upgradeWebSocket(          

(alias) upgradeWebSocket(createEvents: (c: Context) => WSEvents<WebSocket> | Promise<WSEvents<WebSocket>>, options?: UpgradeWebSocketOptions | undefined): MiddlewareHandler<any, string, { outputFormat: "ws"; }> import upgradeWebSocket

() => ({ onMessage:

(property) WSEvents<WebSocket>.onMessage?: ((evt: MessageEvent<WSMessageReceive>, ws: WSContext<WebSocket>) => void) | undefined

(evt) =>

(parameter) evt: MessageEvent<WSMessageReceive>

resolve

(parameter) resolve: (value: unknown) => void

(evt

(parameter) evt: MessageEvent<WSMessageReceive>

.data),          

(property) MessageEvent<WSMessageReceive>.data: WSMessageReceive Returns the data of the message.

MDN Reference

}), { idleTimeout: 5000,          

(property) UpgradeWebSocketOptions.idleTimeout?: number | undefined If the client does not respond to this frame with a pong within the timeout specified, the connection is deemed unhealthy and is closed. The close and error event will be emitted.

The unit is seconds, with a default of 30. Set to 0 to disable timeouts.

} ) ) ) const socket = new

const socket: WebSocket

EventTarget() as

var EventTarget: new () => EventTarget EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.

MDN Reference

WebSocket          

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

Deno

namespace Deno

.upgradeWebSocket = () => {          

function Deno.upgradeWebSocket(req: Request, options: any): { response: Response; socket: WebSocket; }

return { response: new

(property) response: Response

Response(),          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

socket,          

(property) socket: WebSocket

} } await app

let app: Hono<BlankEnv, BlankSchema, "/">

.request('/ws', {          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

upgrade: 'websocket',          

(property) upgrade: string

}, }) const data =

const data: string

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random()

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

.toString()          

(method) Number.toString(radix?: number): string Returns a string representation of an object.

@param radix — Specifies a radix for converting numeric values to strings. This value is only used for numbers.

socket

const socket: WebSocket

.onmessage &&          

(property) WebSocket.onmessage: ((this: WebSocket, ev: MessageEvent) => any) | null MDN Reference

socket

const socket: WebSocket

.onmessage(          

(property) WebSocket.onmessage: (this: WebSocket, ev: MessageEvent) => any MDN Reference

new MessageEvent('message', {          

var MessageEvent: new <string>(type: string, eventInitDict?: MessageEventInit<string> | undefined) => MessageEvent<string> A message received by a target object.

MDN Reference

data,          

(property) MessageEventInit<string>.data?: string | undefined

}) ) expect(await messagePromise).toBe

const messagePromise: Promise<unknown>

(data)          

const data: string

}) })
src/adapter/deno/websocket.ts
            
                import type { UpgradeWebSocket, WSContext, WSReadyState } from '../../helper/websocket'
                
                export interface UpgradeWebSocketOptions {          

interface UpgradeWebSocketOptions

/** * Sets the `.protocol` property on the client side web socket to the * value provided here, which should be one of the strings specified in the * `protocols` parameter when requesting the web socket. This is intended * for clients and servers to specify sub-protocols to use to communicate to * each other. */ protocol?: string          

(property) UpgradeWebSocketOptions.protocol?: string | undefined Sets the .protocol property on the client side web socket to the value provided here, which should be one of the strings specified in the protocols parameter when requesting the web socket. This is intended for clients and servers to specify sub-protocols to use to communicate to each other.

/** * If the client does not respond to this frame with a * `pong` within the timeout specified, the connection is deemed * unhealthy and is closed. The `close` and `error` event will be emitted. * * The unit is seconds, with a default of 30. * Set to `0` to disable timeouts. */ idleTimeout?: number          

(property) UpgradeWebSocketOptions.idleTimeout?: number | undefined If the client does not respond to this frame with a pong within the timeout specified, the connection is deemed unhealthy and is closed. The close and error event will be emitted.

The unit is seconds, with a default of 30. Set to 0 to disable timeouts.

} export const upgradeWebSocket:

const upgradeWebSocket: UpgradeWebSocket<WebSocket, UpgradeWebSocketOptions>

UpgradeWebSocket

(alias) type UpgradeWebSocket<T = unknown, U = any> = (createEvents: (c: Context) => WSEvents<T> | Promise<WSEvents<T>>, options?: U) => MiddlewareHandler<any, string, { outputFormat: "ws"; }> import UpgradeWebSocket Upgrade WebSocket Type

<WebSocket,

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

UpgradeWebSocketOptions> =          

interface UpgradeWebSocketOptions

(createEvents,

(parameter) createEvents: (c: Context) => WSEvents<WebSocket> | Promise<WSEvents<WebSocket>>

options) => async

(parameter) options: UpgradeWebSocketOptions | undefined

(c,

(parameter) c: Context<any, string, { outputFormat: "ws"; }>

next) => {          

(parameter) next: Next

if (c

(parameter) c: Context<any, string, { outputFormat: "ws"; }>

.req

(property) Context<any, string, { outputFormat: "ws"; }>.req: HonoRequest<string, unknown> .req is the instance of HonoRequest.

.header('upgrade') !== 'websocket') {          

(method) HonoRequest<string, unknown>.header(name: string): string | undefined (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

return await next()          

(parameter) next: () => Promise<void>

} const events = await

const events: WSEvents<WebSocket>

createEvents

(parameter) createEvents: (c: Context) => WSEvents<WebSocket> | Promise<WSEvents<WebSocket>>

(c)          

(parameter) c: Context<any, string, { outputFormat: "ws"; }>

const { response,

const response: Response

socket } =

const socket: WebSocket

Deno

namespace Deno

.upgradeWebSocket

function Deno.upgradeWebSocket(req: Request, options: any): { response: Response; socket: WebSocket; }

(c

(parameter) c: Context<any, string, { outputFormat: "ws"; }>

.req

(property) Context<any, string, { outputFormat: "ws"; }>.req: HonoRequest<string, unknown> .req is the instance of HonoRequest.

.raw,

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

options || {})          

(parameter) options: UpgradeWebSocketOptions | undefined

const wsContext:

const wsContext: WSContext<WebSocket>

WSContext

(alias) type WSContext<T = unknown> = { send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void; raw?: T; binaryType: BinaryType; readyState: WSReadyState; url: URL | null; protocol: string | null; close(code?: number, reason?: string): void; } import WSContext

<WebSocket> = {          

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

binaryType: 'arraybuffer',          

(property) binaryType: BinaryType

close:

(method) close(code?: number, reason?: string): void

(code,

(parameter) code: number | undefined

reason) =>

(parameter) reason: string | undefined

socket

const socket: WebSocket

.close

(method) WebSocket.close(code?: number, reason?: string): void Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.

MDN Reference

(code,

(parameter) code: number | undefined

reason),          

(parameter) reason: string | undefined

get protocol() {          

(property) protocol: string | null

return socket

const socket: WebSocket

.protocol          

(property) WebSocket.protocol: string Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation.

MDN Reference

}, raw:

(property) raw?: WebSocket | undefined

socket,          

const socket: WebSocket

get readyState() {          

(property) readyState: WSReadyState

return socket

const socket: WebSocket

.readyState as

(property) WebSocket.readyState: number Returns the state of the WebSocket object's connection. It can have the values described below.

MDN Reference

WSReadyState          

(alias) type WSReadyState = 0 | 2 | 1 | 3 import WSReadyState

}, url:

(property) url: URL | null

socket

const socket: WebSocket

.url ? new

(property) WebSocket.url: string Returns the URL that was used to establish the WebSocket connection.

MDN Reference

URL

var URL: new (url: string | URL, base?: string | URL) => URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

(socket

const socket: WebSocket

.url) : null,          

(property) WebSocket.url: string Returns the URL that was used to establish the WebSocket connection.

MDN Reference

send:

(method) send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void

(source) =>

(parameter) source: string | ArrayBuffer | Uint8Array

socket

const socket: WebSocket

.send

(method) WebSocket.send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.

MDN Reference

(source),          

(parameter) source: string | ArrayBuffer | Uint8Array

} socket

const socket: WebSocket

.onopen =

(property) WebSocket.onopen: ((this: WebSocket, ev: Event) => any) | null MDN Reference

(evt) =>

(parameter) evt: Event

events

const events: WSEvents<WebSocket>

.onOpen?.

(property) WSEvents<WebSocket>.onOpen?: ((evt: Event, ws: WSContext<WebSocket>) => void) | undefined

(evt,

(parameter) evt: Event

wsContext)          

const wsContext: WSContext<WebSocket>

socket

const socket: WebSocket

.onmessage =

(property) WebSocket.onmessage: ((this: WebSocket, ev: MessageEvent) => any) | null MDN Reference

(evt) =>

(parameter) evt: MessageEvent<any>

events

const events: WSEvents<WebSocket>

.onMessage?.

(property) WSEvents<WebSocket>.onMessage?: ((evt: MessageEvent<WSMessageReceive>, ws: WSContext<WebSocket>) => void) | undefined

(evt,

(parameter) evt: MessageEvent<any>

wsContext)          

const wsContext: WSContext<WebSocket>

socket

const socket: WebSocket

.onclose =

(property) WebSocket.onclose: ((this: WebSocket, ev: CloseEvent) => any) | null MDN Reference

(evt) =>

(parameter) evt: CloseEvent

events

const events: WSEvents<WebSocket>

.onClose?.

(property) WSEvents<WebSocket>.onClose?: ((evt: CloseEvent, ws: WSContext<WebSocket>) => void) | undefined

(evt,

(parameter) evt: CloseEvent

wsContext)          

const wsContext: WSContext<WebSocket>

socket

const socket: WebSocket

.onerror =

(property) WebSocket.onerror: ((this: WebSocket, ev: Event) => any) | null MDN Reference

(evt) =>

(parameter) evt: Event

events

const events: WSEvents<WebSocket>

.onError?.

(property) WSEvents<WebSocket>.onError?: ((evt: Event, ws: WSContext<WebSocket>) => void) | undefined

(evt,

(parameter) evt: Event

wsContext)          

const wsContext: WSContext<WebSocket>

return response          

const response: Response

}
src/adapter/lambda-edge/conninfo.test.ts
            
                import { Context } from '../../context'
                import { getConnInfo } from './conninfo'
                import type { CloudFrontEdgeEvent } from './handler'
                
                describe('getConnInfo', () => {
                  it('Should info is valid', () => {
                    const clientIp =

const clientIp: string

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random()

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

.toString()          

(method) Number.toString(radix?: number): string Returns a string representation of an object.

@param radix — Specifies a radix for converting numeric values to strings. This value is only used for numbers.

const env = {          

const env: { event: CloudFrontEdgeEvent; }

event: {          

(property) event: CloudFrontEdgeEvent

Records: [          

(property) CloudFrontEdgeEvent.Records: CloudFrontEvent[]

{ cf: {          

(property) CloudFrontEvent.cf: { config: CloudFrontConfig; request: CloudFrontRequest; response?: CloudFrontResponse; }

request: {          

(property) request: CloudFrontRequest

clientIp,          

(property) CloudFrontRequest.clientIp: string

}, }, }, ], } as CloudFrontEdgeEvent,          

(alias) interface CloudFrontEdgeEvent import CloudFrontEdgeEvent

} const c = new

const c: Context<any, any, {}>

Context(new

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

Request('http://localhost/'), {

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

env })          

(property) env: any Bindings for the environment.

const info =

const info: ConnInfo

getConnInfo

(alias) getConnInfo(c: Context): ConnInfo import getConnInfo

(c)          

const c: Context<any, any, {}>

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.address).toBe

(property) address?: string | undefined Host name such as IP Addr

(clientIp)          

const clientIp: string

}) })
src/adapter/lambda-edge/conninfo.ts
            
                import type { Context } from '../../context'
                import type { GetConnInfo } from '../../helper/conninfo'
                import type { CloudFrontEdgeEvent } from './handler'
                
                type Env = {          

type Env = { Bindings: { event: CloudFrontEdgeEvent; }; }

Bindings: {          

(property) Bindings: { event: CloudFrontEdgeEvent; }

event:

(property) event: CloudFrontEdgeEvent

CloudFrontEdgeEvent          

(alias) interface CloudFrontEdgeEvent import CloudFrontEdgeEvent

} } export const getConnInfo:

const getConnInfo: GetConnInfo

GetConnInfo =

(alias) type GetConnInfo = (c: Context) => ConnInfo import GetConnInfo Helper type

(c:

(parameter) c: Context<Env, any, {}>

Context

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

<Env>) => ({          

type Env = { Bindings: { event: CloudFrontEdgeEvent; }; }

remote: {          

(property) ConnInfo.remote: NetAddrInfo Remote information

address:

(property) address: string

c

(parameter) c: Context<Env, any, {}>

.env

(property) Context<Env, any, {}>.env: { event: CloudFrontEdgeEvent; } .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

.event

(property) event: CloudFrontEdgeEvent

.Records[0]

(property) CloudFrontEdgeEvent.Records: CloudFrontEvent[]

.cf

(property) CloudFrontEvent.cf: { config: CloudFrontConfig; request: CloudFrontRequest; response?: CloudFrontResponse; }

.request

(property) request: CloudFrontRequest

.clientIp,          

(property) CloudFrontRequest.clientIp: string

}, })
src/adapter/lambda-edge/handler.test.ts
            
                import { encodeBase64 } from '../../utils/encode'
                import { createBody, isContentTypeBinary } from './handler'
                
                describe('isContentTypeBinary', () => {
                  it('Should determine whether it is binary', () => {
                    expect(isContentTypeBinary('image/png')).toBe(true)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('font/woff2')).toBe(true)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('image/svg+xml')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('image/svg+xml; charset=UTF-8')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('text/plain')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('text/plain; charset=UTF-8')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('text/css')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('text/javascript')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('application/json')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('application/ld+json')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

expect(isContentTypeBinary('application/json; charset=UTF-8')).toBe(false)          

(alias) isContentTypeBinary(contentType: string): boolean import isContentTypeBinary

}) }) describe('createBody', () => { it('Should the request be a GET or HEAD, the Request must not include a Body', () => { const encoder = new

const encoder: TextEncoder

TextEncoder()          

var TextEncoder: new () => TextEncoder TextEncoder takes a stream of code points as input and emits a stream of bytes. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays.

MDN Reference

const data =

const data: Uint8Array

encoder

const encoder: TextEncoder

.encode('test')          

(method) TextEncoder.encode(input?: string): Uint8Array Returns the result of running UTF-8's encoder.

MDN Reference

const body = {          

const body: { action: string; data: string; encoding: string; inputTruncated: boolean; }

action: 'read-only',          

(property) action: string

data:

(property) data: string

encodeBase64

(alias) encodeBase64(buf: ArrayBufferLike): string import encodeBase64

(data),          

const data: Uint8Array

encoding: 'base64',          

(property) encoding: string

inputTruncated: false,          

(property) inputTruncated: boolean

} expect(createBody('GET',

(alias) createBody(method: string, requestBody: CloudFrontRequest["body"]): string | Uint8Array | undefined import createBody

body)).toEqual(undefined)          

const body: { action: string; data: string; encoding: string; inputTruncated: boolean; }

expect(createBody('GET',

(alias) createBody(method: string, requestBody: CloudFrontRequest["body"]): string | Uint8Array | undefined import createBody

body)).not.toEqual

const body: { action: string; data: string; encoding: string; inputTruncated: boolean; }

(data)          

const data: Uint8Array

expect(createBody('HEAD',

(alias) createBody(method: string, requestBody: CloudFrontRequest["body"]): string | Uint8Array | undefined import createBody

body)).toEqual(undefined)          

const body: { action: string; data: string; encoding: string; inputTruncated: boolean; }

expect(createBody('HEAD',

(alias) createBody(method: string, requestBody: CloudFrontRequest["body"]): string | Uint8Array | undefined import createBody

body)).not.toEqual

const body: { action: string; data: string; encoding: string; inputTruncated: boolean; }

(data)          

const data: Uint8Array

expect(createBody('POST',

(alias) createBody(method: string, requestBody: CloudFrontRequest["body"]): string | Uint8Array | undefined import createBody

body)).toEqual

const body: { action: string; data: string; encoding: string; inputTruncated: boolean; }

(data)          

const data: Uint8Array

expect(createBody('POST',

(alias) createBody(method: string, requestBody: CloudFrontRequest["body"]): string | Uint8Array | undefined import createBody

body)).not.toEqual(undefined)          

const body: { action: string; data: string; encoding: string; inputTruncated: boolean; }

}) })
src/adapter/lambda-edge/handler.ts
            
                import crypto from 'node:crypto'
                import type { Hono } from '../../hono'
                
                import { decodeBase64, encodeBase64 } from '../../utils/encode'
                
                // eslint-disable-next-line @typescript-eslint/ban-ts-comment
                // @ts-ignore
                globalThis.crypto ??= crypto          

var crypto: Crypto MDN Reference

interface CloudFrontHeader {          

interface CloudFrontHeader

key: string          

(property) CloudFrontHeader.key: string

value: string          

(property) CloudFrontHeader.value: string

} interface CloudFrontHeaders {          

interface CloudFrontHeaders

[name: string]:

(parameter) name: string

CloudFrontHeader[]          

interface CloudFrontHeader

} interface CloudFrontCustomOrigin {          

interface CloudFrontCustomOrigin

customHeaders:

(property) CloudFrontCustomOrigin.customHeaders: CloudFrontHeaders

CloudFrontHeaders          

interface CloudFrontHeaders

domainName: string          

(property) CloudFrontCustomOrigin.domainName: string

keepaliveTimeout: number          

(property) CloudFrontCustomOrigin.keepaliveTimeout: number

path: string          

(property) CloudFrontCustomOrigin.path: string

port: number          

(property) CloudFrontCustomOrigin.port: number

protocol: string          

(property) CloudFrontCustomOrigin.protocol: string

readTimeout: number          

(property) CloudFrontCustomOrigin.readTimeout: number

sslProtocols: string[]          

(property) CloudFrontCustomOrigin.sslProtocols: string[]

} // https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html interface CloudFrontS3Origin {          

interface CloudFrontS3Origin

authMethod: 'origin-access-identity' | 'none'          

(property) CloudFrontS3Origin.authMethod: "none" | "origin-access-identity"

customHeaders:

(property) CloudFrontS3Origin.customHeaders: CloudFrontHeaders

CloudFrontHeaders          

interface CloudFrontHeaders

domainName: string          

(property) CloudFrontS3Origin.domainName: string

path: string          

(property) CloudFrontS3Origin.path: string

region: string          

(property) CloudFrontS3Origin.region: string

} type CloudFrontOrigin =          

type CloudFrontOrigin = { s3: CloudFrontS3Origin; custom?: never; } | { custom: CloudFrontCustomOrigin; s3?: never; }

| { s3:

(property) s3: CloudFrontS3Origin

CloudFrontS3Origin;

interface CloudFrontS3Origin

custom?: never }          

(property) custom?: undefined

| { custom:

(property) custom: CloudFrontCustomOrigin

CloudFrontCustomOrigin;

interface CloudFrontCustomOrigin

s3?: never }          

(property) s3?: undefined

export interface CloudFrontRequest {          

interface CloudFrontRequest

clientIp: string          

(property) CloudFrontRequest.clientIp: string

headers:

(property) CloudFrontRequest.headers: CloudFrontHeaders

CloudFrontHeaders          

interface CloudFrontHeaders

method: string          

(property) CloudFrontRequest.method: string

querystring: string          

(property) CloudFrontRequest.querystring: string

uri: string          

(property) CloudFrontRequest.uri: string

body?: {          

(property) CloudFrontRequest.body?: { inputTruncated: boolean; action: string; encoding: string; data: string; } | undefined

inputTruncated: boolean          

(property) inputTruncated: boolean

action: string          

(property) action: string

encoding: string          

(property) encoding: string

data: string          

(property) data: string

} origin?:

(property) CloudFrontRequest.origin?: CloudFrontOrigin | undefined

CloudFrontOrigin          

type CloudFrontOrigin = { s3: CloudFrontS3Origin; custom?: never; } | { custom: CloudFrontCustomOrigin; s3?: never; }

} export interface CloudFrontResponse {          

interface CloudFrontResponse

headers:

(property) CloudFrontResponse.headers: CloudFrontHeaders

CloudFrontHeaders          

interface CloudFrontHeaders

status: string          

(property) CloudFrontResponse.status: string

statusDescription?: string          

(property) CloudFrontResponse.statusDescription?: string | undefined

} export interface CloudFrontConfig {          

interface CloudFrontConfig

distributionDomainName: string          

(property) CloudFrontConfig.distributionDomainName: string

distributionId: string          

(property) CloudFrontConfig.distributionId: string

eventType: string          

(property) CloudFrontConfig.eventType: string

requestId: string          

(property) CloudFrontConfig.requestId: string

} interface CloudFrontEvent {          

interface CloudFrontEvent

cf: {          

(property) CloudFrontEvent.cf: { config: CloudFrontConfig; request: CloudFrontRequest; response?: CloudFrontResponse; }

config:

(property) config: CloudFrontConfig

CloudFrontConfig          

interface CloudFrontConfig

request:

(property) request: CloudFrontRequest

CloudFrontRequest          

interface CloudFrontRequest

response?:

(property) response?: CloudFrontResponse | undefined

CloudFrontResponse          

interface CloudFrontResponse

} } export interface CloudFrontEdgeEvent {          

interface CloudFrontEdgeEvent

Records:

(property) CloudFrontEdgeEvent.Records: CloudFrontEvent[]

CloudFrontEvent[]          

interface CloudFrontEvent

} type CloudFrontContext = {}          

type CloudFrontContext = {}

export interface Callback {          

interface Callback

(err:

(parameter) err: Error | null

Error | null,

interface Error

result?:

(parameter) result: CloudFrontRequest | CloudFrontResult | undefined

CloudFrontRequest |

interface CloudFrontRequest

CloudFrontResult): void          

interface CloudFrontResult

} // https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-generating-http-responses-in-requests.html#lambda-generating-http-responses-programming-model interface CloudFrontResult {          

interface CloudFrontResult

status: string          

(property) CloudFrontResult.status: string

statusDescription?: string          

(property) CloudFrontResult.statusDescription?: string | undefined

headers?: {          

(property) CloudFrontResult.headers?: { [header: string]: { key: string; value: string; }[]; } | undefined

[header: string]: {          

(parameter) header: string

key: string          

(property) key: string

value: string          

(property) value: string

}[] } body?: string          

(property) CloudFrontResult.body?: string | undefined

bodyEncoding?: 'text' | 'base64'          

(property) CloudFrontResult.bodyEncoding?: "text" | "base64" | undefined

} /** * Accepts events from 'Lambda@Edge' event * https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html */ const convertHeaders =

const convertHeaders: (headers: Headers) => CloudFrontHeaders Accepts events from 'Lambda@Edge' event https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html

(headers:

(parameter) headers: Headers

Headers):

interface Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

CloudFrontHeaders => {          

interface CloudFrontHeaders

const cfHeaders:

const cfHeaders: CloudFrontHeaders

CloudFrontHeaders = {}          

interface CloudFrontHeaders

headers

(parameter) headers: Headers

.forEach(

(method) Headers.forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void

(value,

(parameter) value: string

key) => {          

(parameter) key: string

cfHeaders

const cfHeaders: CloudFrontHeaders

[key

(parameter) key: string

.toLowerCase()] = [{

(method) String.toLowerCase(): string Converts all the alphabetic characters in a string to lowercase.

key:

(property) CloudFrontHeader.key: string

key

(parameter) key: string

.toLowerCase(),

(method) String.toLowerCase(): string Converts all the alphabetic characters in a string to lowercase.

value }]          

(property) CloudFrontHeader.value: string

}) return cfHeaders          

const cfHeaders: CloudFrontHeaders

} export const handle = (          

const handle: (app: Hono<any>) => ((event: CloudFrontEdgeEvent, context?: CloudFrontContext, callback?: Callback) => Promise<CloudFrontResult>)

// eslint-disable-next-line @typescript-eslint/no-explicit-any app:

(parameter) app: Hono<any, BlankSchema, "/">

Hono          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

): (( event:

(parameter) event: CloudFrontEdgeEvent

CloudFrontEdgeEvent,          

interface CloudFrontEdgeEvent

context?:

(parameter) context: CloudFrontContext | undefined

CloudFrontContext,          

type CloudFrontContext = {}

callback?:

(parameter) callback: Callback | undefined

Callback          

interface Callback

) => Promise

interface Promise<T> Represents the completion of an asynchronous operation

<CloudFrontResult>) => {          

interface CloudFrontResult

return async (event,

(parameter) event: CloudFrontEdgeEvent

context?,

(parameter) context: CloudFrontContext | undefined

callback?) => {          

(parameter) callback: Callback | undefined

const res = await

const res: Response

app

(parameter) app: Hono<any, BlankSchema, "/">

.fetch

(property) Hono<any, BlankSchema, "/">.fetch: (request: Request, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response> .fetch() will be entry point of your app.

@see — https://hono.dev/docs/api/hono#fetch

@param request — request Object of request

@param Env — env Object

@param — - context of execution

@returns — response of request

(createRequest

const createRequest: (event: CloudFrontEdgeEvent) => Request

(event), {          

(parameter) event: CloudFrontEdgeEvent

event,          

(property) event: CloudFrontEdgeEvent

context,          

(property) context: CloudFrontContext | undefined

callback:

(property) callback: (err: Error | null, result?: CloudFrontResult | CloudFrontRequest) => void

(err:

(parameter) err: Error | null

Error | null,

interface Error

result?:

(parameter) result: CloudFrontRequest | CloudFrontResult | undefined

CloudFrontResult |

interface CloudFrontResult

CloudFrontRequest) => {          

interface CloudFrontRequest

callback?.

(parameter) callback: Callback | undefined

(err,

(parameter) err: Error | null

result)          

(parameter) result: CloudFrontRequest | CloudFrontResult | undefined

}, config:

(property) config: CloudFrontConfig

event

(parameter) event: CloudFrontEdgeEvent

.Records[0]

(property) CloudFrontEdgeEvent.Records: CloudFrontEvent[]

.cf

(property) CloudFrontEvent.cf: { config: CloudFrontConfig; request: CloudFrontRequest; response?: CloudFrontResponse; }

.config,          

(property) config: CloudFrontConfig

request:

(property) request: CloudFrontRequest

event

(parameter) event: CloudFrontEdgeEvent

.Records[0]

(property) CloudFrontEdgeEvent.Records: CloudFrontEvent[]

.cf

(property) CloudFrontEvent.cf: { config: CloudFrontConfig; request: CloudFrontRequest; response?: CloudFrontResponse; }

.request,          

(property) request: CloudFrontRequest

response:

(property) response: CloudFrontResponse | undefined

event

(parameter) event: CloudFrontEdgeEvent

.Records[0]

(property) CloudFrontEdgeEvent.Records: CloudFrontEvent[]

.cf

(property) CloudFrontEvent.cf: { config: CloudFrontConfig; request: CloudFrontRequest; response?: CloudFrontResponse; }

.response,          

(property) response?: CloudFrontResponse | undefined

}) return createResult

const createResult: (res: Response) => Promise<CloudFrontResult>

(res)          

const res: Response

} } const createResult = async

const createResult: (res: Response) => Promise<CloudFrontResult>

(res:

(parameter) res: Response

Response):

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<CloudFrontResult> => {          

interface CloudFrontResult

const isBase64Encoded =

const isBase64Encoded: boolean

isContentTypeBinary

const isContentTypeBinary: (contentType: string) => boolean

(res

(parameter) res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('content-type') || '')          

(method) Headers.get(name: string): string | null MDN Reference

const body =

const body: string

isBase64Encoded ?

const isBase64Encoded: boolean

encodeBase64(await

(alias) encodeBase64(buf: ArrayBufferLike): string import encodeBase64

res

(parameter) res: Response

.arrayBuffer()) : await

(method) Body.arrayBuffer(): Promise<ArrayBuffer> MDN Reference

res

(parameter) res: Response

.text()          

(method) Body.text(): Promise<string> MDN Reference

return { status:

(property) CloudFrontResult.status: string

res

(parameter) res: Response

.status

(property) Response.status: number MDN Reference

.toString(),          

(method) Number.toString(radix?: number): string Returns a string representation of an object.

@param radix — Specifies a radix for converting numeric values to strings. This value is only used for numbers.

headers:

(property) CloudFrontResult.headers?: { [header: string]: { key: string; value: string; }[]; } | undefined

convertHeaders

const convertHeaders: (headers: Headers) => CloudFrontHeaders Accepts events from 'Lambda@Edge' event https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html

(res

(parameter) res: Response

.headers),          

(property) Response.headers: Headers MDN Reference

body,          

(property) CloudFrontResult.body?: string | undefined

...(isBase64Encoded ? {

const isBase64Encoded: boolean

bodyEncoding: 'base64' } : {}),          

(property) CloudFrontResult.bodyEncoding?: "text" | "base64" | undefined

} } const createRequest =

const createRequest: (event: CloudFrontEdgeEvent) => Request

(event:

(parameter) event: CloudFrontEdgeEvent

CloudFrontEdgeEvent):

interface CloudFrontEdgeEvent

Request => {          

interface Request This Fetch API interface represents a resource request.

MDN Reference

const queryString =

const queryString: string

event

(parameter) event: CloudFrontEdgeEvent

.Records[0]

(property) CloudFrontEdgeEvent.Records: CloudFrontEvent[]

.cf

(property) CloudFrontEvent.cf: { config: CloudFrontConfig; request: CloudFrontRequest; response?: CloudFrontResponse; }

.request

(property) request: CloudFrontRequest

.querystring          

(property) CloudFrontRequest.querystring: string

const urlPath = `https://$

const urlPath: string

{event

(parameter) event: CloudFrontEdgeEvent

.Records[0]

(property) CloudFrontEdgeEvent.Records: CloudFrontEvent[]

.cf

(property) CloudFrontEvent.cf: { config: CloudFrontConfig; request: CloudFrontRequest; response?: CloudFrontResponse; }

.config

(property) config: CloudFrontConfig

.distributionDomainName}$

(property) CloudFrontConfig.distributionDomainName: string

{event

(parameter) event: CloudFrontEdgeEvent

.Records[0]

(property) CloudFrontEdgeEvent.Records: CloudFrontEvent[]

.cf

(property) CloudFrontEvent.cf: { config: CloudFrontConfig; request: CloudFrontRequest; response?: CloudFrontResponse; }

.request

(property) request: CloudFrontRequest

.uri}`          

(property) CloudFrontRequest.uri: string

const url =

const url: string

queryString ? `$

const queryString: string

{urlPath}?$

const urlPath: string

{queryString}` :

const queryString: string

urlPath          

const urlPath: string

const headers = new

const headers: Headers

Headers()          

var Headers: new (init?: HeadersInit) => Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<CloudFrontHeader[]>(o: { [s: string]: CloudFrontHeader[]; } | ArrayLike<CloudFrontHeader[]>): [string, CloudFrontHeader[]][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(event

(parameter) event: CloudFrontEdgeEvent

.Records[0]

(property) CloudFrontEdgeEvent.Records: CloudFrontEvent[]

.cf

(property) CloudFrontEvent.cf: { config: CloudFrontConfig; request: CloudFrontRequest; response?: CloudFrontResponse; }

.request

(property) request: CloudFrontRequest

.headers)

(property) CloudFrontRequest.headers: CloudFrontHeaders

.forEach((

(method) Array<[string, CloudFrontHeader[]]>.forEach(callbackfn: (value: [string, CloudFrontHeader[]], index: number, array: [string, CloudFrontHeader[]][]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

[k,

(parameter) k: string

v]) => {          

(parameter) v: CloudFrontHeader[]

v

(parameter) v: CloudFrontHeader[]

.forEach(

(method) Array<CloudFrontHeader>.forEach(callbackfn: (value: CloudFrontHeader, index: number, array: CloudFrontHeader[]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(header) =>

(parameter) header: CloudFrontHeader

headers

const headers: Headers

.set

(method) Headers.set(name: string, value: string): void MDN Reference

(k,

(parameter) k: string

header

(parameter) header: CloudFrontHeader

.value))          

(property) CloudFrontHeader.value: string

}) const requestBody =

const requestBody: { inputTruncated: boolean; action: string; encoding: string; data: string; } | undefined

event

(parameter) event: CloudFrontEdgeEvent

.Records[0]

(property) CloudFrontEdgeEvent.Records: CloudFrontEvent[]

.cf

(property) CloudFrontEvent.cf: { config: CloudFrontConfig; request: CloudFrontRequest; response?: CloudFrontResponse; }

.request

(property) request: CloudFrontRequest

.body          

(property) CloudFrontRequest.body?: { inputTruncated: boolean; action: string; encoding: string; data: string; } | undefined

const method =

const method: string

event

(parameter) event: CloudFrontEdgeEvent

.Records[0]

(property) CloudFrontEdgeEvent.Records: CloudFrontEvent[]

.cf

(property) CloudFrontEvent.cf: { config: CloudFrontConfig; request: CloudFrontRequest; response?: CloudFrontResponse; }

.request

(property) request: CloudFrontRequest

.method          

(property) CloudFrontRequest.method: string

const body =

const body: string | Uint8Array | undefined

createBody

const createBody: (method: string, requestBody: CloudFrontRequest["body"]) => string | Uint8Array | undefined

(method,

const method: string

requestBody)          

const requestBody: { inputTruncated: boolean; action: string; encoding: string; data: string; } | undefined

return new Request

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

(url, {          

const url: string

headers,          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

method,          

(property) RequestInit.method?: string | undefined A string to set request's method.

body,          

(property) RequestInit.body?: BodyInit | null | undefined A BodyInit object or null to set request's body.

}) } export const createBody = (          

const createBody: (method: string, requestBody: CloudFrontRequest["body"]) => string | Uint8Array | undefined

method: string,          

(parameter) method: string

requestBody:

(parameter) requestBody: { inputTruncated: boolean; action: string; encoding: string; data: string; } | undefined

CloudFrontRequest['body']          

interface CloudFrontRequest

): string | Uint8Array | undefined => {          

interface Uint8Array A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.

if (!requestBody ||

(parameter) requestBody: { inputTruncated: boolean; action: string; encoding: string; data: string; } | undefined

!requestBody

(parameter) requestBody: { inputTruncated: boolean; action: string; encoding: string; data: string; }

.data) {          

(property) data: string

return undefined } if (method === 'GET' ||

(parameter) method: string

method === 'HEAD') {          

(parameter) method: string

return undefined } if (requestBody

(parameter) requestBody: { inputTruncated: boolean; action: string; encoding: string; data: string; }

.encoding === 'base64') {          

(property) encoding: string

return decodeBase64

(alias) decodeBase64(str: string): Uint8Array import decodeBase64

(requestBody

(parameter) requestBody: { inputTruncated: boolean; action: string; encoding: string; data: string; }

.data)          

(property) data: string

} return requestBody

(parameter) requestBody: { inputTruncated: boolean; action: string; encoding: string; data: string; }

.data          

(property) data: string

} export const isContentTypeBinary =

const isContentTypeBinary: (contentType: string) => boolean

(contentType: string): boolean => {          

(parameter) contentType: string

return !/^(text\/(plain|html|css|javascript|csv).*|application\/(.*json|.*xml).*|image\/svg\+xml.*)$/.test(          

(method) RegExp.test(string: string): boolean Returns a Boolean value that indicates whether or not a pattern exists in a searched string.

@param string — String on which to perform the search.

contentType          

(parameter) contentType: string

) }
src/adapter/lambda-edge/index.ts
            
                /**
                 * @module
                 * Lambda@Edge Adapter for Hono.
                 */
                
                export { handle } from './handler'          

(alias) const handle: (app: Hono<any>) => ((event: CloudFrontEdgeEvent, context?: CloudFrontContext, callback?: Callback) => Promise<CloudFrontResult>) export handle

export { getConnInfo } from './conninfo'          

(alias) const getConnInfo: GetConnInfo export getConnInfo

export type { Callback,          

(alias) interface Callback export Callback

CloudFrontConfig,          

(alias) interface CloudFrontConfig export CloudFrontConfig

CloudFrontRequest,          

(alias) interface CloudFrontRequest export CloudFrontRequest

CloudFrontResponse,          

(alias) interface CloudFrontResponse export CloudFrontResponse

CloudFrontEdgeEvent,          

(alias) interface CloudFrontEdgeEvent export CloudFrontEdgeEvent

} from './handler'
src/adapter/netlify/handler.ts
            
                /* eslint-disable @typescript-eslint/no-explicit-any */
                import type { Hono } from '../../hono'
                
                export const handle = (          

const handle: (app: Hono<any, any>) => ((req: Request, context: any) => Response | Promise<Response>)

app:

(parameter) app: Hono<any, any, "/">

Hono          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

): ((req:

(parameter) req: Request

Request,

interface Request This Fetch API interface represents a resource request.

MDN Reference

context: any) =>

(parameter) context: any

Response |

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response>) => {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

return (req:

(parameter) req: Request

Request,

interface Request This Fetch API interface represents a resource request.

MDN Reference

context: any) => {          

(parameter) context: any

return app

(parameter) app: Hono<any, any, "/">

.fetch

(property) Hono<any, any, "/">.fetch: (request: Request, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response> .fetch() will be entry point of your app.

@see — https://hono.dev/docs/api/hono#fetch

@param request — request Object of request

@param Env — env Object

@param — - context of execution

@returns — response of request

(req, {

(parameter) req: Request

context })          

(property) context: any

} }
src/adapter/netlify/index.ts
            
                /**
                 * @module
                 * Netlify Adapter for Hono.
                 */
                
                export * from './mod'
            
src/adapter/netlify/mod.ts
            
                export { handle } from './handler'          

(alias) const handle: (app: Hono<any, any>) => ((req: Request, context: any) => Response | Promise<Response>) export handle

src/adapter/service-worker/handler.test.ts
            
                import { Hono } from '../../hono'
                import { handle } from './handler'
                import type { FetchEvent } from './types'
                
                describe('handle', () => {
                  it('Success to fetch', async () => {
                    const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", JSONRespondReturn<{ hello: string; }, StatusCode>, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ hello: string; }, StatusCode>(object: { hello: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ hello: string; }, StatusCode> (+1 overload)

hello: 'world' })          

(property) hello: string

}) const handler =

const handler: Handler

handle

(alias) handle(app: Hono, opts?: { fetch?: typeof fetch; }): Handler import handle Adapter for Service Worker

(app)          

const app: Hono<BlankEnv, BlankSchema, "/">

const json = await new

const json: any

Promise

var Promise: PromiseConstructor new <Response>(executor: (resolve: (value: Response | PromiseLike<Response>) => void, reject: (reason?: any) => void) => void) => Promise<...> Creates a new Promise.

@param executor
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

<Response>(

interface Response This Fetch API interface represents the response to a request.

MDN Reference

(resolve) => {          

(parameter) resolve: (value: Response | PromiseLike<Response>) => void

handler({          

const handler: (evt: FetchEvent) => void

request: new

(property) FetchEvent.request: Request

Request('http://localhost/'),          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

respondWith

(method) FetchEvent.respondWith(r: Response | PromiseLike<Response>): void

(res) {          

(parameter) res: Response | PromiseLike<Response>

resolve

(parameter) resolve: (value: Response | PromiseLike<Response>) => void

(res)          

(parameter) res: Response | PromiseLike<Response>

}, } as FetchEvent)          

(alias) interface FetchEvent import FetchEvent

}).then(

(method) Promise<Response>.then<any, never>(onfulfilled?: ((value: Response) => any) | null | undefined, onrejected?: ((reason: any) => PromiseLike<never>) | null | undefined): Promise<any> Attaches callbacks for the resolution and/or rejection of the Promise.

@param onfulfilled — The callback to execute when the Promise is resolved.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of which ever callback is executed.

(res) =>

(parameter) res: Response

res

(parameter) res: Response

.json())          

(method) Body.json(): Promise<any> MDN Reference

expect(json).toStrictEqual({

const json: any

hello: 'world' })          

(property) hello: string

}) it('Fallback 404', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const handler =

const handler: Handler

handle

(alias) handle(app: Hono, opts?: { fetch?: typeof fetch; }): Handler import handle Adapter for Service Worker

(app, {          

const app: Hono<BlankEnv, BlankSchema, "/">

async fetch() {          

(property) fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined

return new Response('hello world')          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

}, }) const text = await new

const text: string

Promise

var Promise: PromiseConstructor new <Response>(executor: (resolve: (value: Response | PromiseLike<Response>) => void, reject: (reason?: any) => void) => void) => Promise<...> Creates a new Promise.

@param executor
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

<Response>(

interface Response This Fetch API interface represents the response to a request.

MDN Reference

(resolve) => {          

(parameter) resolve: (value: Response | PromiseLike<Response>) => void

handler({          

const handler: (evt: FetchEvent) => void

request: new

(property) FetchEvent.request: Request

Request('http://localhost/'),          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

respondWith

(method) FetchEvent.respondWith(r: Response | PromiseLike<Response>): void

(res) {          

(parameter) res: Response | PromiseLike<Response>

resolve

(parameter) resolve: (value: Response | PromiseLike<Response>) => void

(res)          

(parameter) res: Response | PromiseLike<Response>

}, } as FetchEvent)          

(alias) interface FetchEvent import FetchEvent

}).then(

(method) Promise<Response>.then<string, never>(onfulfilled?: ((value: Response) => string | PromiseLike<string>) | null | undefined, onrejected?: ((reason: any) => PromiseLike<never>) | null | undefined): Promise<...> Attaches callbacks for the resolution and/or rejection of the Promise.

@param onfulfilled — The callback to execute when the Promise is resolved.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of which ever callback is executed.

(res) =>

(parameter) res: Response

res

(parameter) res: Response

.text())          

(method) Body.text(): Promise<string> MDN Reference

expect(text).toBe('hello world')          

const text: string

}) it('Do not fallback 404 when fetch is undefined', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"Not found", 404, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text('Not found', 404))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Not found", 404>(text: "Not found", status?: 404 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Not found", 404, "text"> (+1 overload)

const handler =

const handler: Handler

handle

(alias) handle(app: Hono, opts?: { fetch?: typeof fetch; }): Handler import handle Adapter for Service Worker

(app, {          

const app: Hono<BlankEnv, BlankSchema, "/">

fetch: undefined,          

(property) fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined

}) const result = await new

const result: Response

Promise

var Promise: PromiseConstructor new <Response>(executor: (resolve: (value: Response | PromiseLike<Response>) => void, reject: (reason?: any) => void) => void) => Promise<...> Creates a new Promise.

@param executor
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

<Response>(

interface Response This Fetch API interface represents the response to a request.

MDN Reference

(resolve) =>          

(parameter) resolve: (value: Response | PromiseLike<Response>) => void

handler({          

const handler: (evt: FetchEvent) => void

request: new

(property) FetchEvent.request: Request

Request('https://localhost/'),          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

respondWith

(method) FetchEvent.respondWith(r: Response | PromiseLike<Response>): void

(r) {          

(parameter) r: Response | PromiseLike<Response>

resolve

(parameter) resolve: (value: Response | PromiseLike<Response>) => void

(r)          

(parameter) r: Response | PromiseLike<Response>

}, } as FetchEvent)          

(alias) interface FetchEvent import FetchEvent

) expect(result

const result: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(await result

const result: Response

.text()).toBe('Not found')          

(method) Body.text(): Promise<string> MDN Reference

}) })
src/adapter/service-worker/handler.ts
            
                /**
                 * Handler for Service Worker
                 * @module
                 */
                
                import type { Hono } from '../../hono'
                import type { FetchEvent } from './types'
                
                type Handler = 

type Handler = (evt: FetchEvent) => void

(evt:

(parameter) evt: FetchEvent

FetchEvent) => void          

(alias) interface FetchEvent import FetchEvent

/** * Adapter for Service Worker */ export const handle = (          

const handle: (app: Hono, opts?: { fetch?: typeof fetch; }) => Handler Adapter for Service Worker

app:

(parameter) app: Hono<BlankEnv, BlankSchema, "/">

Hono,          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

opts: {          

(parameter) opts: { fetch?: typeof fetch; }

fetch?: typeof

(property) fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined

fetch          

function fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response> MDN Reference

} = { // To use `fetch` on a Service Worker correctly, first refer to `self.fetch`. fetch: globalThis

(property) fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined

.self !== undefined ? globalThis

var self: Window & typeof globalThis MDN Reference

.self

var self: Window & typeof globalThis MDN Reference

.fetch :

(method) fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response> MDN Reference

fetch,          

function fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response> MDN Reference

} ): Handler => {          

type Handler = (evt: FetchEvent) => void

return (evt) => {          

(parameter) evt: FetchEvent

evt

(parameter) evt: FetchEvent

.respondWith(          

(method) FetchEvent.respondWith(r: Response | PromiseLike<Response>): void

(async () => { const res = await

const res: Response

app

(parameter) app: Hono<BlankEnv, BlankSchema, "/">

.fetch

(property) Hono<BlankEnv, BlankSchema, "/">.fetch: (request: Request, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .fetch() will be entry point of your app.

@see — https://hono.dev/docs/api/hono#fetch

@param request — request Object of request

@param Env — env Object

@param — - context of execution

@returns — response of request

(evt

(parameter) evt: FetchEvent

.request)          

(property) FetchEvent.request: Request

if (opts

(parameter) opts: { fetch?: typeof fetch; }

.fetch &&

(property) fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined

res

const res: Response

.status === 404) {          

(property) Response.status: number MDN Reference

return await opts

(parameter) opts: { fetch?: typeof fetch; }

.fetch

(property) fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response> MDN Reference

(evt

(parameter) evt: FetchEvent

.request)          

(property) FetchEvent.request: Request

} return res          

const res: Response

})() ) } }
src/adapter/service-worker/index.ts
            
                /**
                 * Cloudflare Workers Adapter for Hono.
                 * @module
                 */
                export { handle } from './handler'          

(alias) const handle: (app: Hono, opts?: { fetch?: typeof fetch; }) => Handler export handle Adapter for Service Worker

src/adapter/service-worker/types.ts
            
                interface ExtendableEvent extends

interface ExtendableEvent

Event {          

interface Event An event which takes place in the DOM.

MDN Reference

// eslint-disable-next-line @typescript-eslint/no-explicit-any waitUntil

(method) ExtendableEvent.waitUntil(f: Promise<any>): void

(f:

(parameter) f: Promise<any>

Promise): void          

interface Promise<T> Represents the completion of an asynchronous operation

} export interface FetchEvent extends

interface FetchEvent

ExtendableEvent {          

interface ExtendableEvent

readonly clientId: string          

(property) FetchEvent.clientId: string

readonly handled:

(property) FetchEvent.handled: Promise<undefined>

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

// eslint-disable-next-line @typescript-eslint/no-explicit-any readonly preloadResponse:

(property) FetchEvent.preloadResponse: Promise<any>

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

readonly request:

(property) FetchEvent.request: Request

Request          

interface Request This Fetch API interface represents a resource request.

MDN Reference

readonly resultingClientId: string          

(property) FetchEvent.resultingClientId: string

respondWith

(method) FetchEvent.respondWith(r: Response | PromiseLike<Response>): void

(r:

(parameter) r: Response | PromiseLike<Response>

Response |

interface Response This Fetch API interface represents the response to a request.

MDN Reference

PromiseLike

interface PromiseLike<T>

<Response>): void          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

}
src/adapter/vercel/conninfo.test.ts
            
                import { Context } from '../../context'
                import { getConnInfo } from './conninfo'
                
                describe('getConnInfo', () => {
                  it('Should getConnInfo works', () => {
                    const address =

const address: string

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random()

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

.toString()          

(method) Number.toString(radix?: number): string Returns a string representation of an object.

@param radix — Specifies a radix for converting numeric values to strings. This value is only used for numbers.

const req = new

const req: Request

Request('http://localhost/', {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

'x-real-ip': address,          

const address: string

}, }) const c = new

const c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

const info =

const info: ConnInfo

getConnInfo

(alias) getConnInfo(c: Context): ConnInfo import getConnInfo

(c)          

const c: Context<any, any, {}>

expect(info

const info: ConnInfo

.remote

(property) ConnInfo.remote: NetAddrInfo Remote information

.address).toBe

(property) address?: string | undefined Host name such as IP Addr

(address)          

const address: string

}) })
src/adapter/vercel/conninfo.ts
            
                import type { GetConnInfo } from '../../helper/conninfo'
                
                export const getConnInfo:

const getConnInfo: GetConnInfo

GetConnInfo =

(alias) type GetConnInfo = (c: Context) => ConnInfo import GetConnInfo Helper type

(c) => ({          

(parameter) c: Context<any, any, {}>

remote: {          

(property) ConnInfo.remote: NetAddrInfo Remote information

// https://github.com/vercel/vercel/blob/b70bfb5fbf28a4650d4042ce68ca5c636d37cf44/packages/edge/src/edge-headers.ts#L10-L12C32 address:

(property) address: string | undefined

c

(parameter) c: Context<any, any, {}>

.req

(property) Context<any, any, {}>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.header('x-real-ip'),          

(method) HonoRequest<any, unknown>.header(name: string): string | undefined (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

}, })
src/adapter/vercel/handler.test.ts
            
                /* eslint-disable @typescript-eslint/no-explicit-any */
                import { Hono } from '../../hono'
                import { handle } from './handler'
                
                describe('Adapter for Next.js', () => {
                  it('Should return 200 response with a `waitUntil` value', async () => {
                    const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/api/foo', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/api/foo", "/api/foo", Promise<JSONRespondReturn<{ path: string; waitUntil: any; }, StatusCode>>, BlankInput, BlankEnv>(path: "/api/foo", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/api/foo", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/api/foo", BlankInput>

.json({          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ path: string; waitUntil: any; }, StatusCode>(object: { path: string; waitUntil: any; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

path: '/api/foo',          

(property) path: string

/** * Checking if the `waitUntil` value is passed. */ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore waitUntil:

(property) waitUntil: any Checking if the waitUntil value is passed.

c

(parameter) c: Context<BlankEnv, "/api/foo", BlankInput>

.executionCtx

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.executionCtx: ExecutionContext

@see — https://hono.dev/docs/api/context#executionctxThe ExecutionContext associated with the current request.

@throws — Will throw an error if the context does not have an ExecutionContext.

.waitUntil() as any,          

(method) ExecutionContext.waitUntil(promise: Promise<unknown>): void Extends the lifetime of the event callback until the promise is settled.

@param promise — A promise to wait for.

}) }) const handler =

const handler: (req: Request, requestContext: FetchEventLike) => Response | Promise<Response>

handle

(alias) handle(app: Hono<any, any, any>): (req: Request, requestContext: FetchEventLike) => Response | Promise<Response> import handle

(app)          

const app: Hono<BlankEnv, BlankSchema, "/">

const req = new

const req: Request

Request('http://localhost/api/foo')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const res = await

const res: Response

handler

const handler: (req: Request, requestContext: FetchEventLike) => Response | Promise<Response>

(req, {

const req: Request

waitUntil: () => 'waitUntil' } as any)          

(property) waitUntil: () => string

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

path: '/api/foo',          

(property) path: string

waitUntil: 'waitUntil',          

(property) waitUntil: string

}) }) it('Should not use `route()` if path argument is not passed', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/api">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.basePath('/api')          

(method) Hono<BlankEnv, BlankSchema, "/">.basePath<"/api">(path: "/api"): Hono<BlankEnv, BlankSchema, "/api"> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

app

const app: Hono<BlankEnv, BlankSchema, "/api">

.onError(

(property) Hono<BlankEnv, BlankSchema, "/api">.onError: (handler: ErrorHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/api"> .onError() handles an error and returns a customized Response.

@see — https://hono.dev/docs/api/hono#error-handling

@param handler — request Handler for error

@returns — changed Hono instance

@example
ts app.onError((err, c) => { console.error(`${err}`) return c.text('Custom Error Message', 500) })

(e) => {          

(parameter) e: Error | HTTPResponseError

throw e          

(parameter) e: Error | HTTPResponseError

}) app

const app: Hono<BlankEnv, BlankSchema, "/api">

.get('/error', () => {          

(property) Hono<BlankEnv, BlankSchema, "/api">.get: HandlerInterface <"/error", "/api/error", never, BlankInput, BlankEnv>(path: "/error", handler: H<BlankEnv, "/api/error", BlankInput, never>) => Hono<...> (+22 overloads)

throw new Error('Custom Error')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) const handler =

const handler: (req: Request, requestContext: FetchEventLike) => Response | Promise<Response>

handle

(alias) handle(app: Hono<any, any, any>): (req: Request, requestContext: FetchEventLike) => Response | Promise<Response> import handle

(app)          

const app: Hono<BlankEnv, BlankSchema, "/api">

const req = new

const req: Request

Request('http://localhost/api/error')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

expect(() => handler

const handler: (req: Request, requestContext: FetchEventLike) => Response | Promise<Response>

(req, {          

const req: Request

waitUntil: () => {},          

(property) waitUntil: () => void

} as any) ).toThrowError('Custom Error') }) })
src/adapter/vercel/handler.ts
            
                /* eslint-disable @typescript-eslint/no-explicit-any */
                import type { Hono } from '../../hono'
                import type { FetchEventLike } from '../../types'
                
                export const handle =          

const handle: (app: Hono<any, any, any>) => (req: Request, requestContext: FetchEventLike) => Response | Promise<Response>

(app:

(parameter) app: Hono<any, any, any>

Hono) =>          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

(req:

(parameter) req: Request

Request,

interface Request This Fetch API interface represents a resource request.

MDN Reference

requestContext:

(parameter) requestContext: FetchEventLike

FetchEventLike):

(alias) class FetchEventLike import FetchEventLike

Response |

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response> => {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

return app

(parameter) app: Hono<any, any, any>

.fetch

(property) Hono<any, any, any>.fetch: (request: Request, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response> .fetch() will be entry point of your app.

@see — https://hono.dev/docs/api/hono#fetch

@param request — request Object of request

@param Env — env Object

@param — - context of execution

@returns — response of request

(req, {},

(parameter) req: Request

requestContext as any)          

(parameter) requestContext: FetchEventLike

}
src/adapter/vercel/index.ts
            
                /**
                 * @module
                 * Vercel Adapter for Hono.
                 */
                
                export { handle } from './handler'          

(alias) const handle: (app: Hono<any, any, any>) => (req: Request, requestContext: FetchEventLike) => Response | Promise<Response> export handle

export { getConnInfo } from './conninfo'          

(alias) const getConnInfo: GetConnInfo export getConnInfo

src/client/client.test.ts
            
                /* eslint-disable @typescript-eslint/no-unused-vars */
                
                /* eslint-disable @typescript-eslint/ban-ts-comment */
                import { HttpResponse, http } from 'msw'
                import { setupServer } from 'msw/node'
                import { expectTypeOf, vi } from 'vitest'
                import { upgradeWebSocket } from '../adapter/deno/websocket'
                import { Hono } from '../hono'
                import { parse } from '../utils/cookie'
                import type { Equal, Expect, JSONValue, SimplifyDeepArray } from '../utils/types'
                import { validator } from '../validator'
                import { hc } from './client'
                import type { ClientResponse, InferRequestType, InferResponseType } from './types'
                
                describe('Basic - JSON', () => {
                  const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const route =

const route: Hono<BlankEnv, { "/posts": { $post: { input: { cookie: { debug: string; }; } & { header: { 'x-message': string; }; } & { json: { id: number; title: string; }; }; output: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; }, "/">

app          

const app: Hono<BlankEnv, BlankSchema, "/">

.post(          

(property) Hono<BlankEnv, BlankSchema, "/">.post: HandlerInterface <"/posts", "/posts", JSONRespondReturn<{ success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { id: number; title: string; }; }, StatusCode>, { ...; }, { ...; }, { ...; }, { ...; } & ... 1 more ... & { ...; }, any, any, any, {}>(path: "/posts", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>) => Hono<...> (+22 overloads)

'/posts', validator('cookie', () => {          

(alias) validator<unknown, string, string, "cookie", { debug: string; }, { debug: string; }, string, { in: { cookie: { debug: string; }; }; out: { cookie: { debug: string; }; }; }, any>(target: "cookie", validationFunc: ValidationFunction<Record<string, string>, { ...; }, any, string>): MiddlewareHandler<...> import validator

return {} as { debug: string          

(property) debug: string

} }), validator('header', () => {          

(alias) validator<unknown, "/posts", string, "header", { 'x-message': string; }, { 'x-message': string; }, "/posts", { in: { header: { 'x-message': string; }; }; out: { header: { 'x-message': string; }; }; }, any>(target: "header", validationFunc: ValidationFunction<Record<string, string>, { ...; }, any, "/posts">): MiddlewareHandler<...> import validator

return {} as { 'x-message': string } }), validator('json', () => {          

(alias) validator<unknown, "/posts", string, "json", { id: number; title: string; }, { id: number; title: string; }, "/posts", { in: { json: { id: number; title: string; }; }; out: { json: { id: number; title: string; }; }; }, any>(target: "json", validationFunc: ValidationFunction<...>): MiddlewareHandler<...> import validator

return {} as { id: number          

(property) id: number

title: string          

(property) title: string

} }), (c) => {          

(parameter) c: Context<{}, "/posts", { in: { cookie: { debug: string; }; }; out: { cookie: { debug: string; }; }; } & { in: { header: { 'x-message': string; }; }; out: { header: { 'x-message': string; }; }; } & { in: { json: { id: number; title: string; }; }; out: { ...; }; }>

return c

(parameter) c: Context<{}, "/posts", { in: { cookie: { debug: string; }; }; out: { cookie: { debug: string; }; }; } & { in: { header: { 'x-message': string; }; }; out: { header: { 'x-message': string; }; }; } & { in: { json: { id: number; title: string; }; }; out: { ...; }; }>

.json({          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { id: number; title: string; }; }, StatusCode>(object: { success: boolean; ... 4 more ...; requestBody: { id: number; title: string; }; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

success: true,          

(property) success: boolean

message: 'dummy',          

(property) message: string

requestContentType: 'dummy',          

(property) requestContentType: string

requestHono: 'dummy',          

(property) requestHono: string

requestMessage: 'dummy',          

(property) requestMessage: string

requestBody: {          

(property) requestBody: { id: number; title: string; }

id: 123,          

(property) id: number

title: 'dummy',          

(property) title: string

}, }) } ) .get('/hello-not-found',

(property) Hono<BlankEnv, { "/posts": { $post: { input: { cookie: { debug: string; }; } & { header: { 'x-message': string; }; } & { json: { id: number; title: string; }; }; output: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">.get: HandlerInterface <"/hello-not-found", "/hello-not-found", Response | Promise<Response>, BlankInput, BlankEnv>(path: "/hello-not-found", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/hello-not-found", BlankInput>

c

(parameter) c: Context<BlankEnv, "/hello-not-found", BlankInput>

.notFound())          

(property) Context<BlankEnv, "/hello-not-found", BlankInput>.notFound: () => Response | Promise<Response> .notFound() can return the Not Found Response.

@see — https://hono.dev/docs/api/context#notfound

@example
ts app.get('/notfound', (c) => { return c.notFound() })

.get('/null',

(property) Hono<BlankEnv, { "/posts": { $post: { input: { cookie: { debug: string; }; } & { header: { 'x-message': string; }; } & { json: { id: number; title: string; }; }; output: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; }, "/">.get: HandlerInterface <"/null", "/null", JSONRespondReturn<null, StatusCode>, BlankInput, BlankEnv>(path: "/null", handler: H<BlankEnv, "/null", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/null", BlankInput>

c

(parameter) c: Context<BlankEnv, "/null", BlankInput>

.json(null))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <null, StatusCode>(object: null, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<null, StatusCode> (+1 overload)

type AppType = typeof

type AppType = Hono<BlankEnv, { "/posts": { $post: { input: { cookie: { debug: string; }; } & { header: { 'x-message': string; }; } & { json: { id: number; title: string; }; }; output: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; }, "/">

route          

const route: Hono<BlankEnv, { "/posts": { $post: { input: { cookie: { debug: string; }; } & { header: { 'x-message': string; }; } & { json: { id: number; title: string; }; }; output: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; }, "/">

const server = setupServer(          

const server: any

http.post('http://localhost/posts', async ({ request }) => {          

(parameter) request: any

const requestContentType =

const requestContentType: any

request.headers.get('content-type')          

(parameter) request: any

const requestHono =

const requestHono: any

request.headers.get('x-hono')          

(parameter) request: any

const requestMessage =

const requestMessage: any

request.headers.get('x-message')          

(parameter) request: any

const requestBody = await

const requestBody: any

request.json()          

(parameter) request: any

const payload = {          

const payload: { message: string; success: boolean; requestContentType: any; requestHono: any; requestMessage: any; requestBody: any; }

message: 'Hello!',          

(property) message: string

success: true,          

(property) success: boolean

requestContentType,          

(property) requestContentType: any

requestHono,          

(property) requestHono: any

requestMessage,          

(property) requestMessage: any

requestBody,          

(property) requestBody: any

} return HttpResponse.json(payload)          

const payload: { message: string; success: boolean; requestContentType: any; requestHono: any; requestMessage: any; requestBody: any; }

}), http.get('http://localhost/hello-not-found', () => { return HttpResponse.text(null, { status: 404,          

(property) status: number

}) }), http.get('http://localhost/null', () => { return HttpResponse.json(null) }), http.get('http://localhost/api/string', () => { return HttpResponse.json('a-string') }), http.get('http://localhost/api/number', async () => { return HttpResponse.json(37) }), http.get('http://localhost/api/boolean', async () => { return HttpResponse.json(true) }), http.get('http://localhost/api/generic', async () => { return HttpResponse.json(Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random() > 0.5 ?

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

Boolean

var Boolean: BooleanConstructor <number>(value?: number | undefined) => boolean

(Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random()) :

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random())          

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

}) ) beforeAll(() => server.listen())          

const server: any

afterEach(() => server.resetHandlers())          

const server: any

afterAll(() => server.close())          

const server: any

const payload = {          

const payload: { id: number; title: string; }

id: 123,          

(property) id: number

title: 'Hello! Hono!',          

(property) title: string

} const client =

const client: { posts: ClientRequest<{ $post: { input: { cookie: { debug: string; }; } & { header: { 'x-message': string; }; } & { json: { id: number; title: string; }; }; output: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }; outputFormat: "json"; status: StatusCode; }; }>; } & { ...; } & { ...; }

hc

(alias) hc<Hono<BlankEnv, { "/posts": { $post: { input: { cookie: { debug: string; }; } & { header: { 'x-message': string; }; } & { json: { id: number; title: string; }; }; output: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } & ... 1 more ... & { ...; } import hc

<AppType>('http://localhost', {

type AppType = Hono<BlankEnv, { "/posts": { $post: { input: { cookie: { debug: string; }; } & { header: { 'x-message': string; }; } & { json: { id: number; title: string; }; }; output: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; }, "/">

headers: { 'x-hono': 'hono' } })          

(property) headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>) | undefined

it('Should get 200 response', async () => { const res = await

const res: ClientResponse<{ success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }, StatusCode, "json">

client.posts.$post(          

const client: { posts: ClientRequest<{ $post: { input: { cookie: { debug: string; }; } & { header: { 'x-message': string; }; } & { json: { id: number; title: string; }; }; output: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }; outputFormat: "json"; status: StatusCode; }; }>; } & { ...; } & { ...; }

{ json:

(property) json: { id: number; title: string; }

payload,          

const payload: { id: number; title: string; }

header: {          

(property) header: { 'x-message': string; }

'x-message': 'foobar', }, cookie: {          

(property) cookie: { debug: string; }

debug: 'true',          

(property) debug: string

}, }, {} ) expect(res

const res: ClientResponse<{ success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }, StatusCode, "json">

.ok).toBe(true)          

(property) ClientResponse<{ success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }, StatusCode, "json">.ok: boolean MDN Reference

const data = await

const data: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }

res

const res: ClientResponse<{ success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }, StatusCode, "json">

.json()          

(method) ClientResponse<{ success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }, StatusCode, "json">.json(): Promise<{ success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { id: number; title: string; }; }> MDN Reference

expect(data

const data: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }

.success).toBe(true)          

(property) success: boolean

expect(data

const data: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }

.message).toBe('Hello!')          

(property) message: string

expect(data

const data: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }

.requestContentType).toBe('application/json')          

(property) requestContentType: string

expect(data

const data: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }

.requestHono).toBe('hono')          

(property) requestHono: string

expect(data

const data: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }

.requestMessage).toBe('foobar')          

(property) requestMessage: string

expect(data

const data: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }

.requestBody).toEqual

(property) requestBody: { id: number; title: string; }

(payload)          

const payload: { id: number; title: string; }

}) it('Should get 404 response', async () => { const res = await

const res: ClientResponse<{}, StatusCode, string>

client['hello-not-found'].$get()          

const client: { posts: ClientRequest<{ $post: { input: { cookie: { debug: string; }; } & { header: { 'x-message': string; }; } & { json: { id: number; title: string; }; }; output: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }; outputFormat: "json"; status: StatusCode; }; }>; } & { ...; } & { ...; }

expect(res

const res: ClientResponse<{}, StatusCode, string>

.status).toBe(404)          

(property) ClientResponse<{}, StatusCode, string>.status: StatusCode MDN Reference

}) it('Should get a `null` content', async () => { const client =

const client: { posts: ClientRequest<{ $post: { input: { cookie: { debug: string; }; } & { header: { 'x-message': string; }; } & { json: { id: number; title: string; }; }; output: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }; outputFormat: "json"; status: StatusCode; }; }>; } & { ...; } & { ...; }

hc

(alias) hc<Hono<BlankEnv, { "/posts": { $post: { input: { cookie: { debug: string; }; } & { header: { 'x-message': string; }; } & { json: { id: number; title: string; }; }; output: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } & ... 1 more ... & { ...; } import hc

<AppType>('http://localhost')          

type AppType = Hono<BlankEnv, { "/posts": { $post: { input: { cookie: { debug: string; }; } & { header: { 'x-message': string; }; } & { json: { id: number; title: string; }; }; output: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; }, "/">

const res = await

const res: ClientResponse<null, StatusCode, "json">

client.null.$get()          

const client: { posts: ClientRequest<{ $post: { input: { cookie: { debug: string; }; } & { header: { 'x-message': string; }; } & { json: { id: number; title: string; }; }; output: { success: boolean; message: string; requestContentType: string; requestHono: string; requestMessage: string; requestBody: { ...; }; }; outputFormat: "json"; status: StatusCode; }; }>; } & { ...; } & { ...; }

const data = await

const data: null

res

const res: ClientResponse<null, StatusCode, "json">

.json()          

(method) ClientResponse<null, StatusCode, "json">.json(): Promise<null> MDN Reference

expectTypeOf(data).toMatchTypeOf()          

const data: null

expect(data).toBe(null)          

const data: null

}) it('Should have correct types - primitives', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const route =

const route: Hono<BlankEnv, { "/api/string": { $get: { input: {}; output: "a-string"; outputFormat: "json"; status: StatusCode; }; }; } & { "/api/number": { $get: { input: {}; output: 37; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; }, "/">

app          

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/api/string',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/api/string", "/api/string", JSONRespondReturn<"a-string", StatusCode>, BlankInput, BlankEnv>(path: "/api/string", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/api/string", BlankInput>

c

(parameter) c: Context<BlankEnv, "/api/string", BlankInput>

.json('a-string'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <"a-string", StatusCode>(object: "a-string", status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<"a-string", StatusCode> (+1 overload)

.get('/api/number',

(property) Hono<BlankEnv, { "/api/string": { $get: { input: {}; output: "a-string"; outputFormat: "json"; status: StatusCode; }; }; }, "/">.get: HandlerInterface <"/api/number", "/api/number", JSONRespondReturn<37, StatusCode>, BlankInput, BlankEnv>(path: "/api/number", handler: H<BlankEnv, "/api/number", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/api/number", BlankInput>

c

(parameter) c: Context<BlankEnv, "/api/number", BlankInput>

.json(37))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <37, StatusCode>(object: 37, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<37, StatusCode> (+1 overload)

.get('/api/boolean',

(property) Hono<BlankEnv, { "/api/string": { $get: { input: {}; output: "a-string"; outputFormat: "json"; status: StatusCode; }; }; } & { "/api/number": { $get: { input: {}; output: 37; outputFormat: "json"; status: StatusCode; }; }; }, "/">.get: HandlerInterface <"/api/boolean", "/api/boolean", JSONRespondReturn<true, StatusCode>, BlankInput, BlankEnv>(path: "/api/boolean", handler: H<BlankEnv, "/api/boolean", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/api/boolean", BlankInput>

c

(parameter) c: Context<BlankEnv, "/api/boolean", BlankInput>

.json(true))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <true, StatusCode>(object: true, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<true, StatusCode> (+1 overload)

.get('/api/generic',

(property) Hono<BlankEnv, { "/api/string": { $get: { input: {}; output: "a-string"; outputFormat: "json"; status: StatusCode; }; }; } & { "/api/number": { $get: { input: {}; output: 37; outputFormat: "json"; status: StatusCode; }; }; } & { ...; }, "/">.get: HandlerInterface <"/api/generic", "/api/generic", JSONRespondReturn<number | boolean, StatusCode>, BlankInput, BlankEnv>(path: "/api/generic", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>          

(parameter) c: Context<BlankEnv, "/api/generic", BlankInput>

c

(parameter) c: Context<BlankEnv, "/api/generic", BlankInput>

.json

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <number | boolean, StatusCode>(object: number | boolean, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

(Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random() > 0.5 ?

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

Boolean

var Boolean: BooleanConstructor <number>(value?: number | undefined) => boolean

(Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random()) :

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random())          

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

) type AppType = typeof

type AppType = Hono<BlankEnv, { "/api/string": { $get: { input: {}; output: "a-string"; outputFormat: "json"; status: StatusCode; }; }; } & { "/api/number": { $get: { input: {}; output: 37; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; }, "/">

route          

const route: Hono<BlankEnv, { "/api/string": { $get: { input: {}; output: "a-string"; outputFormat: "json"; status: StatusCode; }; }; } & { "/api/number": { $get: { input: {}; output: 37; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; }, "/">

const client =

const client: { api: { string: ClientRequest<{ $get: { input: {}; output: "a-string"; outputFormat: "json"; status: StatusCode; }; }>; }; } & { api: { number: ClientRequest<{ $get: { input: {}; output: 37; outputFormat: "json"; status: StatusCode; }; }>; }; } & { ...; } & { ...; }

hc

(alias) hc<Hono<BlankEnv, { "/api/string": { $get: { input: {}; output: "a-string"; outputFormat: "json"; status: StatusCode; }; }; } & { "/api/number": { $get: { input: {}; output: 37; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } & ... 2 more ... & { ...; } import hc

<AppType>('http://localhost')          

type AppType = Hono<BlankEnv, { "/api/string": { $get: { input: {}; output: "a-string"; outputFormat: "json"; status: StatusCode; }; }; } & { "/api/number": { $get: { input: {}; output: 37; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; }, "/">

const stringFetch = await

const stringFetch: ClientResponse<"a-string", StatusCode, "json">

client.api.string.$get()          

const client: { api: { string: ClientRequest<{ $get: { input: {}; output: "a-string"; outputFormat: "json"; status: StatusCode; }; }>; }; } & { api: { number: ClientRequest<{ $get: { input: {}; output: 37; outputFormat: "json"; status: StatusCode; }; }>; }; } & { ...; } & { ...; }

const stringRes = await

const stringRes: "a-string"

stringFetch

const stringFetch: ClientResponse<"a-string", StatusCode, "json">

.json()          

(method) ClientResponse<"a-string", StatusCode, "json">.json(): Promise<"a-string"> MDN Reference

const numberFetch = await

const numberFetch: ClientResponse<37, StatusCode, "json">

client.api.number.$get()          

const client: { api: { string: ClientRequest<{ $get: { input: {}; output: "a-string"; outputFormat: "json"; status: StatusCode; }; }>; }; } & { api: { number: ClientRequest<{ $get: { input: {}; output: 37; outputFormat: "json"; status: StatusCode; }; }>; }; } & { ...; } & { ...; }

const numberRes = await

const numberRes: 37

numberFetch

const numberFetch: ClientResponse<37, StatusCode, "json">

.json()          

(method) ClientResponse<37, StatusCode, "json">.json(): Promise<37> MDN Reference

const booleanFetch = await

const booleanFetch: ClientResponse<true, StatusCode, "json">

client.api.boolean.$get()          

const client: { api: { string: ClientRequest<{ $get: { input: {}; output: "a-string"; outputFormat: "json"; status: StatusCode; }; }>; }; } & { api: { number: ClientRequest<{ $get: { input: {}; output: 37; outputFormat: "json"; status: StatusCode; }; }>; }; } & { ...; } & { ...; }

const booleanRes = await

const booleanRes: true

booleanFetch

const booleanFetch: ClientResponse<true, StatusCode, "json">

.json()          

(method) ClientResponse<true, StatusCode, "json">.json(): Promise<true> MDN Reference

const genericFetch = await

const genericFetch: ClientResponse<number | boolean, StatusCode, "json">

client.api.generic.$get()          

const client: { api: { string: ClientRequest<{ $get: { input: {}; output: "a-string"; outputFormat: "json"; status: StatusCode; }; }>; }; } & { api: { number: ClientRequest<{ $get: { input: {}; output: 37; outputFormat: "json"; status: StatusCode; }; }>; }; } & { ...; } & { ...; }

const genericRes = await

const genericRes: number | boolean

genericFetch

const genericFetch: ClientResponse<number | boolean, StatusCode, "json">

.json()          

(method) ClientResponse<number | boolean, StatusCode, "json">.json(): Promise<number | boolean> MDN Reference

type stringVerify =

type stringVerify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal<'a-string', typeof

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

stringRes>>          

const stringRes: "a-string"

expect(stringRes).toBe('a-string')          

const stringRes: "a-string"

type numberVerify =

type numberVerify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal<37, typeof

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

numberRes>>          

const numberRes: 37

expect(numberRes).toBe(37)          

const numberRes: 37

type booleanVerify =

type booleanVerify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

booleanRes>>          

const booleanRes: true

expect(booleanRes).toBe(true)          

const booleanRes: true

type genericVerify =

type genericVerify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

genericRes>>          

const genericRes: number | boolean

expect(typeof genericRes === 'number' || typeof

const genericRes: number | boolean

genericRes === 'boolean').toBe(true)          

const genericRes: boolean

// using .text() on json endpoint should return string type textTest =

type textTest = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Promise,

interface Promise<T> Represents the completion of an asynchronous operation

ReturnType

type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any Obtain the return type of a function type

genericFetch

const genericFetch: ClientResponse<number | boolean, StatusCode, "json">

.text>>>          

(method) ClientResponse<number | boolean, StatusCode, "json">.text(): Promise<string> MDN Reference

}) }) describe('Basic - query, queries, form, path params, header and cookie', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const route =

const route: Hono<BlankEnv, { "/search": { $get: { input: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; output: { q: string; tag: string[]; filter: string; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; } & { ...; }, "/">

app          

const app: Hono<BlankEnv, BlankSchema, "/">

.get(          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/search", "/search", JSONRespondReturn<{ q: string; tag: string[]; filter: string; }, StatusCode>, { in: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; out: { ...; }; }, { in: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; out: { ...; }; }, any, {}>(path: "/search", handlers_0: H<...>, handlers_1: H<...>) => Hono<...> (+22 overloads)

'/search', validator('query', () => {          

(alias) validator<unknown, string, string, "query", { q: string; tag: string[]; filter: string; }, { q: string; tag: string[]; filter: string; }, string, { in: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; out: { ...; }; }, any>(target: "query", validationFunc: ValidationFunction<...>): MiddlewareHandler<...> import validator

return {} as { q: string;

(property) q: string

tag: string[];

(property) tag: string[]

filter: string }          

(property) filter: string

}), (c) => {          

(parameter) c: Context<{}, "/search", { in: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; out: { query: { q: string; tag: string[]; filter: string; }; }; }>

return c

(parameter) c: Context<{}, "/search", { in: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; out: { query: { q: string; tag: string[]; filter: string; }; }; }>

.json({          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ q: string; tag: string[]; filter: string; }, StatusCode>(object: { q: string; tag: string[]; filter: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

q: 'fake',          

(property) q: string

tag: ['fake'],          

(property) tag: string[]

filter: 'fake',          

(property) filter: string

}) } ) .put(          

(property) Hono<BlankEnv, { "/search": { $get: { input: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; output: { q: string; tag: string[]; filter: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">.put: HandlerInterface <"/posts/:id", "/posts/:id", JSONRespondReturn<{ title: string; }, StatusCode>, { in: { form: { title: ParsedFormValue | ParsedFormValue[]; }; }; out: { ...; }; }, { in: { form: { title: ParsedFormValue | ParsedFormValue[]; }; }; out: { ...; }; }, any, {}>(path: "/posts/:id", handlers_0: H<...>, handlers_1: H<...>) => Hono<...> (+22 overloads)

'/posts/:id', validator('form', () => {          

(alias) validator<unknown, string, string, "form", { title: string; }, { title: string; }, string, { in: { form: { title: ParsedFormValue | ParsedFormValue[]; }; }; out: { form: { title: string; }; }; }, any>(target: "form", validationFunc: ValidationFunction<...>): MiddlewareHandler<...> import validator

return { title: 'Hello',          

(property) title: string

} }), (c) => {          

(parameter) c: Context<{}, "/posts/:id", { in: { form: { title: ParsedFormValue | ParsedFormValue[]; }; }; out: { form: { title: string; }; }; }>

const data =

const data: { title: string; }

c

(parameter) c: Context<{}, "/posts/:id", { in: { form: { title: ParsedFormValue | ParsedFormValue[]; }; }; out: { form: { title: string; }; }; }>

.req

(property) Context<{}, "/posts/:id", { in: { form: { title: ParsedFormValue | ParsedFormValue[]; }; }; out: { form: { title: string; }; }; }>.req: HonoRequest<"/posts/:id", { form: { title: string; }; }> .req is the instance of HonoRequest.

.valid('form')          

(method) HonoRequest<"/posts/:id", { form: { title: string; }; }>.valid<"form">(target: "form"): { title: string; } Gets validated data from the request.

@param target — The target of the validation.

@returns — The validated data.

@see — https://hono.dev/docs/api/request#valid

return c

(parameter) c: Context<{}, "/posts/:id", { in: { form: { title: ParsedFormValue | ParsedFormValue[]; }; }; out: { form: { title: string; }; }; }>

.json

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ title: string; }, StatusCode>(object: { title: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ title: string; }, StatusCode> (+1 overload)

(data)          

const data: { title: string; }

} ) .get(          

(property) Hono<BlankEnv, { "/search": { $get: { input: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; output: { q: string; tag: string[]; filter: string; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; }, "/">.get: HandlerInterface <"/header", "/header", JSONRespondReturn<{ 'x-message-id': string; }, StatusCode>, { in: { header: { 'x-message-id': string; }; }; out: { header: { 'x-message-id': string; }; }; }, { in: { header: { 'x-message-id': string; }; }; out: { header: { 'x-message-id': string; }; }; }, any, {}>(path: "/header", handlers_0: H<...>, handlers_1: H<...>) => Hono<...> (+22 overloads)

'/header', validator('header', () => {          

(alias) validator<unknown, string, string, "header", { 'x-message-id': string; }, { 'x-message-id': string; }, string, { in: { header: { 'x-message-id': string; }; }; out: { header: { 'x-message-id': string; }; }; }, any>(target: "header", validationFunc: ValidationFunction<Record<...>, { ...; }, any, string>): MiddlewareHandler<...> import validator

return { 'x-message-id': 'Hello', } }), (c) => {          

(parameter) c: Context<{}, "/header", { in: { header: { 'x-message-id': string; }; }; out: { header: { 'x-message-id': string; }; }; }>

const data =

const data: { 'x-message-id': string; }

c

(parameter) c: Context<{}, "/header", { in: { header: { 'x-message-id': string; }; }; out: { header: { 'x-message-id': string; }; }; }>

.req

(property) Context<{}, "/header", { in: { header: { 'x-message-id': string; }; }; out: { header: { 'x-message-id': string; }; }; }>.req: HonoRequest<"/header", { header: { 'x-message-id': string; }; }> .req is the instance of HonoRequest.

.valid('header')          

(method) HonoRequest<"/header", { header: { 'x-message-id': string; }; }>.valid<"header">(target: "header"): { 'x-message-id': string; } Gets validated data from the request.

@param target — The target of the validation.

@returns — The validated data.

@see — https://hono.dev/docs/api/request#valid

return c

(parameter) c: Context<{}, "/header", { in: { header: { 'x-message-id': string; }; }; out: { header: { 'x-message-id': string; }; }; }>

.json

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ 'x-message-id': string; }, StatusCode>(object: { 'x-message-id': string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

(data)          

const data: { 'x-message-id': string; }

} ) .get(          

(property) Hono<BlankEnv, { "/search": { $get: { input: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; output: { q: string; tag: string[]; filter: string; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; }, "/">.get: HandlerInterface <"/cookie", "/cookie", JSONRespondReturn<{ hello: string; }, StatusCode>, { in: { cookie: { hello: string; }; }; out: { cookie: { hello: string; }; }; }, { in: { cookie: { hello: string; }; }; out: { cookie: { hello: string; }; }; }, any, {}>(path: "/cookie", handlers_0: H<...>, handlers_1: H<...>) => Hono<...> (+22 overloads)

'/cookie', validator('cookie', () => {          

(alias) validator<unknown, string, string, "cookie", { hello: string; }, { hello: string; }, string, { in: { cookie: { hello: string; }; }; out: { cookie: { hello: string; }; }; }, any>(target: "cookie", validationFunc: ValidationFunction<Record<string, string>, { ...; }, any, string>): MiddlewareHandler<...> import validator

return { hello: 'world',          

(property) hello: string

} }), (c) => {          

(parameter) c: Context<{}, "/cookie", { in: { cookie: { hello: string; }; }; out: { cookie: { hello: string; }; }; }>

const data =

const data: { hello: string; }

c

(parameter) c: Context<{}, "/cookie", { in: { cookie: { hello: string; }; }; out: { cookie: { hello: string; }; }; }>

.req

(property) Context<{}, "/cookie", { in: { cookie: { hello: string; }; }; out: { cookie: { hello: string; }; }; }>.req: HonoRequest<"/cookie", { cookie: { hello: string; }; }> .req is the instance of HonoRequest.

.valid('cookie')          

(method) HonoRequest<"/cookie", { cookie: { hello: string; }; }>.valid<"cookie">(target: "cookie"): { hello: string; } Gets validated data from the request.

@param target — The target of the validation.

@returns — The validated data.

@see — https://hono.dev/docs/api/request#valid

return c

(parameter) c: Context<{}, "/cookie", { in: { cookie: { hello: string; }; }; out: { cookie: { hello: string; }; }; }>

.json

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ hello: string; }, StatusCode>(object: { hello: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ hello: string; }, StatusCode> (+1 overload)

(data)          

const data: { hello: string; }

} ) const server = setupServer(          

const server: any

http.get('http://localhost/api/search', ({ request }) => {          

(parameter) request: any

const url = new

const url: URL

URL

var URL: new (url: string | URL, base?: string | URL) => URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

(request.url)          

(parameter) request: any

const query =

const query: string | null

url

const url: URL

.searchParams

(property) URL.searchParams: URLSearchParams MDN Reference

.get('q')          

(method) URLSearchParams.get(name: string): string | null Returns the first value associated to the given search parameter.

MDN Reference

const tag =

const tag: string[]

url

const url: URL

.searchParams

(property) URL.searchParams: URLSearchParams MDN Reference

.getAll('tag')          

(method) URLSearchParams.getAll(name: string): string[] Returns all the values association with a given search parameter.

MDN Reference

const filter =

const filter: string | null

url

const url: URL

.searchParams

(property) URL.searchParams: URLSearchParams MDN Reference

.get('filter')          

(method) URLSearchParams.get(name: string): string | null Returns the first value associated to the given search parameter.

MDN Reference

return HttpResponse.json({ q:

(property) q: string | null

query,          

const query: string | null

tag,          

(property) tag: string[]

filter,          

(property) filter: string | null

}) }), http.get('http://localhost/api/posts', ({ request }) => {          

(parameter) request: any

const url = new

const url: URL

URL

var URL: new (url: string | URL, base?: string | URL) => URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

(request.url)          

(parameter) request: any

const tags =

const tags: string[]

url

const url: URL

.searchParams

(property) URL.searchParams: URLSearchParams MDN Reference

.getAll('tags')          

(method) URLSearchParams.getAll(name: string): string[] Returns all the values association with a given search parameter.

MDN Reference

return HttpResponse.json({ tags:

(property) tags: string[]

tags,          

const tags: string[]

}) }), http.put('http://localhost/api/posts/123', async ({ request }) => {          

(parameter) request: any

const buffer = await

const buffer: any

request.arrayBuffer()          

(parameter) request: any

// @ts-ignore const string =

const string: string

String

var String: StringConstructor Allows manipulation and formatting of text strings and determination and location of substrings within strings.

.fromCharCode

(method) StringConstructor.fromCharCode(...codes: number[]): string

.apply('', new

(method) CallableFunction.apply<string, number[], string>(this: (this: string, ...args: number[]) => string, thisArg: string, args: number[]): string (+1 overload) Calls the function with the specified object as the this value and the elements of specified array as the arguments.

@param thisArg — The object to be used as the this object.

@param args — An array of argument values to be passed to the function.

Uint8Array

var Uint8Array: Uint8ArrayConstructor new (elements: Iterable<number>) => Uint8Array (+4 overloads)

(buffer))          

const buffer: any

return HttpResponse.text(string)          

const string: string

}), http.get('http://localhost/api/header', async ({ request }) => {          

(parameter) request: any

const message = await

const message: any

request.headers.get('x-message-id')          

(parameter) request: any

return HttpResponse.json({ 'x-message-id': message })          

const message: any

}), http.get('http://localhost/api/cookie', async ({ request }) => {          

(parameter) request: any

const obj =

const obj: Cookie

parse

(alias) parse(cookie: string, name?: string): Cookie import parse

(request.headers.get('cookie') || '')          

(parameter) request: any

const value =

const value: string

obj['hello']          

const obj: Cookie

return HttpResponse.json({ hello:

(property) hello: string

value })          

const value: string

}) ) beforeAll(() => server.listen())          

const server: any

afterEach(() => server.resetHandlers())          

const server: any

afterAll(() => server.close())          

const server: any

type AppType = typeof

type AppType = Hono<BlankEnv, { "/search": { $get: { input: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; output: { q: string; tag: string[]; filter: string; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; } & { ...; }, "/">

route          

const route: Hono<BlankEnv, { "/search": { $get: { input: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; output: { q: string; tag: string[]; filter: string; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; } & { ...; }, "/">

const client =

const client: { search: ClientRequest<{ $get: { input: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; output: { q: string; tag: string[]; filter: string; }; outputFormat: "json"; status: StatusCode; }; }>; } & { ...; } & { ...; } & { ...; }

hc

(alias) hc<Hono<BlankEnv, { "/search": { $get: { input: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; output: { q: string; tag: string[]; filter: string; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; } & { ...; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } & ... 2 more ... & { ...; } import hc

<AppType>('http://localhost/api')          

type AppType = Hono<BlankEnv, { "/search": { $get: { input: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; output: { q: string; tag: string[]; filter: string; }; outputFormat: "json"; status: StatusCode; }; }; } & { ...; } & { ...; } & { ...; }, "/">

it('Should get 200 response - query', async () => { const res = await

const res: ClientResponse<{ q: string; tag: string[]; filter: string; }, StatusCode, "json">

client.search.$get({          

const client: { search: ClientRequest<{ $get: { input: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; output: { q: string; tag: string[]; filter: string; }; outputFormat: "json"; status: StatusCode; }; }>; } & { ...; } & { ...; } & { ...; }

query: {          

(property) query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }

q: 'foobar',          

(property) q: string | string[]

tag: ['a', 'b'],          

(property) tag: string | string[]

// @ts-expect-error filter: undefined,          

(property) filter: string | string[]

}, }) expect(res

const res: ClientResponse<{ q: string; tag: string[]; filter: string; }, StatusCode, "json">

.status).toBe(200)          

(property) ClientResponse<{ q: string; tag: string[]; filter: string; }, StatusCode, "json">.status: StatusCode MDN Reference

expect(await res

const res: ClientResponse<{ q: string; tag: string[]; filter: string; }, StatusCode, "json">

.json()).toEqual({          

(method) ClientResponse<{ q: string; tag: string[]; filter: string; }, StatusCode, "json">.json(): Promise<{ q: string; tag: string[]; filter: string; }> MDN Reference

q: 'foobar',          

(property) q: string

tag: ['a', 'b'],          

(property) tag: string[]

filter: null,          

(property) filter: null

}) }) it('Should get 200 response - form, params', async () => { const res = await

const res: ClientResponse<{ title: string; }, StatusCode, "json">

client.posts[':id'].$put({          

const client: { search: ClientRequest<{ $get: { input: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; output: { q: string; tag: string[]; filter: string; }; outputFormat: "json"; status: StatusCode; }; }>; } & { ...; } & { ...; } & { ...; }

form: {          

(property) form: { title: ParsedFormValue | ParsedFormValue[]; }

title: 'Good Night',          

(property) title: ParsedFormValue | ParsedFormValue[]

}, param: {          

(property) param: { id: string; }

id: '123',          

(property) id: string

}, }) expect(res

const res: ClientResponse<{ title: string; }, StatusCode, "json">

.status).toBe(200)          

(property) ClientResponse<{ title: string; }, StatusCode, "json">.status: StatusCode MDN Reference

expect(await res

const res: ClientResponse<{ title: string; }, StatusCode, "json">

.text()).toMatch('Good Night')          

(method) ClientResponse<{ title: string; }, StatusCode, "json">.text(): Promise<string> MDN Reference

}) it('Should get 200 response - header', async () => { const header = {          

const header: { 'x-message-id': string; }

'x-message-id': 'Hello', } const res = await

const res: ClientResponse<{ 'x-message-id': string; }, StatusCode, "json">

client.header.$get({          

const client: { search: ClientRequest<{ $get: { input: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; output: { q: string; tag: string[]; filter: string; }; outputFormat: "json"; status: StatusCode; }; }>; } & { ...; } & { ...; } & { ...; }

header,          

(property) header: { 'x-message-id': string; }

}) expect(res

const res: ClientResponse<{ 'x-message-id': string; }, StatusCode, "json">

.status).toBe(200)          

(property) ClientResponse<{ 'x-message-id': string; }, StatusCode, "json">.status: StatusCode MDN Reference

expect(await res

const res: ClientResponse<{ 'x-message-id': string; }, StatusCode, "json">

.json()).toEqual

(method) ClientResponse<{ 'x-message-id': string; }, StatusCode, "json">.json(): Promise<{ 'x-message-id': string; }> MDN Reference

(header)          

const header: { 'x-message-id': string; }

}) it('Should get 200 response - cookie', async () => { const cookie = {          

const cookie: { hello: string; }

hello: 'world',          

(property) hello: string

} const res = await

const res: ClientResponse<{ hello: string; }, StatusCode, "json">

client.cookie.$get({          

const client: { search: ClientRequest<{ $get: { input: { query: { q: string | string[]; tag: string | string[]; filter: string | string[]; }; }; output: { q: string; tag: string[]; filter: string; }; outputFormat: "json"; status: StatusCode; }; }>; } & { ...; } & { ...; } & { ...; }

cookie,          

(property) cookie: { hello: string; }

}) expect(res

const res: ClientResponse<{ hello: string; }, StatusCode, "json">

.status).toBe(200)          

(property) ClientResponse<{ hello: string; }, StatusCode, "json">.status: StatusCode MDN Reference

expect(await res

const res: ClientResponse<{ hello: string; }, StatusCode, "json">

.json()).toEqual

(method) ClientResponse<{ hello: string; }, StatusCode, "json">.json(): Promise<{ hello: string; }> MDN Reference

(cookie)          

const cookie: { hello: string; }

}) }) describe('Form - Multiple Values', () => { const server = setupServer(          

const server: any

http.post('http://localhost/multiple-values', async ({ request }) => {          

(parameter) request: any

const data = await

const data: any

request.formData()          

(parameter) request: any

return HttpResponse.json(data.getAll('key'))          

const data: any

}) ) beforeAll(() => server.listen())          

const server: any

afterEach(() => server.resetHandlers())          

const server: any

afterAll(() => server.close())          

const server: any

const client =

const client: { [x: string]: ClientRequest<any>; }

hc('http://localhost/')          

(alias) hc<Hono<any, any, any>>(baseUrl: string, options?: ClientRequestOptions): { [x: string]: ClientRequest<any>; } import hc

it('Should get 200 response - query', async () => { // @ts-expect-error `client['multiple-values'].$post` is not typed const res = await

const res: any

client['multiple-values'].$post({          

const client: { [x: string]: ClientRequest<any>; }

form: {          

(property) form: { key: string[]; }

key: ['foo', 'bar'],          

(property) key: string[]

}, }) expect(res.status).toBe(200)          

const res: any

expect(await res.json()).toEqual(['foo', 'bar'])          

const res: any

}) }) describe('Infer the response/request type', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const route =

const route: Hono<BlankEnv, { "/": { $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get(          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", JSONRespondReturn<{ id: number; title: string; }, StatusCode>, { in: { query: { name: string | string[]; age: string | string[]; }; }; out: { query: { name: string; age: string; }; }; }, { ...; }, { ...; }, { in: { query: { name: string | string[]; age: string | string[]; }; }; out: { query: { name: string; age: string; }; }; } & ... 1 more ... & { ...; }, any, any, any, {}>(path: "/", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>) => Hono<...> (+22 overloads)

'/', validator('query', () => {          

(alias) validator<unknown, string, string, "query", { name: string; age: string; }, { name: string; age: string; }, string, { in: { query: { name: string | string[]; age: string | string[]; }; }; out: { query: { name: string; age: string; }; }; }, any>(target: "query", validationFunc: ValidationFunction<...>): MiddlewareHandler<...> import validator

return { name: 'dummy',          

(property) name: string

age: 'dummy',          

(property) age: string

} }), validator('header', () => {          

(alias) validator<unknown, "/", string, "header", { 'x-request-id': string; }, { 'x-request-id': string; }, "/", { in: { header: { 'x-request-id': string; }; }; out: { header: { 'x-request-id': string; }; }; }, any>(target: "header", validationFunc: ValidationFunction<Record<string, string>, { ...; }, any, "/">): MiddlewareHandler<...> import validator

return { 'x-request-id': 'dummy', } }), validator('cookie', () => {          

(alias) validator<unknown, "/", string, "cookie", { name: string; }, { name: string; }, "/", { in: { cookie: { name: string; }; }; out: { cookie: { name: string; }; }; }, any>(target: "cookie", validationFunc: ValidationFunction<Record<string, string>, { name: string; }, any, "/">): MiddlewareHandler<...> import validator

return { name: 'dummy',          

(property) name: string

} }), (c) =>          

(parameter) c: Context<{}, "/", { in: { query: { name: string | string[]; age: string | string[]; }; }; out: { query: { name: string; age: string; }; }; } & { in: { header: { 'x-request-id': string; }; }; out: { header: { 'x-request-id': string; }; }; } & { ...; }>

c

(parameter) c: Context<{}, "/", { in: { query: { name: string | string[]; age: string | string[]; }; }; out: { query: { name: string; age: string; }; }; } & { in: { header: { 'x-request-id': string; }; }; out: { header: { 'x-request-id': string; }; }; } & { ...; }>

.json({          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ id: number; title: string; }, StatusCode>(object: { id: number; title: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

id: 123,          

(property) id: number

title: 'Morning!',          

(property) title: string

}) ) type AppType = typeof

type AppType = Hono<BlankEnv, { "/": { $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

route          

const route: Hono<BlankEnv, { "/": { $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

it('Should infer response type the type correctly', () => { const client =

const client: { index: ClientRequest<{ $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('/')          

type AppType = Hono<BlankEnv, { "/": { $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const req =

const req: (args: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }, options?: ClientRequestOptions) => Promise<...>

client.index.$get          

const client: { index: ClientRequest<{ $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }>; }

type Actual =

type Actual = { id: number; title: string; }

InferResponseType

(alias) type InferResponseType<T, U extends StatusCode = StatusCode> = InferEndpointType<T> extends { output: infer O; status: infer S; } ? S extends U ? O : never : never import InferResponseType

req>          

const req: (args: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }, options?: ClientRequestOptions) => Promise<...>

type Expected = {          

type Expected = { id: number; title: string; }

id: number          

(property) id: number

title: string          

(property) title: string

} type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Expected,

type Expected = { id: number; title: string; }

Actual>>          

type Actual = { id: number; title: string; }

}) it('Should infer request type the type correctly', () => { const client =

const client: { index: ClientRequest<{ $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('/')          

type AppType = Hono<BlankEnv, { "/": { $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const req =

const req: (args: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }, options?: ClientRequestOptions) => Promise<...>

client.index.$get          

const client: { index: ClientRequest<{ $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }>; }

type Actual =

type Actual = { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }

InferRequestType

(alias) type InferRequestType<T> = T extends (args: infer R, options: any | undefined) => Promise<ClientResponse<unknown>> ? NonNullable<R> : never import InferRequestType

req>          

const req: (args: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }, options?: ClientRequestOptions) => Promise<...>

type Expected = {          

type Expected = { age: string | string[]; name: string | string[]; }

age: string | string[]          

(property) age: string | string[]

name: string | string[]          

(property) name: string | string[]

} type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Expected,

type Expected = { age: string | string[]; name: string | string[]; }

Actual['query']>>          

type Actual = { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }

}) it('Should infer request header type the type correctly', () => { const client =

const client: { index: ClientRequest<{ $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('/')          

type AppType = Hono<BlankEnv, { "/": { $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const req =

const req: (args: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }, options?: ClientRequestOptions) => Promise<...>

client.index.$get          

const client: { index: ClientRequest<{ $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }>; }

type c = typeof

type c = (args: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }, options?: ClientRequestOptions) => Promise<...>

req          

const req: (args: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }, options?: ClientRequestOptions) => Promise<...>

type Actual =

type Actual = { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }

InferRequestType

(alias) type InferRequestType<T> = T extends (args: infer R, options: any | undefined) => Promise<ClientResponse<unknown>> ? NonNullable<R> : never import InferRequestType

<c>          

type c = (args: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }, options?: ClientRequestOptions) => Promise<...>

type Expected = {          

type Expected = { 'x-request-id': string; }

'x-request-id': string } type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Expected,

type Expected = { 'x-request-id': string; }

Actual['header']>>          

type Actual = { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }

}) it('Should infer request cookie type the type correctly', () => { const client =

const client: { index: ClientRequest<{ $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('/')          

type AppType = Hono<BlankEnv, { "/": { $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const req =

const req: (args: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }, options?: ClientRequestOptions) => Promise<...>

client.index.$get          

const client: { index: ClientRequest<{ $get: { input: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }; output: { id: number; title: string; }; outputFormat: "json"; status: StatusCode; }; }>; }

type c = typeof

type c = (args: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }, options?: ClientRequestOptions) => Promise<...>

req          

const req: (args: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }, options?: ClientRequestOptions) => Promise<...>

type Actual =

type Actual = { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }

InferRequestType

(alias) type InferRequestType<T> = T extends (args: infer R, options: any | undefined) => Promise<ClientResponse<unknown>> ? NonNullable<R> : never import InferRequestType

<c>          

type c = (args: { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }, options?: ClientRequestOptions) => Promise<...>

type Expected = {          

type Expected = { name: string; }

name: string          

(property) name: string

} type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Expected,

type Expected = { name: string; }

Actual['cookie']>>          

type Actual = { query: { name: string | string[]; age: string | string[]; }; } & { header: { 'x-request-id': string; }; } & { cookie: { name: string; }; }

}) describe('Without input', () => { const route =

const route: Hono<BlankEnv, { "/": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", JSONRespondReturn<{ ok: boolean; }, StatusCode>, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ ok: boolean; }, StatusCode>(object: { ok: boolean; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ ok: boolean; }, StatusCode> (+1 overload)

ok: true }))          

(property) ok: boolean

type AppType = typeof

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

route          

const route: Hono<BlankEnv, { "/": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

it('Should infer response type the type correctly', () => { const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('/')          

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const req =

const req: (args?: {} | undefined, options?: ClientRequestOptions) => Promise<ClientResponse<{ ok: boolean; }, StatusCode, "json">>

client.index.$get          

const client: { index: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }

type Actual =

type Actual = { ok: boolean; }

InferResponseType

(alias) type InferResponseType<T, U extends StatusCode = StatusCode> = InferEndpointType<T> extends { output: infer O; status: infer S; } ? S extends U ? O : never : never import InferResponseType

req>          

const req: (args?: {} | undefined, options?: ClientRequestOptions) => Promise<ClientResponse<{ ok: boolean; }, StatusCode, "json">>

type Expected = {

type Expected = { ok: boolean; }

ok: boolean }          

(property) ok: boolean

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Expected,

type Expected = { ok: boolean; }

Actual>>          

type Actual = { ok: boolean; }

}) it('Should infer request type the type correctly', () => { const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('/')          

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const req =

const req: (args?: {} | undefined, options?: ClientRequestOptions) => Promise<ClientResponse<{ ok: boolean; }, StatusCode, "json">>

client.index.$get          

const client: { index: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }

type Actual =

type Actual = {}

InferRequestType

(alias) type InferRequestType<T> = T extends (args: infer R, options: any | undefined) => Promise<ClientResponse<unknown>> ? NonNullable<R> : never import InferRequestType

req>          

const req: (args?: {} | undefined, options?: ClientRequestOptions) => Promise<ClientResponse<{ ok: boolean; }, StatusCode, "json">>

type Expected = {}          

type Expected = {}

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Expected,

type Expected = {}

Actual>>          

type Actual = {}

}) }) }) describe('Merge path with `app.route()`', () => { const server = setupServer(          

const server: any

http.get('http://localhost/api/search', async () => { return HttpResponse.json({ ok: true,          

(property) ok: boolean

}) }), http.get('http://localhost/api/searchArray', async () => { return HttpResponse.json([ { ok: true,          

(property) ok: boolean

}, ]) }), http.get('http://localhost/api/foo', async () => { return HttpResponse.json({ ok: true,          

(property) ok: boolean

}) }), http.post('http://localhost/api/bar', async () => { return HttpResponse.json({ ok: true,          

(property) ok: boolean

}) }), http.get('http://localhost/v1/book', async () => { return HttpResponse.json({ ok: true,          

(property) ok: boolean

}) }) ) beforeAll(() => server.listen())          

const server: any

afterEach(() => server.resetHandlers())          

const server: any

afterAll(() => server.close())          

const server: any

type Env = {          

type Env = { Bindings: { TOKEN: string; }; }

Bindings: {          

(property) Bindings: { TOKEN: string; }

TOKEN: string          

(property) TOKEN: string

} } it('Should have correct types', async () => { const api = new

const api: Hono<Env, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono

(alias) new Hono<Env, BlankSchema, "/">(options?: HonoOptions<Env>): Hono<Env, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

<Env>()

type Env = { Bindings: { TOKEN: string; }; }

.get('/search',

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/search", "/search", JSONRespondReturn<{ ok: boolean; }, StatusCode>, BlankInput, Env>(path: "/search", handler: H<Env, "/search", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<Env, "/search", BlankInput>

c

(parameter) c: Context<Env, "/search", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ ok: boolean; }, StatusCode>(object: { ok: boolean; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ ok: boolean; }, StatusCode> (+1 overload)

ok: true }))          

(property) ok: boolean

const app = new

const app: Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono

(alias) new Hono<Env, BlankSchema, "/">(options?: HonoOptions<Env>): Hono<Env, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

<Env>()

type Env = { Bindings: { TOKEN: string; }; }

.route('/api',

(method) Hono<Env, BlankSchema, "/">.route<"/api", Env, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">(path: "/api", app: Hono<Env, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">): Hono<...> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

api)          

const api: Hono<Env, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

type AppType = typeof

type AppType = Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

app          

const app: Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const client =

const client: { api: { search: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

hc

(alias) hc<Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('http://localhost')          

type AppType = Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const res = await

const res: ClientResponse<{ ok: boolean; }, StatusCode, "json">

client.api.search.$get()          

const client: { api: { search: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

const data = await

const data: { ok: boolean; }

res

const res: ClientResponse<{ ok: boolean; }, StatusCode, "json">

.json()          

(method) ClientResponse<{ ok: boolean; }, StatusCode, "json">.json(): Promise<{ ok: boolean; }> MDN Reference

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

data

const data: { ok: boolean; }

.ok>>          

(property) ok: boolean

expect(data

const data: { ok: boolean; }

.ok).toBe(true)          

(property) ok: boolean

}) it('Should have correct types - basePath() then get()', async () => { const base = new

const base: Hono<Env, BlankSchema, "/api">

Hono

(alias) new Hono<Env, BlankSchema, "/">(options?: HonoOptions<Env>): Hono<Env, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

<Env>()

type Env = { Bindings: { TOKEN: string; }; }

.basePath('/api')          

(method) Hono<Env, BlankSchema, "/">.basePath<"/api">(path: "/api"): Hono<Env, BlankSchema, "/api"> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

const app =

const app: Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/api">

base

const base: Hono<Env, BlankSchema, "/api">

.get('/search',

(property) Hono<Env, BlankSchema, "/api">.get: HandlerInterface <"/search", "/api/search", JSONRespondReturn<{ ok: boolean; }, StatusCode>, BlankInput, Env>(path: "/search", handler: H<Env, "/api/search", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<Env, "/api/search", BlankInput>

c

(parameter) c: Context<Env, "/api/search", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ ok: boolean; }, StatusCode>(object: { ok: boolean; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ ok: boolean; }, StatusCode> (+1 overload)

ok: true }))          

(property) ok: boolean

type AppType = typeof

type AppType = Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/api">

app          

const app: Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/api">

const client =

const client: { api: { search: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

hc

(alias) hc<Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/api">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('http://localhost')          

type AppType = Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/api">

const res = await

const res: ClientResponse<{ ok: boolean; }, StatusCode, "json">

client.api.search.$get()          

const client: { api: { search: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

const data = await

const data: { ok: boolean; }

res

const res: ClientResponse<{ ok: boolean; }, StatusCode, "json">

.json()          

(method) ClientResponse<{ ok: boolean; }, StatusCode, "json">.json(): Promise<{ ok: boolean; }> MDN Reference

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

data

const data: { ok: boolean; }

.ok>>          

(property) ok: boolean

expect(data

const data: { ok: boolean; }

.ok).toBe(true)          

(property) ok: boolean

}) it('Should have correct types - basePath(), route(), get()', async () => { const book = new

const book: Hono<BlankEnv, { "/": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", JSONRespondReturn<{ ok: boolean; }, StatusCode>, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ ok: boolean; }, StatusCode>(object: { ok: boolean; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ ok: boolean; }, StatusCode> (+1 overload)

ok: true }))          

(property) ok: boolean

const app = new

const app: Hono<BlankEnv, { "/v1/book": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/v1">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.basePath('/v1')

(method) Hono<BlankEnv, BlankSchema, "/">.basePath<"/v1">(path: "/v1"): Hono<BlankEnv, BlankSchema, "/v1"> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

.route('/book',

(method) Hono<BlankEnv, BlankSchema, "/v1">.route<"/book", BlankEnv, { "/": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">(path: "/book", app: Hono<BlankEnv, { "/": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">): Hono<...> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

book)          

const book: Hono<BlankEnv, { "/": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

type AppType = typeof

type AppType = Hono<BlankEnv, { "/v1/book": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/v1">

app          

const app: Hono<BlankEnv, { "/v1/book": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/v1">

const client =

const client: { v1: { book: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

hc

(alias) hc<Hono<BlankEnv, { "/v1/book": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/v1">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('http://localhost')          

type AppType = Hono<BlankEnv, { "/v1/book": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/v1">

const res = await

const res: ClientResponse<{ ok: boolean; }, StatusCode, "json">

client.v1.book.$get()          

const client: { v1: { book: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

const data = await

const data: { ok: boolean; }

res

const res: ClientResponse<{ ok: boolean; }, StatusCode, "json">

.json()          

(method) ClientResponse<{ ok: boolean; }, StatusCode, "json">.json(): Promise<{ ok: boolean; }> MDN Reference

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

data

const data: { ok: boolean; }

.ok>>          

(property) ok: boolean

expect(data

const data: { ok: boolean; }

.ok).toBe(true)          

(property) ok: boolean

}) it('Should have correct types - with interface', async () => { interface Result {          

interface Result

ok: boolean          

(property) Result.ok: boolean

okUndefined?: boolean          

(property) Result.okUndefined?: boolean | undefined

} const result:

const result: Result

Result = {

interface Result

ok: true }          

(property) Result.ok: boolean

const base = new

const base: Hono<Env, BlankSchema, "/api">

Hono

(alias) new Hono<Env, BlankSchema, "/">(options?: HonoOptions<Env>): Hono<Env, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

<Env>()

type Env = { Bindings: { TOKEN: string; }; }

.basePath('/api')          

(method) Hono<Env, BlankSchema, "/">.basePath<"/api">(path: "/api"): Hono<Env, BlankSchema, "/api"> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

const app =

const app: Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; okUndefined?: boolean | undefined; }; outputFormat: "json"; status: StatusCode; }; }; }, "/api">

base

const base: Hono<Env, BlankSchema, "/api">

.get('/search',

(property) Hono<Env, BlankSchema, "/api">.get: HandlerInterface <"/search", "/api/search", JSONRespondReturn<Result, StatusCode>, BlankInput, Env>(path: "/search", handler: H<Env, "/api/search", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<Env, "/api/search", BlankInput>

c

(parameter) c: Context<Env, "/api/search", BlankInput>

.json

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <Result, StatusCode>(object: Result, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<Result, StatusCode> (+1 overload)

(result))          

const result: Result

type AppType = typeof

type AppType = Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; okUndefined?: boolean | undefined; }; outputFormat: "json"; status: StatusCode; }; }; }, "/api">

app          

const app: Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; okUndefined?: boolean | undefined; }; outputFormat: "json"; status: StatusCode; }; }; }, "/api">

const client =

const client: { api: { search: ClientRequest<{ $get: { input: {}; output: { ok: boolean; okUndefined?: boolean | undefined; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

hc

(alias) hc<Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; okUndefined?: boolean | undefined; }; outputFormat: "json"; status: StatusCode; }; }; }, "/api">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('http://localhost')          

type AppType = Hono<Env, { "/api/search": { $get: { input: {}; output: { ok: boolean; okUndefined?: boolean | undefined; }; outputFormat: "json"; status: StatusCode; }; }; }, "/api">

const res = await

const res: ClientResponse<{ ok: boolean; okUndefined?: boolean | undefined; }, StatusCode, "json">

client.api.search.$get()          

const client: { api: { search: ClientRequest<{ $get: { input: {}; output: { ok: boolean; okUndefined?: boolean | undefined; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

const data = await

const data: { ok: boolean; okUndefined?: boolean | undefined; }

res

const res: ClientResponse<{ ok: boolean; okUndefined?: boolean | undefined; }, StatusCode, "json">

.json()          

(method) ClientResponse<{ ok: boolean; okUndefined?: boolean | undefined; }, StatusCode, "json">.json(): Promise<{ ok: boolean; okUndefined?: boolean | undefined; }> MDN Reference

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Result, typeof

interface Result

data>>          

const data: { ok: boolean; okUndefined?: boolean | undefined; }

expect(data

const data: { ok: boolean; okUndefined?: boolean | undefined; }

.ok).toBe(true)          

(property) ok: boolean

// A few more types only tests interface DeepInterface {          

interface DeepInterface

l2: {          

(property) DeepInterface.l2: { l3: Result; }

l3:

(property) l3: Result

Result          

interface Result

} } interface ExtraDeepInterface {          

interface ExtraDeepInterface

l4:

(property) ExtraDeepInterface.l4: DeepInterface

DeepInterface          

interface DeepInterface

} type verifyDeepInterface =

type verifyDeepInterface = true

Expect<          

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<SimplifyDeepArray

(alias) type SimplifyDeepArray<T> = T extends any[] ? { [E in keyof T]: SimplifyDeepArray<T[E]>; } : { [KeyType in keyof T]: T[KeyType]; } import SimplifyDeepArray A simple extension of Simplify that will deeply traverse array elements.

<DeepInterface> extends

interface DeepInterface

JSONValue ? true : false, true>          

(alias) type JSONValue = JSONObject | JSONArray | JSONPrimitive import JSONValue

> type verifyExtraDeepInterface =

type verifyExtraDeepInterface = true

Expect<          

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<SimplifyDeepArray

(alias) type SimplifyDeepArray<T> = T extends any[] ? { [E in keyof T]: SimplifyDeepArray<T[E]>; } : { [KeyType in keyof T]: T[KeyType]; } import SimplifyDeepArray A simple extension of Simplify that will deeply traverse array elements.

<ExtraDeepInterface> extends

interface ExtraDeepInterface

JSONValue ? true : false, true>          

(alias) type JSONValue = JSONObject | JSONArray | JSONPrimitive import JSONValue

> }) it('Should have correct types - with array of interfaces', async () => { interface Result {          

interface Result

ok: boolean          

(property) Result.ok: boolean

okUndefined?: boolean          

(property) Result.okUndefined?: boolean | undefined

} type Results =

type Results = Result[]

Result[]          

interface Result

const results:

const results: Results

Results = [{

type Results = Result[]

ok: true }]          

(property) Result.ok: boolean

const base = new

const base: Hono<Env, BlankSchema, "/api">

Hono

(alias) new Hono<Env, BlankSchema, "/">(options?: HonoOptions<Env>): Hono<Env, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

<Env>()

type Env = { Bindings: { TOKEN: string; }; }

.basePath('/api')          

(method) Hono<Env, BlankSchema, "/">.basePath<"/api">(path: "/api"): Hono<Env, BlankSchema, "/api"> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

const app =

const app: Hono<Env, { "/api/searchArray": { $get: { input: {}; output: { ok: boolean; okUndefined?: boolean | undefined; }[]; outputFormat: "json"; status: StatusCode; }; }; }, "/api">

base

const base: Hono<Env, BlankSchema, "/api">

.get('/searchArray',

(property) Hono<Env, BlankSchema, "/api">.get: HandlerInterface <"/searchArray", "/api/searchArray", JSONRespondReturn<Results, StatusCode>, BlankInput, Env>(path: "/searchArray", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<Env, "/api/searchArray", BlankInput>

c

(parameter) c: Context<Env, "/api/searchArray", BlankInput>

.json

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <Results, StatusCode>(object: Results, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<Results, StatusCode> (+1 overload)

(results))          

const results: Results

type AppType = typeof

type AppType = Hono<Env, { "/api/searchArray": { $get: { input: {}; output: { ok: boolean; okUndefined?: boolean | undefined; }[]; outputFormat: "json"; status: StatusCode; }; }; }, "/api">

app          

const app: Hono<Env, { "/api/searchArray": { $get: { input: {}; output: { ok: boolean; okUndefined?: boolean | undefined; }[]; outputFormat: "json"; status: StatusCode; }; }; }, "/api">

const client =

const client: { api: { searchArray: ClientRequest<{ $get: { input: {}; output: { ok: boolean; okUndefined?: boolean | undefined; }[]; outputFormat: "json"; status: StatusCode; }; }>; }; }

hc

(alias) hc<Hono<Env, { "/api/searchArray": { $get: { input: {}; output: { ok: boolean; okUndefined?: boolean | undefined; }[]; outputFormat: "json"; status: StatusCode; }; }; }, "/api">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('http://localhost')          

type AppType = Hono<Env, { "/api/searchArray": { $get: { input: {}; output: { ok: boolean; okUndefined?: boolean | undefined; }[]; outputFormat: "json"; status: StatusCode; }; }; }, "/api">

const res = await

const res: ClientResponse<{ ok: boolean; okUndefined?: boolean | undefined; }[], StatusCode, "json">

client.api.searchArray.$get()          

const client: { api: { searchArray: ClientRequest<{ $get: { input: {}; output: { ok: boolean; okUndefined?: boolean | undefined; }[]; outputFormat: "json"; status: StatusCode; }; }>; }; }

const data = await

const data: { ok: boolean; okUndefined?: boolean | undefined; }[]

res

const res: ClientResponse<{ ok: boolean; okUndefined?: boolean | undefined; }[], StatusCode, "json">

.json()          

(method) ClientResponse<{ ok: boolean; okUndefined?: boolean | undefined; }[], StatusCode, "json">.json(): Promise<{ ok: boolean; okUndefined?: boolean | undefined; }[]> MDN Reference

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Results, typeof

type Results = Result[]

data>>          

const data: { ok: boolean; okUndefined?: boolean | undefined; }[]

expect(data[0]

const data: { ok: boolean; okUndefined?: boolean | undefined; }[]

.ok).toBe(true)          

(property) ok: boolean

// A few more types only tests type verifyNestedArrayTyped =

type verifyNestedArrayTyped = true

Expect<          

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<SimplifyDeepArray<[string,

(alias) type SimplifyDeepArray<T> = T extends any[] ? { [E in keyof T]: SimplifyDeepArray<T[E]>; } : { [KeyType in keyof T]: T[KeyType]; } import SimplifyDeepArray A simple extension of Simplify that will deeply traverse array elements.

Results]> extends

type Results = Result[]

JSONValue ? true : false, true>          

(alias) type JSONValue = JSONObject | JSONArray | JSONPrimitive import JSONValue

> type verifyNestedArrayInterfaceArray =

type verifyNestedArrayInterfaceArray = true

Expect<          

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<SimplifyDeepArray<[string,

(alias) type SimplifyDeepArray<T> = T extends any[] ? { [E in keyof T]: SimplifyDeepArray<T[E]>; } : { [KeyType in keyof T]: T[KeyType]; } import SimplifyDeepArray A simple extension of Simplify that will deeply traverse array elements.

Result[]]> extends

interface Result

JSONValue ? true : false, true>          

(alias) type JSONValue = JSONObject | JSONArray | JSONPrimitive import JSONValue

> type verifyExtraNestedArrayTyped =

type verifyExtraNestedArrayTyped = true

Expect<          

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<SimplifyDeepArray<[string,

(alias) type SimplifyDeepArray<T> = T extends any[] ? { [E in keyof T]: SimplifyDeepArray<T[E]>; } : { [KeyType in keyof T]: T[KeyType]; } import SimplifyDeepArray A simple extension of Simplify that will deeply traverse array elements.

Results[]]> extends

type Results = Result[]

JSONValue ? true : false, true>          

(alias) type JSONValue = JSONObject | JSONArray | JSONPrimitive import JSONValue

> type verifyExtraNestedArrayInterfaceArray =

type verifyExtraNestedArrayInterfaceArray = true

Expect<          

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<SimplifyDeepArray<[string,

(alias) type SimplifyDeepArray<T> = T extends any[] ? { [E in keyof T]: SimplifyDeepArray<T[E]>; } : { [KeyType in keyof T]: T[KeyType]; } import SimplifyDeepArray A simple extension of Simplify that will deeply traverse array elements.

Result[][]]> extends

interface Result

JSONValue ? true : false, true>          

(alias) type JSONValue = JSONObject | JSONArray | JSONPrimitive import JSONValue

> }) it('Should allow a Date object and return it as a string', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const route =

const route: Hono<BlankEnv, { "/api/foo": { $get: { input: {}; output: { datetime: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/api/foo',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/api/foo", "/api/foo", JSONRespondReturn<{ datetime: Date; }, StatusCode>, BlankInput, BlankEnv>(path: "/api/foo", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/api/foo", BlankInput>

c

(parameter) c: Context<BlankEnv, "/api/foo", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ datetime: Date; }, StatusCode>(object: { datetime: Date; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

datetime: new

(property) datetime: Date

Date() }))          

var Date: DateConstructor new () => Date (+4 overloads)

type AppType = typeof

type AppType = Hono<BlankEnv, { "/api/foo": { $get: { input: {}; output: { datetime: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

route          

const route: Hono<BlankEnv, { "/api/foo": { $get: { input: {}; output: { datetime: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const client =

const client: { api: { foo: ClientRequest<{ $get: { input: {}; output: { datetime: string; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

hc

(alias) hc<Hono<BlankEnv, { "/api/foo": { $get: { input: {}; output: { datetime: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('http://localhost')          

type AppType = Hono<BlankEnv, { "/api/foo": { $get: { input: {}; output: { datetime: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const res = await

const res: ClientResponse<{ datetime: string; }, StatusCode, "json">

client.api.foo.$get()          

const client: { api: { foo: ClientRequest<{ $get: { input: {}; output: { datetime: string; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

const { datetime } = await

const datetime: string

res

const res: ClientResponse<{ datetime: string; }, StatusCode, "json">

.json()          

(method) ClientResponse<{ datetime: string; }, StatusCode, "json">.json(): Promise<{ datetime: string; }> MDN Reference

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

datetime>>          

const datetime: string

}) describe('Multiple endpoints', () => { const api = new

const api: Hono<BlankEnv, { "/foo": { $get: { input: {}; output: { foo: string; }; outputFormat: "json"; status: StatusCode; }; }; } & { "/bar": { $post: { input: {}; output: { bar: number; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/foo',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/foo", "/foo", JSONRespondReturn<{ foo: string; }, StatusCode>, BlankInput, BlankEnv>(path: "/foo", handler: H<BlankEnv, "/foo", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

c

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ foo: string; }, StatusCode>(object: { foo: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ foo: string; }, StatusCode> (+1 overload)

foo: '' }))          

(property) foo: string

.post('/bar',

(property) Hono<BlankEnv, { "/foo": { $get: { input: {}; output: { foo: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">.post: HandlerInterface <"/bar", "/bar", JSONRespondReturn<{ bar: number; }, StatusCode>, BlankInput, BlankEnv>(path: "/bar", handler: H<BlankEnv, "/bar", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/bar", BlankInput>

c

(parameter) c: Context<BlankEnv, "/bar", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ bar: number; }, StatusCode>(object: { bar: number; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ bar: number; }, StatusCode> (+1 overload)

bar: 0 }))          

(property) bar: number

const app = new

const app: Hono<BlankEnv, { "/api/foo": { $get: { input: {}; output: { foo: string; }; outputFormat: "json"; status: StatusCode; }; }; "/api/bar": { $post: { input: {}; output: { bar: number; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.route('/api',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/api", BlankEnv, { "/foo": { $get: { input: {}; output: { foo: string; }; outputFormat: "json"; status: StatusCode; }; }; } & { "/bar": { $post: { input: {}; output: { bar: number; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">(path: "/api", app: Hono<...>): Hono<...> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

api)          

const api: Hono<BlankEnv, { "/foo": { $get: { input: {}; output: { foo: string; }; outputFormat: "json"; status: StatusCode; }; }; } & { "/bar": { $post: { input: {}; output: { bar: number; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

type AppType = typeof

type AppType = Hono<BlankEnv, { "/api/foo": { $get: { input: {}; output: { foo: string; }; outputFormat: "json"; status: StatusCode; }; }; "/api/bar": { $post: { input: {}; output: { bar: number; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

app          

const app: Hono<BlankEnv, { "/api/foo": { $get: { input: {}; output: { foo: string; }; outputFormat: "json"; status: StatusCode; }; }; "/api/bar": { $post: { input: {}; output: { bar: number; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const client =

const client: { api: { foo: ClientRequest<{ $get: { input: {}; output: { foo: string; }; outputFormat: "json"; status: StatusCode; }; }>; }; } & { api: { bar: ClientRequest<{ $post: { input: {}; output: { bar: number; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

hc

(alias) hc<Hono<BlankEnv, { "/api/foo": { $get: { input: {}; output: { foo: string; }; outputFormat: "json"; status: StatusCode; }; }; "/api/bar": { $post: { input: {}; output: { bar: number; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } & { ...; } import hc

app>('http://localhost')          

const app: Hono<BlankEnv, { "/api/foo": { $get: { input: {}; output: { foo: string; }; outputFormat: "json"; status: StatusCode; }; }; "/api/bar": { $post: { input: {}; output: { bar: number; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

it('Should return correct types - GET /api/foo', async () => { const res = await

const res: ClientResponse<{ foo: string; }, StatusCode, "json">

client.api.foo.$get()          

const client: { api: { foo: ClientRequest<{ $get: { input: {}; output: { foo: string; }; outputFormat: "json"; status: StatusCode; }; }>; }; } & { api: { bar: ClientRequest<{ $post: { input: {}; output: { bar: number; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

const data = await

const data: { foo: string; }

res

const res: ClientResponse<{ foo: string; }, StatusCode, "json">

.json()          

(method) ClientResponse<{ foo: string; }, StatusCode, "json">.json(): Promise<{ foo: string; }> MDN Reference

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

data

const data: { foo: string; }

.foo>>          

(property) foo: string

}) it('Should return correct types - POST /api/bar', async () => { const res = await

const res: ClientResponse<{ bar: number; }, StatusCode, "json">

client.api.bar.$post()          

const client: { api: { foo: ClientRequest<{ $get: { input: {}; output: { foo: string; }; outputFormat: "json"; status: StatusCode; }; }>; }; } & { api: { bar: ClientRequest<{ $post: { input: {}; output: { bar: number; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

const data = await

const data: { bar: number; }

res

const res: ClientResponse<{ bar: number; }, StatusCode, "json">

.json()          

(method) ClientResponse<{ bar: number; }, StatusCode, "json">.json(): Promise<{ bar: number; }> MDN Reference

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

data

const data: { bar: number; }

.bar>>          

(property) bar: number

}) it('Should work with $url', async () => { const url =

const url: URL

client.api.bar

const client: { api: { foo: ClientRequest<{ $get: { input: {}; output: { foo: string; }; outputFormat: "json"; status: StatusCode; }; }>; }; } & { api: { bar: ClientRequest<{ $post: { input: {}; output: { bar: number; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

.$url()          

(property) $url: (arg?: {} | undefined) => URL

expect(url

const url: URL

.href).toBe('http://localhost/api/bar')          

(property) URL.href: string MDN Reference

}) }) describe('With a blank path', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/api/v1">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.basePath('/api/v1')          

(method) Hono<BlankEnv, BlankSchema, "/">.basePath<"/api/v1">(path: "/api/v1"): Hono<BlankEnv, BlankSchema, "/api/v1"> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

const routes =

const routes: Hono<BlankEnv, { "/api/v1/me": { $get: { input: {}; output: { name: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/api/v1">

app

const app: Hono<BlankEnv, BlankSchema, "/api/v1">

.route(          

(method) Hono<BlankEnv, BlankSchema, "/api/v1">.route<"/me", BlankEnv, { "/": { $get: { input: {}; output: { name: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">(path: "/me", app: Hono<BlankEnv, { "/": { $get: { input: {}; output: { name: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">): Hono<...> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

'/me', new Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.route(          

(method) Hono<BlankEnv, BlankSchema, "/">.route<"", BlankEnv, { "/": { $get: { input: {}; output: { name: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">(path: "", app: Hono<BlankEnv, { "/": { $get: { input: {}; output: { name: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">): Hono<...> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

'', new Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"", "/", Promise<JSONRespondReturn<{ name: string; }, StatusCode>>, BlankInput, BlankEnv>(path: "", handler: H<BlankEnv, "/", BlankInput, Promise<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ name: string; }, StatusCode>(object: { name: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ name: string; }, StatusCode> (+1 overload)

name: 'hono' })          

(property) name: string

}) ) ) const client =

const client: { api: { v1: { me: ClientRequest<{ $get: { input: {}; output: { name: string; }; outputFormat: "json"; status: StatusCode; }; }>; }; }; }

hc

(alias) hc<Hono<BlankEnv, { "/api/v1/me": { $get: { input: {}; output: { name: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/api/v1">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

routes>('http://localhost')          

const routes: Hono<BlankEnv, { "/api/v1/me": { $get: { input: {}; output: { name: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/api/v1">

it('Should infer paths correctly', async () => { // Should not a throw type error const url =

const url: URL

client.api.v1.me

const client: { api: { v1: { me: ClientRequest<{ $get: { input: {}; output: { name: string; }; outputFormat: "json"; status: StatusCode; }; }>; }; }; }

.$url()          

(property) $url: (arg?: {} | undefined) => URL

expectTypeOf<URL>

interface URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

(url)          

const url: URL

expect(url

const url: URL

.href).toBe('http://localhost/api/v1/me')          

(property) URL.href: string MDN Reference

}) }) }) describe('Use custom fetch method', () => { it('Should call the custom fetch method when provided', async () => { const fetchMock = vi.fn()          

const fetchMock: any

const api = new

const api: Hono<BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/search',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/search", "/search", JSONRespondReturn<{ ok: boolean; }, StatusCode>, BlankInput, BlankEnv>(path: "/search", handler: H<BlankEnv, "/search", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/search", BlankInput>

c

(parameter) c: Context<BlankEnv, "/search", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ ok: boolean; }, StatusCode>(object: { ok: boolean; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ ok: boolean; }, StatusCode> (+1 overload)

ok: true }))          

(property) ok: boolean

const app = new

const app: Hono<BlankEnv, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.route('/api',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/api", BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">(path: "/api", app: Hono<BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">): Hono<...> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

api)          

const api: Hono<BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

type AppType = typeof

type AppType = Hono<BlankEnv, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

app          

const app: Hono<BlankEnv, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const client =

const client: { api: { search: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

hc

(alias) hc<Hono<BlankEnv, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('http://localhost', {

type AppType = Hono<BlankEnv, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

fetch:

(property) fetch?: ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response>) | ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined

fetchMock })          

const fetchMock: any

await client.api.search.$get()          

const client: { api: { search: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

expect(fetchMock).toHaveBeenCalledTimes(1)          

const fetchMock: any

}) it('Should return Response from custom fetch method', async () => { const fetchMock = vi.fn()          

const fetchMock: any

const returnValue = new

const returnValue: Response

Response(null, {

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 200 })          

(property) ResponseInit.status?: number | undefined

fetchMock.mockReturnValueOnce

const fetchMock: any

(returnValue)          

const returnValue: Response

const api = new

const api: Hono<BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/search',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/search", "/search", JSONRespondReturn<{ ok: boolean; }, StatusCode>, BlankInput, BlankEnv>(path: "/search", handler: H<BlankEnv, "/search", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/search", BlankInput>

c

(parameter) c: Context<BlankEnv, "/search", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ ok: boolean; }, StatusCode>(object: { ok: boolean; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ ok: boolean; }, StatusCode> (+1 overload)

ok: true }))          

(property) ok: boolean

const app = new

const app: Hono<BlankEnv, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.route('/api',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/api", BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">(path: "/api", app: Hono<BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">): Hono<...> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

api)          

const api: Hono<BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

type AppType = typeof

type AppType = Hono<BlankEnv, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

app          

const app: Hono<BlankEnv, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const client =

const client: { api: { search: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

hc

(alias) hc<Hono<BlankEnv, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('http://localhost', {

type AppType = Hono<BlankEnv, { "/api/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

fetch:

(property) fetch?: ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response>) | ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined

fetchMock })          

const fetchMock: any

const res = await

const res: ClientResponse<{ ok: boolean; }, StatusCode, "json">

client.api.search.$get()          

const client: { api: { search: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }; }

expect(res

const res: ClientResponse<{ ok: boolean; }, StatusCode, "json">

.ok).toBe(true)          

(property) ClientResponse<{ ok: boolean; }, StatusCode, "json">.ok: boolean MDN Reference

expect(res).toEqual

const res: ClientResponse<{ ok: boolean; }, StatusCode, "json">

(returnValue)          

const returnValue: Response

}) }) describe('Use custom fetch (app.request) method', () => { it('Should return Response from app request method', async () => { const app = new

const app: Hono<BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/search',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/search", "/search", JSONRespondReturn<{ ok: boolean; }, StatusCode>, BlankInput, BlankEnv>(path: "/search", handler: H<BlankEnv, "/search", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/search", BlankInput>

c

(parameter) c: Context<BlankEnv, "/search", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ ok: boolean; }, StatusCode>(object: { ok: boolean; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ ok: boolean; }, StatusCode> (+1 overload)

ok: true }))          

(property) ok: boolean

type AppType = typeof

type AppType = Hono<BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

app          

const app: Hono<BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const client =

const client: { search: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('', {

type AppType = Hono<BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

fetch:

(property) fetch?: ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response>) | ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined

app

const app: Hono<BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

.request })          

(property) Hono<BlankEnv, { "/search": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

const res = await

const res: ClientResponse<{ ok: boolean; }, StatusCode, "json">

client.search.$get()          

const client: { search: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }

expect(res

const res: ClientResponse<{ ok: boolean; }, StatusCode, "json">

.ok).toBe(true)          

(property) ClientResponse<{ ok: boolean; }, StatusCode, "json">.ok: boolean MDN Reference

}) }) describe('Optional parameters in JSON response', () => { it('Should return the correct type', async () => { const app = new

const app: Hono<BlankEnv, { "/": { $get: { input: {}; output: { message?: string | undefined; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", JSONRespondReturn<{ message?: string; }, StatusCode>, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ message?: string; }, StatusCode>(object: { message?: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

message: 'foo' } as {

(property) message?: string | undefined

message?: string })          

(property) message?: string | undefined

}) type AppType = typeof

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: { message?: string | undefined; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

app          

const app: Hono<BlankEnv, { "/": { $get: { input: {}; output: { message?: string | undefined; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: { message?: string | undefined; }; outputFormat: "json"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: { message?: string | undefined; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('', {

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: { message?: string | undefined; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

fetch:

(property) fetch?: ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response>) | ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined

app

const app: Hono<BlankEnv, { "/": { $get: { input: {}; output: { message?: string | undefined; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

.request })          

(property) Hono<BlankEnv, { "/": { $get: { input: {}; output: { message?: string | undefined; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

const res = await

const res: ClientResponse<{ message?: string | undefined; }, StatusCode, "json">

client.index.$get()          

const client: { index: ClientRequest<{ $get: { input: {}; output: { message?: string | undefined; }; outputFormat: "json"; status: StatusCode; }; }>; }

const data = await

const data: { message?: string | undefined; }

res

const res: ClientResponse<{ message?: string | undefined; }, StatusCode, "json">

.json()          

(method) ClientResponse<{ message?: string | undefined; }, StatusCode, "json">.json(): Promise<{ message?: string | undefined; }> MDN Reference

expectTypeOf(data).toEqualTypeOf<{          

const data: { message?: string | undefined; }

message?: string          

(property) message?: string | undefined

}>() }) }) describe('ClientResponse.json() returns a Union type correctly', () => { const condition = () => true          

const condition: () => boolean

const app = new

const app: Hono<BlankEnv, { "/": { $get: { input: {}; output: { data: string; }; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { message: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Promise<JSONRespondReturn<{ data: string; }, StatusCode> | JSONRespondReturn<{ message: string; }, StatusCode>>, BlankInput, BlankEnv>(path: "/", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/", BlankInput>

const ok =

const ok: boolean

condition()          

const condition: () => boolean

if (ok) {          

const ok: boolean

return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ data: string; }, StatusCode>(object: { data: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ data: string; }, StatusCode> (+1 overload)

data: 'foo' })          

(property) data: string

} return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ message: string; }, StatusCode>(object: { message: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ message: string; }, StatusCode> (+1 overload)

message: 'error' })          

(property) message: string

}) const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: { data: string; }; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { message: string; }; outputFormat: "json"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: { data: string; }; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { message: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

app>('', {

const app: Hono<BlankEnv, { "/": { $get: { input: {}; output: { data: string; }; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { message: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

fetch:

(property) fetch?: ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response>) | ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined

app

const app: Hono<BlankEnv, { "/": { $get: { input: {}; output: { data: string; }; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { message: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

.request })          

(property) Hono<BlankEnv, { "/": { $get: { input: {}; output: { data: string; }; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { message: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

it('Should be a Union type', async () => { const res = await

const res: ClientResponse<{ data: string; }, StatusCode, "json"> | ClientResponse<{ message: string; }, StatusCode, "json">

client.index.$get()          

const client: { index: ClientRequest<{ $get: { input: {}; output: { data: string; }; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { message: string; }; outputFormat: "json"; status: StatusCode; }; }>; }

const json = await

const json: { data: string; } | { message: string; }

res

const res: ClientResponse<{ data: string; }, StatusCode, "json"> | ClientResponse<{ message: string; }, StatusCode, "json">

.json()          

(method) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.json(): Promise<{ data: string; }> | Promise<{ message: string; }> MDN Reference

expectTypeOf(json).toEqualTypeOf<{

const json: { data: string; } | { message: string; }

data: string } | {

(property) data: string

message: string }>()          

(property) message: string

}) }) describe('Response with different status codes', () => { const condition = () => true          

const condition: () => boolean

const app = new

const app: Hono<BlankEnv, { "/": { $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Promise<JSONRespondReturn<null, StatusCode> | JSONRespondReturn<{ data: string; }, 200> | JSONRespondReturn<{ message: string; }, 400>>, BlankInput, BlankEnv>(path: "/", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/", BlankInput>

const ok =

const ok: boolean

condition()          

const condition: () => boolean

if (ok) {          

const ok: boolean

return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ data: string; }, 200>(object: { data: string; }, status?: 200 | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ data: string; }, 200> (+1 overload)

data: 'foo' }, 200)          

(property) data: string

} if (!ok) {          

const ok: false

return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ message: string; }, 400>(object: { message: string; }, status?: 400 | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ message: string; }, 400> (+1 overload)

message: 'error' }, 400)          

(property) message: string

} return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json(null)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <null, StatusCode>(object: null, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<null, StatusCode> (+1 overload)

}) const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

app>('', {

const app: Hono<BlankEnv, { "/": { $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }; }, "/">

fetch:

(property) fetch?: ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response>) | ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined

app

const app: Hono<BlankEnv, { "/": { $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }; }, "/">

.request })          

(property) Hono<BlankEnv, { "/": { $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }; }, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

it('all', async () => { const res = await

const res: ClientResponse<null, StatusCode, "json"> | ClientResponse<{ data: string; }, 200, "json"> | ClientResponse<{ message: string; }, 400, "json">

client.index.$get()          

const client: { index: ClientRequest<{ $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }>; }

const json = await

const json: { data: string; } | { message: string; } | null

res

const res: ClientResponse<null, StatusCode, "json"> | ClientResponse<{ data: string; }, 200, "json"> | ClientResponse<{ message: string; }, 400, "json">

.json()          

(method) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.json(): Promise<null> | Promise<{ data: string; }> | Promise<{ message: string; }> MDN Reference

expectTypeOf(json).toEqualTypeOf<{

const json: { data: string; } | { message: string; } | null

data: string } | {

(property) data: string

message: string } | null>()          

(property) message: string

}) it('status 200', async () => { const res = await

const res: ClientResponse<null, StatusCode, "json"> | ClientResponse<{ data: string; }, 200, "json"> | ClientResponse<{ message: string; }, 400, "json">

client.index.$get()          

const client: { index: ClientRequest<{ $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }>; }

if (res

const res: ClientResponse<null, StatusCode, "json"> | ClientResponse<{ data: string; }, 200, "json"> | ClientResponse<{ message: string; }, 400, "json">

.status === 200) {          

(property) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.status: StatusCode MDN Reference

const json = await

const json: { data: string; } | null

res

const res: ClientResponse<null, StatusCode, "json"> | ClientResponse<{ data: string; }, 200, "json">

.json()          

(method) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.json(): Promise<null> | Promise<{ data: string; }> MDN Reference

expectTypeOf(json).toEqualTypeOf<{

const json: { data: string; } | null

data: string } | null>()          

(property) data: string

} }) it('status 400', async () => { const res = await

const res: ClientResponse<null, StatusCode, "json"> | ClientResponse<{ data: string; }, 200, "json"> | ClientResponse<{ message: string; }, 400, "json">

client.index.$get()          

const client: { index: ClientRequest<{ $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }>; }

if (res

const res: ClientResponse<null, StatusCode, "json"> | ClientResponse<{ data: string; }, 200, "json"> | ClientResponse<{ message: string; }, 400, "json">

.status === 400) {          

(property) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.status: StatusCode MDN Reference

const json = await

const json: { message: string; } | null

res

const res: ClientResponse<null, StatusCode, "json"> | ClientResponse<{ message: string; }, 400, "json">

.json()          

(method) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.json(): Promise<null> | Promise<{ message: string; }> MDN Reference

expectTypeOf(json).toEqualTypeOf<{

const json: { message: string; } | null

message: string } | null>()          

(property) message: string

} }) it('response is ok', async () => { const res = await

const res: ClientResponse<null, StatusCode, "json"> | ClientResponse<{ data: string; }, 200, "json"> | ClientResponse<{ message: string; }, 400, "json">

client.index.$get()          

const client: { index: ClientRequest<{ $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }>; }

if (res

const res: ClientResponse<null, StatusCode, "json"> | ClientResponse<{ data: string; }, 200, "json"> | ClientResponse<{ message: string; }, 400, "json">

.ok) {          

(property) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.ok: boolean MDN Reference

const json = await

const json: { data: string; } | null

res

const res: ClientResponse<null, StatusCode, "json"> | ClientResponse<{ data: string; }, 200, "json">

.json()          

(method) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.json(): Promise<null> | Promise<{ data: string; }> MDN Reference

expectTypeOf(json).toEqualTypeOf<{

const json: { data: string; } | null

data: string } | null>()          

(property) data: string

} }) it('response is not ok', async () => { const res = await

const res: ClientResponse<null, StatusCode, "json"> | ClientResponse<{ data: string; }, 200, "json"> | ClientResponse<{ message: string; }, 400, "json">

client.index.$get()          

const client: { index: ClientRequest<{ $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }>; }

if (!res

const res: ClientResponse<null, StatusCode, "json"> | ClientResponse<{ data: string; }, 200, "json"> | ClientResponse<{ message: string; }, 400, "json">

.ok) {          

(property) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.ok: boolean MDN Reference

const json = await

const json: { message: string; } | null

res

const res: ClientResponse<null, StatusCode, "json"> | ClientResponse<{ message: string; }, 400, "json">

.json()          

(method) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.json(): Promise<null> | Promise<{ message: string; }> MDN Reference

expectTypeOf(json).toEqualTypeOf<{

const json: { message: string; } | null

message: string } | null>()          

(property) message: string

} }) }) describe('Infer the response type with different status codes', () => { const condition = () => true          

const condition: () => boolean

const app = new

const app: Hono<BlankEnv, { "/": { $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Promise<JSONRespondReturn<null, StatusCode> | JSONRespondReturn<{ data: string; }, 200> | JSONRespondReturn<{ message: string; }, 400>>, BlankInput, BlankEnv>(path: "/", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/", BlankInput>

const ok =

const ok: boolean

condition()          

const condition: () => boolean

if (ok) {          

const ok: boolean

return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ data: string; }, 200>(object: { data: string; }, status?: 200 | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ data: string; }, 200> (+1 overload)

data: 'foo' }, 200)          

(property) data: string

} if (!ok) {          

const ok: false

return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ message: string; }, 400>(object: { message: string; }, status?: 400 | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ message: string; }, 400> (+1 overload)

message: 'error' }, 400)          

(property) message: string

} return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json(null)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <null, StatusCode>(object: null, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<null, StatusCode> (+1 overload)

}) const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

app>('', {

const app: Hono<BlankEnv, { "/": { $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }; }, "/">

fetch:

(property) fetch?: ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response>) | ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined

app

const app: Hono<BlankEnv, { "/": { $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }; }, "/">

.request })          

(property) Hono<BlankEnv, { "/": { $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }; }, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

it('Should infer response type correctly', () => { const req =

const req: (args?: {} | undefined, options?: ClientRequestOptions) => Promise<ClientResponse<null, StatusCode, "json"> | ClientResponse<...> | ClientResponse<...>>

client.index.$get          

const client: { index: ClientRequest<{ $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }>; }

type Actual =

type Actual = { data: string; } | { message: string; } | null

InferResponseType

(alias) type InferResponseType<T, U extends StatusCode = StatusCode> = InferEndpointType<T> extends { output: infer O; status: infer S; } ? S extends U ? O : never : never import InferResponseType

req>          

const req: (args?: {} | undefined, options?: ClientRequestOptions) => Promise<ClientResponse<null, StatusCode, "json"> | ClientResponse<...> | ClientResponse<...>>

type Expected =          

type Expected = { data: string; } | { message: string; } | null

| { data: string          

(property) data: string

} | { message: string          

(property) message: string

} | null type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Expected,

type Expected = { data: string; } | { message: string; } | null

Actual>>          

type Actual = { data: string; } | { message: string; } | null

}) it('Should infer response type of status 200 correctly', () => { const req =

const req: (args?: {} | undefined, options?: ClientRequestOptions) => Promise<ClientResponse<null, StatusCode, "json"> | ClientResponse<...> | ClientResponse<...>>

client.index.$get          

const client: { index: ClientRequest<{ $get: { input: {}; output: null; outputFormat: "json"; status: StatusCode; } | { input: {}; output: { data: string; }; outputFormat: "json"; status: 200; } | { ...; }; }>; }

type Actual =

type Actual = { data: string; } | null

InferResponseType

(alias) type InferResponseType<T, U extends StatusCode = StatusCode> = InferEndpointType<T> extends { output: infer O; status: infer S; } ? S extends U ? O : never : never import InferResponseType

req, 200>          

const req: (args?: {} | undefined, options?: ClientRequestOptions) => Promise<ClientResponse<null, StatusCode, "json"> | ClientResponse<...> | ClientResponse<...>>

type Expected = {          

type Expected = { data: string; } | null

data: string          

(property) data: string

} | null type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Expected,

type Expected = { data: string; } | null

Actual>>          

type Actual = { data: string; } | null

}) }) describe('$url() with a param option', () => { const app = new

const app: Hono<BlankEnv, { "/posts/:id/comments": { $get: { input: { param: { id: string; }; }; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; } & { "/something/:firstId/:secondId/:version?": { ...; }; }, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/posts/:id/comments',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/posts/:id/comments", "/posts/:id/comments", JSONRespondReturn<{ ok: boolean; }, StatusCode>, BlankInput, BlankEnv>(path: "/posts/:id/comments", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/posts/:id/comments", BlankInput>

c

(parameter) c: Context<BlankEnv, "/posts/:id/comments", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ ok: boolean; }, StatusCode>(object: { ok: boolean; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ ok: boolean; }, StatusCode> (+1 overload)

ok: true }))          

(property) ok: boolean

.get('/something/:firstId/:secondId/:version?',

(property) Hono<BlankEnv, { "/posts/:id/comments": { $get: { input: { param: { id: string; }; }; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">.get: HandlerInterface <"/something/:firstId/:secondId/:version?", "/something/:firstId/:secondId/:version?", JSONRespondReturn<{ ok: boolean; }, StatusCode>, BlankInput, BlankEnv>(path: "/something/:firstId/:secondId/:version?", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/something/:firstId/:secondId/:version?", BlankInput>

c

(parameter) c: Context<BlankEnv, "/something/:firstId/:secondId/:version?", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ ok: boolean; }, StatusCode>(object: { ok: boolean; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ ok: boolean; }, StatusCode> (+1 overload)

ok: true }))          

(property) ok: boolean

type AppType = typeof

type AppType = Hono<BlankEnv, { "/posts/:id/comments": { $get: { input: { param: { id: string; }; }; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; } & { "/something/:firstId/:secondId/:version?": { ...; }; }, "/">

app          

const app: Hono<BlankEnv, { "/posts/:id/comments": { $get: { input: { param: { id: string; }; }; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; } & { "/something/:firstId/:secondId/:version?": { ...; }; }, "/">

const client =

const client: { posts: { ":id": { comments: ClientRequest<{ $get: { input: { param: { id: string; }; }; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }; }; } & { something: { ...; }; }

hc

(alias) hc<Hono<BlankEnv, { "/posts/:id/comments": { $get: { input: { param: { id: string; }; }; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; } & { "/something/:firstId/:secondId/:version?": { ...; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } & { ...; } import hc

<AppType>('http://localhost')          

type AppType = Hono<BlankEnv, { "/posts/:id/comments": { $get: { input: { param: { id: string; }; }; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; } & { "/something/:firstId/:secondId/:version?": { ...; }; }, "/">

it('Should return the correct path - /posts/123/comments', async () => { const url =

const url: URL

client.posts[':id'].comments

const client: { posts: { ":id": { comments: ClientRequest<{ $get: { input: { param: { id: string; }; }; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }; }; } & { something: { ...; }; }

.$url({          

(property) $url: (arg?: { param: { id: string; }; } | undefined) => URL

param: {          

(property) param: { id: string; }

id: '123',          

(property) id: string

}, }) expect(url

const url: URL

.pathname).toBe('/posts/123/comments')          

(property) URL.pathname: string MDN Reference

}) it('Should return the correct path - /posts/:id/comments', async () => { const url =

const url: URL

client.posts[':id'].comments

const client: { posts: { ":id": { comments: ClientRequest<{ $get: { input: { param: { id: string; }; }; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }; }; } & { something: { ...; }; }

.$url()          

(property) $url: (arg?: { param: { id: string; }; } | undefined) => URL

expect(url

const url: URL

.pathname).toBe('/posts/:id/comments')          

(property) URL.pathname: string MDN Reference

}) it('Should return the correct path - /something/123/456', async () => { const url =

const url: URL

client.something[':firstId'][':secondId'][':version?']

const client: { posts: { ":id": { comments: ClientRequest<{ $get: { input: { param: { id: string; }; }; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; }; }; } & { something: { ...; }; }

.$url({          

(property) $url: (arg?: { param: { firstId: string; } & { secondId: string; } & Record<"version", string | undefined>; } | undefined) => URL

param: {          

(property) param: { firstId: string; } & { secondId: string; } & Record<"version", string | undefined>

firstId: '123',          

(property) firstId: string

secondId: '456',          

(property) secondId: string

version: undefined,          

(property) version: string | undefined

}, }) expect(url

const url: URL

.pathname).toBe('/something/123/456')          

(property) URL.pathname: string MDN Reference

}) }) describe('Client can be awaited', () => { it('Can be awaited without side effects', async () => { const client =

const client: { [x: string]: ClientRequest<any>; }

hc('http://localhost')          

(alias) hc<Hono<any, any, any>>(baseUrl: string, options?: ClientRequestOptions): { [x: string]: ClientRequest<any>; } import hc

const awaited = await

const awaited: { [x: string]: ClientRequest<any>; }

client          

const client: { [x: string]: ClientRequest<any>; }

expect(awaited).toEqual

const awaited: { [x: string]: ClientRequest<any>; }

(client)          

const client: { [x: string]: ClientRequest<any>; }

}) }) describe('Dynamic headers', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const route =

const route: Hono<BlankEnv, { "/posts": { $post: { input: {}; output: { requestDynamic: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.post('/posts',

(property) Hono<BlankEnv, BlankSchema, "/">.post: HandlerInterface <"/posts", "/posts", JSONRespondReturn<{ requestDynamic: string; }, StatusCode>, BlankInput, BlankEnv>(path: "/posts", handler: H<BlankEnv, "/posts", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/posts", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/posts", BlankInput>

.json({          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ requestDynamic: string; }, StatusCode>(object: { requestDynamic: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

requestDynamic: 'dummy',          

(property) requestDynamic: string

}) }) type AppType = typeof

type AppType = Hono<BlankEnv, { "/posts": { $post: { input: {}; output: { requestDynamic: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

route          

const route: Hono<BlankEnv, { "/posts": { $post: { input: {}; output: { requestDynamic: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

const server = setupServer(          

const server: any

http.post('http://localhost/posts', async ({ request }) => {          

(parameter) request: any

const requestDynamic =

const requestDynamic: any

request.headers.get('x-dynamic')          

(parameter) request: any

const payload = {          

const payload: { requestDynamic: any; }

requestDynamic,          

(property) requestDynamic: any

} return HttpResponse.json(payload)          

const payload: { requestDynamic: any; }

}) ) beforeAll(() => server.listen())          

const server: any

afterEach(() => server.resetHandlers())          

const server: any

afterAll(() => server.close())          

const server: any

let dynamic = ''          

let dynamic: string

const client =

const client: { posts: ClientRequest<{ $post: { input: {}; output: { requestDynamic: string; }; outputFormat: "json"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/posts": { $post: { input: {}; output: { requestDynamic: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('http://localhost', {          

type AppType = Hono<BlankEnv, { "/posts": { $post: { input: {}; output: { requestDynamic: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

headers: () => ({ 'x-hono': 'hono', 'x-dynamic':

(property) headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>) | undefined

dynamic }),          

let dynamic: string

}) it('Should have "x-dynamic": "one"', async () => { dynamic = 'one'          

let dynamic: string

const res = await

const res: ClientResponse<{ requestDynamic: string; }, StatusCode, "json">

client.posts.$post()          

const client: { posts: ClientRequest<{ $post: { input: {}; output: { requestDynamic: string; }; outputFormat: "json"; status: StatusCode; }; }>; }

expect(res

const res: ClientResponse<{ requestDynamic: string; }, StatusCode, "json">

.ok).toBe(true)          

(property) ClientResponse<{ requestDynamic: string; }, StatusCode, "json">.ok: boolean MDN Reference

const data = await

const data: { requestDynamic: string; }

res

const res: ClientResponse<{ requestDynamic: string; }, StatusCode, "json">

.json()          

(method) ClientResponse<{ requestDynamic: string; }, StatusCode, "json">.json(): Promise<{ requestDynamic: string; }> MDN Reference

expect(data

const data: { requestDynamic: string; }

.requestDynamic).toEqual('one')          

(property) requestDynamic: string

}) it('Should have "x-dynamic": "two"', async () => { dynamic = 'two'          

let dynamic: string

const res = await

const res: ClientResponse<{ requestDynamic: string; }, StatusCode, "json">

client.posts.$post()          

const client: { posts: ClientRequest<{ $post: { input: {}; output: { requestDynamic: string; }; outputFormat: "json"; status: StatusCode; }; }>; }

expect(res

const res: ClientResponse<{ requestDynamic: string; }, StatusCode, "json">

.ok).toBe(true)          

(property) ClientResponse<{ requestDynamic: string; }, StatusCode, "json">.ok: boolean MDN Reference

const data = await

const data: { requestDynamic: string; }

res

const res: ClientResponse<{ requestDynamic: string; }, StatusCode, "json">

.json()          

(method) ClientResponse<{ requestDynamic: string; }, StatusCode, "json">.json(): Promise<{ requestDynamic: string; }> MDN Reference

expect(data

const data: { requestDynamic: string; }

.requestDynamic).toEqual('two')          

(property) requestDynamic: string

}) }) describe('RequestInit work as expected', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const route =

const route: Hono<BlankEnv, { "/credentials": { $get: { input: {}; output: RequestCredentials; outputFormat: "text"; status: StatusCode; }; }; } & { "/headers": { $get: { ...; }; }; } & { ...; }, "/">

app          

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/credentials',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/credentials", "/credentials", Response & TypedResponse<RequestCredentials, StatusCode, "text">, BlankInput, BlankEnv>(path: "/credentials", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/credentials", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/credentials", BlankInput>

.text('' as

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <RequestCredentials, StatusCode>(text: RequestCredentials, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

RequestCredentials)          

type RequestCredentials = "include" | "omit" | "same-origin"

}) .get('/headers',

(property) Hono<BlankEnv, { "/credentials": { $get: { input: {}; output: RequestCredentials; outputFormat: "text"; status: StatusCode; }; }; }, "/">.get: HandlerInterface <"/headers", "/headers", JSONRespondReturn<Record<string, string>, StatusCode>, BlankInput, BlankEnv>(path: "/headers", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/headers", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/headers", BlankInput>

.json({} as

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <Record<string, string>, StatusCode>(object: Record<string, string>, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

Record)          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

}) .post('/headers',

(property) Hono<BlankEnv, { "/credentials": { $get: { input: {}; output: RequestCredentials; outputFormat: "text"; status: StatusCode; }; }; } & { "/headers": { $get: { ...; }; }; }, "/">.post: HandlerInterface <"/headers", "/headers", Response & TypedResponse<"Not found", 404, "text">, BlankInput, BlankEnv>(path: "/headers", handler: H<BlankEnv, "/headers", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/headers", BlankInput>

c

(parameter) c: Context<BlankEnv, "/headers", BlankInput>

.text('Not found', 404))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Not found", 404>(text: "Not found", status?: 404 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Not found", 404, "text"> (+1 overload)

type AppType = typeof

type AppType = Hono<BlankEnv, { "/credentials": { $get: { input: {}; output: RequestCredentials; outputFormat: "text"; status: StatusCode; }; }; } & { "/headers": { $get: { ...; }; }; } & { ...; }, "/">

route          

const route: Hono<BlankEnv, { "/credentials": { $get: { input: {}; output: RequestCredentials; outputFormat: "text"; status: StatusCode; }; }; } & { "/headers": { $get: { ...; }; }; } & { ...; }, "/">

const server = setupServer(          

const server: any

http.get('http://localhost/credentials', ({ request }) => {          

(parameter) request: any

return HttpResponse.text(request.credentials)          

(parameter) request: any

}), http.get('http://localhost/headers', ({ request }) => {          

(parameter) request: any

const allHeaders:

const allHeaders: Record<string, string>

Record = {}          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

for (const [k,

const k: any

v] of

const v: any

request.headers.entries()) {          

(parameter) request: any

allHeaders

const allHeaders: Record<string, string>

[k] =

const k: any

v          

const v: any

} return HttpResponse.json(allHeaders)          

const allHeaders: Record<string, string>

}), http.post('http://localhost/headers', () => { return HttpResponse.text('Should not be here', { status: 400,          

(property) status: number

}) }) ) beforeAll(() => server.listen())          

const server: any

afterEach(() => server.resetHandlers())          

const server: any

afterAll(() => server.close())          

const server: any

const client =

const client: { credentials: ClientRequest<{ $get: { input: {}; output: RequestCredentials; outputFormat: "text"; status: StatusCode; }; }>; } & { headers: ClientRequest<...>; }

hc

(alias) hc<Hono<BlankEnv, { "/credentials": { $get: { input: {}; output: RequestCredentials; outputFormat: "text"; status: StatusCode; }; }; } & { "/headers": { ...; }; } & { ...; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } & { ...; } import hc

<AppType>('http://localhost', {          

type AppType = Hono<BlankEnv, { "/credentials": { $get: { input: {}; output: RequestCredentials; outputFormat: "text"; status: StatusCode; }; }; } & { "/headers": { $get: { ...; }; }; } & { ...; }, "/">

headers: { 'x-hono': 'fire' },          

(property) headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>) | undefined

init: {          

(property) init?: RequestInit | undefined Standard RequestInit, caution that this take highest priority and could be used to overwrite things that Hono sets for you, like body | method | headers.

If you want to add some headers, use in headers instead of init

credentials: 'include',          

(property) RequestInit.credentials?: RequestCredentials | undefined A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials.

}, }) it('Should overwrite method and fail', async () => { const res = await

const res: ClientResponse<{ [x: string]: string; }, StatusCode, "json">

client.headers.$get(undefined, {

const client: { credentials: ClientRequest<{ $get: { input: {}; output: RequestCredentials; outputFormat: "text"; status: StatusCode; }; }>; } & { headers: ClientRequest<...>; }

init: {

(property) init?: RequestInit | undefined Standard RequestInit, caution that this take highest priority and could be used to overwrite things that Hono sets for you, like body | method | headers.

If you want to add some headers, use in headers instead of init

method: 'POST' } })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

const res: ClientResponse<{ [x: string]: string; }, StatusCode, "json">

.ok).toBe(false)          

(property) ClientResponse<{ [x: string]: string; }, StatusCode, "json">.ok: boolean MDN Reference

}) it('Should clear headers', async () => { const res = await

const res: ClientResponse<{ [x: string]: string; }, StatusCode, "json">

client.headers.$get(undefined, {

const client: { credentials: ClientRequest<{ $get: { input: {}; output: RequestCredentials; outputFormat: "text"; status: StatusCode; }; }>; } & { headers: ClientRequest<...>; }

init: {

(property) init?: RequestInit | undefined Standard RequestInit, caution that this take highest priority and could be used to overwrite things that Hono sets for you, like body | method | headers.

If you want to add some headers, use in headers instead of init

headers: undefined } })          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

expect(res

const res: ClientResponse<{ [x: string]: string; }, StatusCode, "json">

.ok).toBe(true)          

(property) ClientResponse<{ [x: string]: string; }, StatusCode, "json">.ok: boolean MDN Reference

const data = await

const data: { [x: string]: string; }

res

const res: ClientResponse<{ [x: string]: string; }, StatusCode, "json">

.json()          

(method) ClientResponse<{ [x: string]: string; }, StatusCode, "json">.json(): Promise<{ [x: string]: string; }> MDN Reference

expect(data).toEqual({})          

const data: { [x: string]: string; }

}) it('Should overwrite headers', async () => { const res = await

const res: ClientResponse<{ [x: string]: string; }, StatusCode, "json">

client.headers.$get(undefined, {          

const client: { credentials: ClientRequest<{ $get: { input: {}; output: RequestCredentials; outputFormat: "text"; status: StatusCode; }; }>; } & { headers: ClientRequest<...>; }

init: {

(property) init?: RequestInit | undefined Standard RequestInit, caution that this take highest priority and could be used to overwrite things that Hono sets for you, like body | method | headers.

If you want to add some headers, use in headers instead of init

headers: new

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

Headers({ 'x-hono': 'awesome' }) },          

var Headers: new (init?: HeadersInit) => Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

}) expect(res

const res: ClientResponse<{ [x: string]: string; }, StatusCode, "json">

.ok).toBe(true)          

(property) ClientResponse<{ [x: string]: string; }, StatusCode, "json">.ok: boolean MDN Reference

const data = await

const data: { [x: string]: string; }

res

const res: ClientResponse<{ [x: string]: string; }, StatusCode, "json">

.json()          

(method) ClientResponse<{ [x: string]: string; }, StatusCode, "json">.json(): Promise<{ [x: string]: string; }> MDN Reference

expect(data).toEqual({ 'x-hono': 'awesome' })          

const data: { [x: string]: string; }

}) it('credentials is include', async () => { const res = await

const res: ClientResponse<RequestCredentials, StatusCode, "text">

client.credentials.$get()          

const client: { credentials: ClientRequest<{ $get: { input: {}; output: RequestCredentials; outputFormat: "text"; status: StatusCode; }; }>; } & { headers: ClientRequest<...>; }

expect(res

const res: ClientResponse<RequestCredentials, StatusCode, "text">

.ok).toBe(true)          

(property) ClientResponse<RequestCredentials, StatusCode, "text">.ok: boolean MDN Reference

const data = await

const data: "include" | "omit" | "same-origin"

res

const res: ClientResponse<RequestCredentials, StatusCode, "text">

.text()          

(method) ClientResponse<RequestCredentials, StatusCode, "text">.text(): Promise<"include"> | Promise<"omit"> | Promise<"same-origin"> MDN Reference

expect(data).toEqual('include')          

const data: "include" | "omit" | "same-origin"

}) it('deepMerge should works and not unset credentials', async () => { const res = await

const res: ClientResponse<RequestCredentials, StatusCode, "text">

client.credentials.$get(undefined, {

const client: { credentials: ClientRequest<{ $get: { input: {}; output: RequestCredentials; outputFormat: "text"; status: StatusCode; }; }>; } & { headers: ClientRequest<...>; }

init: {

(property) init?: RequestInit | undefined Standard RequestInit, caution that this take highest priority and could be used to overwrite things that Hono sets for you, like body | method | headers.

If you want to add some headers, use in headers instead of init

headers: {

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

hi: 'hello' } } })          

(property) hi: string

expect(res

const res: ClientResponse<RequestCredentials, StatusCode, "text">

.ok).toBe(true)          

(property) ClientResponse<RequestCredentials, StatusCode, "text">.ok: boolean MDN Reference

const data = await

const data: "include" | "omit" | "same-origin"

res

const res: ClientResponse<RequestCredentials, StatusCode, "text">

.text()          

(method) ClientResponse<RequestCredentials, StatusCode, "text">.text(): Promise<"include"> | Promise<"omit"> | Promise<"same-origin"> MDN Reference

expect(data).toEqual('include')          

const data: "include" | "omit" | "same-origin"

}) it('Should unset credentials', async () => { const res = await

const res: ClientResponse<RequestCredentials, StatusCode, "text">

client.credentials.$get(undefined, {

const client: { credentials: ClientRequest<{ $get: { input: {}; output: RequestCredentials; outputFormat: "text"; status: StatusCode; }; }>; } & { headers: ClientRequest<...>; }

init: {

(property) init?: RequestInit | undefined Standard RequestInit, caution that this take highest priority and could be used to overwrite things that Hono sets for you, like body | method | headers.

If you want to add some headers, use in headers instead of init

credentials: undefined } })          

(property) RequestInit.credentials?: RequestCredentials | undefined A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials.

expect(res

const res: ClientResponse<RequestCredentials, StatusCode, "text">

.ok).toBe(true)          

(property) ClientResponse<RequestCredentials, StatusCode, "text">.ok: boolean MDN Reference

const data = await

const data: "include" | "omit" | "same-origin"

res

const res: ClientResponse<RequestCredentials, StatusCode, "text">

.text()          

(method) ClientResponse<RequestCredentials, StatusCode, "text">.text(): Promise<"include"> | Promise<"omit"> | Promise<"same-origin"> MDN Reference

expect(data).toEqual('same-origin')          

const data: "include" | "omit" | "same-origin"

}) }) describe('WebSocket URL Protocol Translation', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const route =

const route: Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get(          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", HandlerResponse<any>, { outputFormat: "ws"; }, any>(path: "/", handler: H<any, "/", { outputFormat: "ws"; }, HandlerResponse<any>>) => Hono<...> (+22 overloads)

'/', upgradeWebSocket(

(alias) upgradeWebSocket(createEvents: (c: Context) => WSEvents<WebSocket> | Promise<WSEvents<WebSocket>>, options?: UpgradeWebSocketOptions | undefined): MiddlewareHandler<any, string, { outputFormat: "ws"; }> import upgradeWebSocket

(c) => ({          

(parameter) c: Context<any, any, {}>

onMessage

(property) WSEvents<WebSocket>.onMessage?: ((evt: MessageEvent<WSMessageReceive>, ws: WSContext<WebSocket>) => void) | undefined

(event,

(parameter) event: MessageEvent<WSMessageReceive>

ws) {          

(parameter) ws: WSContext<WebSocket>

console

var console: Console

.log(`Message from client: $

(method) Console.log(...data: any[]): void MDN Reference

{event

(parameter) event: MessageEvent<WSMessageReceive>

.data}`)          

(property) MessageEvent<WSMessageReceive>.data: WSMessageReceive Returns the data of the message.

MDN Reference

ws

(parameter) ws: WSContext<WebSocket>

.send('Hello from server!')          

(method) send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void

}, onClose: () => {          

(property) WSEvents<WebSocket>.onClose?: ((evt: CloseEvent, ws: WSContext<WebSocket>) => void) | undefined

console

var console: Console

.log('Connection closed')          

(method) Console.log(...data: any[]): void MDN Reference

}, })) ) type AppType = typeof

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

route          

const route: Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

const server = setupServer()          

const server: any

const webSocketMock = vi.fn()          

const webSocketMock: any

beforeAll(() => server.listen())          

const server: any

beforeEach(() => { vi.stubGlobal('WebSocket', webSocketMock)          

const webSocketMock: any

}) afterEach(() => { vi.clearAllMocks() server.resetHandlers()          

const server: any

}) afterAll(() => server.close())          

const server: any

it('Translates HTTP to ws', async () => { const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('http://localhost')          

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

client.index

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

.$ws()          

(property) $ws: (args?: {} | undefined) => WebSocket

expect(webSocketMock).toHaveBeenCalledWith('ws://localhost/index')          

const webSocketMock: any

}) it('Translates HTTPS to wss', async () => { const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('https://localhost')          

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

client.index

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

.$ws()          

(property) $ws: (args?: {} | undefined) => WebSocket

expect(webSocketMock).toHaveBeenCalledWith('wss://localhost/index')          

const webSocketMock: any

}) it('Keeps ws unchanged', async () => { const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('ws://localhost')          

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

client.index

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

.$ws()          

(property) $ws: (args?: {} | undefined) => WebSocket

expect(webSocketMock).toHaveBeenCalledWith('ws://localhost/index')          

const webSocketMock: any

}) it('Keeps wss unchanged', async () => { const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('wss://localhost')          

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

client.index

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

.$ws()          

(property) $ws: (args?: {} | undefined) => WebSocket

expect(webSocketMock).toHaveBeenCalledWith('wss://localhost/index')          

const webSocketMock: any

}) }) describe('WebSocket URL Protocol Translation with Query Parameters', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const route =

const route: Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get(          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", HandlerResponse<any>, { outputFormat: "ws"; }, any>(path: "/", handler: H<any, "/", { outputFormat: "ws"; }, HandlerResponse<any>>) => Hono<...> (+22 overloads)

'/', upgradeWebSocket(

(alias) upgradeWebSocket(createEvents: (c: Context) => WSEvents<WebSocket> | Promise<WSEvents<WebSocket>>, options?: UpgradeWebSocketOptions | undefined): MiddlewareHandler<any, string, { outputFormat: "ws"; }> import upgradeWebSocket

(c) => ({          

(parameter) c: Context<any, any, {}>

onMessage

(property) WSEvents<WebSocket>.onMessage?: ((evt: MessageEvent<WSMessageReceive>, ws: WSContext<WebSocket>) => void) | undefined

(event,

(parameter) event: MessageEvent<WSMessageReceive>

ws) {          

(parameter) ws: WSContext<WebSocket>

ws

(parameter) ws: WSContext<WebSocket>

.send('Hello from server!')          

(method) send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void

}, onClose: () => {          

(property) WSEvents<WebSocket>.onClose?: ((evt: CloseEvent, ws: WSContext<WebSocket>) => void) | undefined

console

var console: Console

.log('Connection closed')          

(method) Console.log(...data: any[]): void MDN Reference

}, })) ) type AppType = typeof

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

route          

const route: Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

const server = setupServer()          

const server: any

const webSocketMock = vi.fn()          

const webSocketMock: any

beforeAll(() => server.listen())          

const server: any

beforeEach(() => { vi.stubGlobal('WebSocket', webSocketMock)          

const webSocketMock: any

}) afterEach(() => { vi.clearAllMocks() server.resetHandlers()          

const server: any

}) afterAll(() => server.close())          

const server: any

it('Translates HTTP to ws and includes query parameters', async () => { const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('http://localhost')          

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

client.index

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

.$ws({          

(property) $ws: (args?: {} | undefined) => WebSocket

query: {          

(property) query: { id: string; type: string; tag: string[]; }

id: '123',          

(property) id: string

type: 'test',          

(property) type: string

tag: ['a', 'b'],          

(property) tag: string[]

}, }) expect(webSocketMock).toHaveBeenCalledWith('ws://localhost/index?id=123&type=test&tag=a&tag=b')          

const webSocketMock: any

}) it('Translates HTTPS to wss and includes query parameters', async () => { const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('https://localhost')          

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

client.index

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

.$ws({          

(property) $ws: (args?: {} | undefined) => WebSocket

query: {          

(property) query: { id: string; type: string; }

id: '456',          

(property) id: string

type: 'secure',          

(property) type: string

}, }) expect(webSocketMock).toHaveBeenCalledWith('wss://localhost/index?id=456&type=secure')          

const webSocketMock: any

}) it('Keeps ws unchanged and includes query parameters', async () => { const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('ws://localhost')          

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

client.index

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

.$ws({          

(property) $ws: (args?: {} | undefined) => WebSocket

query: {          

(property) query: { id: string; type: string; }

id: '789',          

(property) id: string

type: 'plain',          

(property) type: string

}, }) expect(webSocketMock).toHaveBeenCalledWith('ws://localhost/index?id=789&type=plain')          

const webSocketMock: any

}) it('Keeps wss unchanged and includes query parameters', async () => { const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>('wss://localhost')          

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

client.index

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

.$ws({          

(property) $ws: (args?: {} | undefined) => WebSocket

query: {          

(property) query: { id: string; type: string; }

id: '1011',          

(property) id: string

type: 'secure',          

(property) type: string

}, }) expect(webSocketMock).toHaveBeenCalledWith('wss://localhost/index?id=1011&type=secure')          

const webSocketMock: any

}) }) describe('Client can be console.log in react native', () => { it('Returns a function name with function.name.toString', async () => { const client =

const client: { [x: string]: ClientRequest<any>; }

hc('http://localhost')          

(alias) hc<Hono<any, any, any>>(baseUrl: string, options?: ClientRequestOptions): { [x: string]: ClientRequest<any>; } import hc

// @ts-ignore expect(client.posts.name.toString()).toEqual('posts')          

const client: { [x: string]: ClientRequest<any>; }

}) it('Returns a function name with function.name.valueOf', async () => { const client =

const client: { [x: string]: ClientRequest<any>; }

hc('http://localhost')          

(alias) hc<Hono<any, any, any>>(baseUrl: string, options?: ClientRequestOptions): { [x: string]: ClientRequest<any>; } import hc

// @ts-ignore expect(client.posts.name.valueOf()).toEqual('posts')          

const client: { [x: string]: ClientRequest<any>; }

}) it('Returns a function with function.valueOf', async () => { const client =

const client: { [x: string]: ClientRequest<any>; }

hc('http://localhost')          

(alias) hc<Hono<any, any, any>>(baseUrl: string, options?: ClientRequestOptions): { [x: string]: ClientRequest<any>; } import hc

expect(typeof client.posts

const client: { [x: string]: ClientRequest<any>; }

.valueOf()).toEqual('function')          

(method) Object.valueOf(): Object Returns the primitive value of the specified object.

}) it('Returns a function source with function.toString', async () => { const client =

const client: { [x: string]: ClientRequest<any>; }

hc('http://localhost')          

(alias) hc<Hono<any, any, any>>(baseUrl: string, options?: ClientRequestOptions): { [x: string]: ClientRequest<any>; } import hc

expect(client.posts

const client: { [x: string]: ClientRequest<any>; }

.toString()).toMatch('function proxyCallback')          

(method) Object.toString(): string Returns a string representation of an object.

}) }) describe('Text response', () => { const text = 'My name is Hono'          

const text: "My name is Hono"

const obj = {

const obj: { ok: boolean; }

ok: true }          

(property) ok: boolean

const server = setupServer(          

const server: any

http.get('http://localhost/about/me', async () => { return HttpResponse.text(text)          

const text: "My name is Hono"

}), http.get('http://localhost/api', async ({ request }) => {          

(parameter) request: any

return HttpResponse.json(obj)          

const obj: { ok: boolean; }

}) ) beforeAll(() => server.listen())          

const server: any

afterEach(() => server.resetHandlers())          

const server: any

afterAll(() => server.close())          

const server: any

const app = new

const app: Hono<BlankEnv, { "/about/me": { $get: { input: {}; output: "My name is Hono"; outputFormat: "text"; status: StatusCode; }; }; } & { "/api": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/about/me',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/about/me", "/about/me", Response & TypedResponse<"My name is Hono", StatusCode, "text">, BlankInput, BlankEnv>(path: "/about/me", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/about/me", BlankInput>

c

(parameter) c: Context<BlankEnv, "/about/me", BlankInput>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"My name is Hono", StatusCode>(text: "My name is Hono", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

(text))

const text: "My name is Hono"

.get('/api',

(property) Hono<BlankEnv, { "/about/me": { $get: { input: {}; output: "My name is Hono"; outputFormat: "text"; status: StatusCode; }; }; }, "/">.get: HandlerInterface <"/api", "/api", JSONRespondReturn<{ ok: boolean; }, StatusCode>, BlankInput, BlankEnv>(path: "/api", handler: H<BlankEnv, "/api", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/api", BlankInput>

c

(parameter) c: Context<BlankEnv, "/api", BlankInput>

.json

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ ok: boolean; }, StatusCode>(object: { ok: boolean; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ ok: boolean; }, StatusCode> (+1 overload)

(obj))          

const obj: { ok: boolean; }

const client =

const client: { api: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; } & { ...; }

hc

(alias) hc<Hono<BlankEnv, { "/about/me": { $get: { input: {}; output: "My name is Hono"; outputFormat: "text"; status: StatusCode; }; }; } & { "/api": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } & { ...; } import hc

app>('http://localhost/')          

const app: Hono<BlankEnv, { "/about/me": { $get: { input: {}; output: "My name is Hono"; outputFormat: "text"; status: StatusCode; }; }; } & { "/api": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

it('Should be never with res.json() - /about/me', async () => { const res = await

const res: ClientResponse<"My name is Hono", StatusCode, "text">

client.about.me.$get()          

const client: { api: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; } & { ...; }

type Actual =

type Actual = Promise<never>

ReturnType

type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any Obtain the return type of a function type

res

const res: ClientResponse<"My name is Hono", StatusCode, "text">

.json>          

(method) ClientResponse<"My name is Hono", StatusCode, "text">.json(): Promise<never> MDN Reference

type Expected =

type Expected = Promise<never>

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Expected,

type Expected = Promise<never>

Actual>>          

type Actual = Promise<never>

}) it('Should be "Hello, World!" with res.text() - /about/me', async () => { const res = await

const res: ClientResponse<"My name is Hono", StatusCode, "text">

client.about.me.$get()          

const client: { api: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; } & { ...; }

const data = await

const data: "My name is Hono"

res

const res: ClientResponse<"My name is Hono", StatusCode, "text">

.text()          

(method) ClientResponse<"My name is Hono", StatusCode, "text">.text(): Promise<"My name is Hono"> MDN Reference

expectTypeOf(data).toEqualTypeOf<'My name is Hono'>()          

const data: "My name is Hono"

expect(data).toBe

const data: "My name is Hono"

(text)          

const text: "My name is Hono"

}) /** * Also check the type of JSON response with res.text(). */ it('Should be string with res.text() - /api', async () => { const res = await

const res: ClientResponse<{ ok: boolean; }, StatusCode, "json">

client.api.$get()          

const client: { api: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: StatusCode; }; }>; } & { ...; }

type Actual =

type Actual = Promise<string>

ReturnType

type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any Obtain the return type of a function type

res

const res: ClientResponse<{ ok: boolean; }, StatusCode, "json">

.text>          

(method) ClientResponse<{ ok: boolean; }, StatusCode, "json">.text(): Promise<string> MDN Reference

type Expected =

type Expected = Promise<string>

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Expected,

type Expected = Promise<string>

Actual>>          

type Actual = Promise<string>

}) }) describe('Redirect response - only types', () => { const server = setupServer(          

const server: any

http.get('http://localhost/', async () => { return HttpResponse.redirect('/') }) ) beforeAll(() => server.listen())          

const server: any

afterEach(() => server.resetHandlers())          

const server: any

afterAll(() => server.close())          

const server: any

const condition = () => true          

const condition: () => boolean

const app = new

const app: Hono<BlankEnv, { "/": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: 200; } | { input: {}; output: undefined; outputFormat: "redirect"; status: 302; } | { input: {}; output: undefined; outputFormat: "redirect"; status: 301; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Promise<JSONRespondReturn<{ ok: boolean; }, 200> | (Response & TypedResponse<undefined, 302, "redirect">) | (Response & TypedResponse<...>)>, BlankInput, BlankEnv>(path: "/", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/", BlankInput>

const ok =

const ok: boolean

condition()          

const condition: () => boolean

const temporary =

const temporary: boolean

condition()          

const condition: () => boolean

if (ok) {          

const ok: boolean

return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ ok: boolean; }, 200>(object: { ok: boolean; }, status?: 200 | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ ok: boolean; }, 200> (+1 overload)

ok: true }, 200)          

(property) ok: boolean

} if (temporary) {          

const temporary: boolean

return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.redirect('/302')          

(property) Context<BlankEnv, "/", BlankInput>.redirect: <302>(location: string, status?: 302 | undefined) => Response & TypedResponse<undefined, 302, "redirect"> .redirect() can Redirect, default status code is 302.

@see — https://hono.dev/docs/api/context#redirect

@example
ts app.get('/redirect', (c) => { return c.redirect('/') }) app.get('/redirect-permanently', (c) => { return c.redirect('/', 301) })

} return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.redirect('/301', 301)          

(property) Context<BlankEnv, "/", BlankInput>.redirect: <301>(location: string, status?: 301 | undefined) => Response & TypedResponse<undefined, 301, "redirect"> .redirect() can Redirect, default status code is 302.

@see — https://hono.dev/docs/api/context#redirect

@example
ts app.get('/redirect', (c) => { return c.redirect('/') }) app.get('/redirect-permanently', (c) => { return c.redirect('/', 301) })

}) const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: 200; } | { input: {}; output: undefined; outputFormat: "redirect"; status: 302; } | { input: {}; output: undefined; outputFormat: "redirect"; status: 301; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: 200; } | { input: {}; output: undefined; outputFormat: "redirect"; status: 302; } | { input: {}; output: undefined; outputFormat: "redirect"; status: 301; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

app>('http://localhost/')          

const app: Hono<BlankEnv, { "/": { $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: 200; } | { input: {}; output: undefined; outputFormat: "redirect"; status: 302; } | { input: {}; output: undefined; outputFormat: "redirect"; status: 301; }; }; }, "/">

const req =

const req: (args?: {} | undefined, options?: ClientRequestOptions) => Promise<ClientResponse<{ ok: boolean; }, 200, "json"> | ClientResponse<...> | ClientResponse<...>>

client.index.$get          

const client: { index: ClientRequest<{ $get: { input: {}; output: { ok: boolean; }; outputFormat: "json"; status: 200; } | { input: {}; output: undefined; outputFormat: "redirect"; status: 302; } | { input: {}; output: undefined; outputFormat: "redirect"; status: 301; }; }>; }

it('Should infer request type the type correctly', () => { type Actual =

type Actual = { ok: boolean; } | undefined

InferResponseType

(alias) type InferResponseType<T, U extends StatusCode = StatusCode> = InferEndpointType<T> extends { output: infer O; status: infer S; } ? S extends U ? O : never : never import InferResponseType

req>          

const req: (args?: {} | undefined, options?: ClientRequestOptions) => Promise<ClientResponse<{ ok: boolean; }, 200, "json"> | ClientResponse<...> | ClientResponse<...>>

type Expected =          

type Expected = { ok: boolean; } | undefined

| { ok: boolean          

(property) ok: boolean

} | undefined type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Expected,

type Expected = { ok: boolean; } | undefined

Actual>>          

type Actual = { ok: boolean; } | undefined

}) it('Should infer response type correctly', async () => { const res = await

const res: ClientResponse<{ ok: boolean; }, 200, "json"> | ClientResponse<undefined, 302, "redirect"> | ClientResponse<undefined, 301, "redirect">

req()          

const req: (args?: {} | undefined, options?: ClientRequestOptions) => Promise<ClientResponse<{ ok: boolean; }, 200, "json"> | ClientResponse<...> | ClientResponse<...>>

if (res

const res: ClientResponse<{ ok: boolean; }, 200, "json"> | ClientResponse<undefined, 302, "redirect"> | ClientResponse<undefined, 301, "redirect">

.ok) {          

(property) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.ok: boolean MDN Reference

const data = await

const data: { ok: boolean; }

res

const res: ClientResponse<{ ok: boolean; }, 200, "json">

.json()          

(method) ClientResponse<{ ok: boolean; }, 200, "json">.json(): Promise<{ ok: boolean; }> MDN Reference

expectTypeOf(data).toMatchTypeOf({

const data: { ok: boolean; }

ok: true })          

(property) ok: boolean

} if (res

const res: ClientResponse<{ ok: boolean; }, 200, "json"> | ClientResponse<undefined, 302, "redirect"> | ClientResponse<undefined, 301, "redirect">

.status === 301) {          

(property) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.status: 200 | 301 | 302 MDN Reference

type Expected =

type Expected = ClientResponse<undefined, 301, "redirect">

ClientResponse          

(alias) interface ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string> import ClientResponse

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Expected, typeof

type Expected = ClientResponse<undefined, 301, "redirect">

res>>          

const res: ClientResponse<undefined, 301, "redirect">

} if (res

const res: ClientResponse<{ ok: boolean; }, 200, "json"> | ClientResponse<undefined, 302, "redirect"> | ClientResponse<undefined, 301, "redirect">

.status === 302) {          

(property) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.status: 200 | 301 | 302 MDN Reference

type Expected =

type Expected = ClientResponse<undefined, 302, "redirect">

ClientResponse          

(alias) interface ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string> import ClientResponse

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

<Expected, typeof

type Expected = ClientResponse<undefined, 302, "redirect">

res>>          

const res: ClientResponse<undefined, 302, "redirect">

} }) }) describe('WebSocket Provider Integration', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const route =

const route: Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get(          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", HandlerResponse<any>, { outputFormat: "ws"; }, any>(path: "/", handler: H<any, "/", { outputFormat: "ws"; }, HandlerResponse<any>>) => Hono<...> (+22 overloads)

'/', upgradeWebSocket(

(alias) upgradeWebSocket(createEvents: (c: Context) => WSEvents<WebSocket> | Promise<WSEvents<WebSocket>>, options?: UpgradeWebSocketOptions | undefined): MiddlewareHandler<any, string, { outputFormat: "ws"; }> import upgradeWebSocket

(c) => ({          

(parameter) c: Context<any, any, {}>

onMessage

(property) WSEvents<WebSocket>.onMessage?: ((evt: MessageEvent<WSMessageReceive>, ws: WSContext<WebSocket>) => void) | undefined

(event,

(parameter) event: MessageEvent<WSMessageReceive>

ws) {          

(parameter) ws: WSContext<WebSocket>

ws

(parameter) ws: WSContext<WebSocket>

.send('Hello from server!')          

(method) send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void

}, onClose() {          

(property) WSEvents<WebSocket>.onClose?: ((evt: CloseEvent, ws: WSContext<WebSocket>) => void) | undefined

console

var console: Console

.log('Connection closed')          

(method) Console.log(...data: any[]): void MDN Reference

}, })) ) type AppType = typeof

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

route          

const route: Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

const server = setupServer()          

const server: any

beforeAll(() => server.listen())          

const server: any

afterEach(() => { vi.clearAllMocks() server.resetHandlers()          

const server: any

}) afterAll(() => server.close())          

const server: any

it.each([ { description: 'should initialize the WebSocket provider correctly',          

(property) description: string

url: 'http://localhost',          

(property) url: string

query: undefined,          

(property) query: undefined

expectedUrl: 'ws://localhost/index',          

(property) expectedUrl: string

}, { description: 'should correctly add query parameters to the WebSocket URL',          

(property) description: string

url: 'http://localhost',          

(property) url: string

query: {

(property) query: { id: string; type: string; tag: string[]; }

id: '123',

(property) id: string

type: 'test',

(property) type: string

tag: ['a', 'b'] },          

(property) tag: string[]

expectedUrl: 'ws://localhost/index?id=123&type=test&tag=a&tag=b',          

(property) expectedUrl: string

}, ])('$description', ({ url,

(parameter) url: any

expectedUrl,

(parameter) expectedUrl: any

query }) => {          

(parameter) query: any

const webSocketMock = vi.fn()          

const webSocketMock: any

const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

<AppType>

type AppType = Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">

(url, {          

(parameter) url: any

webSocket

(property) webSocket?: ((url: string | URL, protocols?: string | string[] | undefined) => WebSocket) | undefined

(url,

(parameter) url: string | URL

options) {          

(parameter) options: string | string[] | undefined

return webSocketMock

const webSocketMock: any

(url,

(parameter) url: string | URL

options)          

(parameter) options: string | string[] | undefined

}, }) client.index

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

.$ws({

(property) $ws: (args?: {} | undefined) => WebSocket

query })          

(property) query: any

expect(webSocketMock).toHaveBeenCalledWith

const webSocketMock: any

(expectedUrl, undefined)          

(parameter) expectedUrl: any

}) })
src/client/client.ts
            
                import type { Hono } from '../hono'
                import type { FormValue, ValidationTargets } from '../types'
                import { serialize } from '../utils/cookie'
                import type { UnionToIntersection } from '../utils/types'
                import type { Callback, Client, ClientRequestOptions } from './types'
                import {
                  deepMerge,
                  mergePath,
                  removeIndexString,
                  replaceUrlParam,
                  replaceUrlProtocol,
                } from './utils'
                
                const createProxy = 

const createProxy: (callback: Callback, path: string[]) => unknown

(callback:

(parameter) callback: Callback

Callback,

(alias) type Callback = (opts: CallbackOptions) => unknown import Callback

path: string[]) => {          

(parameter) path: string[]

const proxy: unknown = new

const proxy: unknown

Proxy(() => {}, {          

var Proxy: ProxyConstructor new <() => void>(target: () => void, handler: ProxyHandler<() => void>) => () => void Creates a Proxy object. The Proxy object allows you to create an object that can be used in place of the original object, but which may redefine fundamental Object operations like getting, setting, and defining properties. Proxy objects are commonly used to log property accesses, validate, format, or sanitize inputs.

@param target — A target object to wrap with Proxy.

@param handler — An object whose properties define the behavior of Proxy when an operation is attempted on it.

get

(method) ProxyHandler<() => void>.get?(target: () => void, p: string | symbol, receiver: any): any A trap for getting a property value.

@param target — The original object which is being proxied.

@param p — The name or Symbol of the property to get.

@param receiver — The proxy or an object that inherits from the proxy.

(_obj,

(parameter) _obj: () => void

key) {          

(parameter) key: string | symbol

if (typeof key !== 'string' ||

(parameter) key: string | symbol

key === 'then') {          

(parameter) key: string

return undefined } return createProxy

const createProxy: (callback: Callback, path: string[]) => unknown

(callback, [..

(parameter) callback: Callback

.path,

(parameter) path: string[]

key])          

(parameter) key: string

}, apply

(method) ProxyHandler<() => void>.apply?(target: () => void, thisArg: any, argArray: any[]): any A trap method for a function call.

@param target — The original callable object which is being proxied.

(_1,

(parameter) _1: () => void

_2,

(parameter) _2: any

args) {          

(parameter) args: any[]

return callback({          

(parameter) callback: (opts: CallbackOptions) => unknown

path,          

(property) CallbackOptions.path: string[]

args,          

(property) CallbackOptions.args: any[]

}) }, }) return proxy          

const proxy: unknown

} class ClientRequestImpl {          

class ClientRequestImpl

private url: string          

(property) ClientRequestImpl.url: string

private method: string          

(property) ClientRequestImpl.method: string

private queryParams:

(property) ClientRequestImpl.queryParams: URLSearchParams | undefined

URLSearchParams | undefined = undefined          

interface URLSearchParams MDN Reference

private pathParams:

(property) ClientRequestImpl.pathParams: Record<string, string>

Record = {}          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

private rBody:

(property) ClientRequestImpl.rBody: BodyInit | undefined

BodyInit | undefined          

type BodyInit = ReadableStream<any> | XMLHttpRequestBodyInit

private cType: string | undefined = undefined          

(property) ClientRequestImpl.cType: string | undefined

constructor(url: string,

(parameter) url: string

method: string) {          

(parameter) method: string

this.url =

(property) ClientRequestImpl.url: string

url          

(parameter) url: string

this.method =

(property) ClientRequestImpl.method: string

method          

(parameter) method: string

} fetch = async (          

(property) ClientRequestImpl.fetch: (args?: ValidationTargets<FormValue> & { param?: Record<string, string>; }, opt?: ClientRequestOptions) => Promise<Response>

args?:

(parameter) args: (ValidationTargets<FormValue> & { param?: Record<string, string>; }) | undefined

ValidationTargets

(alias) type ValidationTargets<T extends FormValue = ParsedFormValue, P extends string = string> = { json: any; form: Record<string, T | T[]>; query: Record<string, string | string[]>; param: Record<P, P extends `${infer _}?` ? string | undefined : string>; header: Record<string, string>; cookie: Record<string, string>; } import ValidationTargets

<FormValue> & {          

(alias) type FormValue = string | Blob import FormValue

param?:

(property) param?: Record<string, string> | undefined

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

}, opt?:

(parameter) opt: ClientRequestOptions | undefined

ClientRequestOptions          

(alias) type ClientRequestOptions<T = unknown> = { fetch?: typeof fetch | ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response>); webSocket?: (...args: ConstructorParameters<typeof WebSocket>) => WebSocket; init?: RequestInit; } & (keyof T extends never ? { ...; } : { ...; }) import ClientRequestOptions

) => { if (args) {          

(parameter) args: (ValidationTargets<FormValue> & { param?: Record<string, string>; }) | undefined

if (args

(parameter) args: ValidationTargets<FormValue> & { param?: Record<string, string>; }

.query) {          

(property) query: Record<string, string | string[]>

for (const [k,

const k: string

v] of

const v: string | string[]

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string | string[]>(o: { [s: string]: string | string[]; } | ArrayLike<string | string[]>): [string, string | string[]][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(args

(parameter) args: ValidationTargets<FormValue> & { param?: Record<string, string>; }

.query)) {          

(property) query: Record<string, string | string[]>

if (v === undefined) {          

const v: string | string[]

continue } this.queryParams ||= new

(property) ClientRequestImpl.queryParams: URLSearchParams | undefined

URLSearchParams()          

var URLSearchParams: new (init?: string[][] | Record<string, string> | string | URLSearchParams) => URLSearchParams MDN Reference

if (Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(v)) {          

const v: string | string[]

for (const v2 of

const v2: string

v) {          

const v: string[]

this.queryParams

(property) ClientRequestImpl.queryParams: URLSearchParams

.append

(method) URLSearchParams.append(name: string, value: string): void Appends a specified key/value pair as a new search parameter.

MDN Reference

(k,

const k: string

v2)          

const v2: string

} } else { this.queryParams

(property) ClientRequestImpl.queryParams: URLSearchParams

.set

(method) URLSearchParams.set(name: string, value: string): void Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.

MDN Reference

(k,

const k: string

v)          

const v: string

} } } if (args

(parameter) args: ValidationTargets<FormValue> & { param?: Record<string, string>; }

.form) {          

(property) form: Record<string, FormValue | FormValue[]>

const form = new

const form: FormData

FormData()          

var FormData: new (form?: HTMLFormElement, submitter?: HTMLElement | null) => FormData Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".

MDN Reference

for (const [k,

const k: string

v] of

const v: FormValue | FormValue[]

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<FormValue | FormValue[]>(o: { [s: string]: FormValue | FormValue[]; } | ArrayLike<FormValue | FormValue[]>): [...][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(args

(parameter) args: ValidationTargets<FormValue> & { param?: Record<string, string>; }

.form)) {          

(property) form: Record<string, FormValue | FormValue[]>

if (Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(v)) {          

const v: FormValue | FormValue[]

for (const v2 of

const v2: FormValue

v) {          

const v: FormValue[]

form

const form: FormData

.append

(method) FormData.append(name: string, value: string | Blob): void (+2 overloads) MDN Reference

(k,

const k: string

v2)          

const v2: FormValue

} } else { form

const form: FormData

.append

(method) FormData.append(name: string, value: string | Blob): void (+2 overloads) MDN Reference

(k,

const k: string

v)          

const v: FormValue

} } this.rBody =

(property) ClientRequestImpl.rBody: BodyInit | undefined

form          

const form: FormData

} if (args

(parameter) args: ValidationTargets<FormValue> & { param?: Record<string, string>; }

.json) {          

(property) json: any

this.rBody =

(property) ClientRequestImpl.rBody: BodyInit | undefined

JSON

var JSON: JSON An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.

.stringify

(method) JSON.stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string (+1 overload) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.

@param value — A JavaScript value, usually an object or array, to be converted.

@param replacer — A function that transforms the results.

@param space — Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.

(args

(parameter) args: ValidationTargets<FormValue> & { param?: Record<string, string>; }

.json)          

(property) json: any

this.cType = 'application/json'          

(property) ClientRequestImpl.cType: string | undefined

} if (args

(parameter) args: ValidationTargets<FormValue> & { param?: Record<string, string>; }

.param) {          

(property) param: Record<string, string>

this.pathParams =

(property) ClientRequestImpl.pathParams: Record<string, string>

args

(parameter) args: ValidationTargets<FormValue> & { param?: Record<string, string>; }

.param          

(property) param: Record<string, string>

} } let methodUpperCase = this

let methodUpperCase: string

.method

(property) ClientRequestImpl.method: string

.toUpperCase()          

(method) String.toUpperCase(): string Converts all the alphabetic characters in a string to uppercase.

const headerValues:

const headerValues: Record<string, string>

Record = {          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

...(args?

(parameter) args: (ValidationTargets<FormValue> & { param?: Record<string, string>; }) | undefined

.header ?? {}),          

(property) header: Record<string, string> | undefined

...(typeof opt?

(parameter) opt: ClientRequestOptions | undefined

.headers === 'function'          

(property) headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>) | undefined

? await opt

(parameter) opt: ClientRequestOptions

.headers()          

(property) headers?: () => Record<string, string> | Promise<Record<string, string>>

: opt?

(parameter) opt: ClientRequestOptions | undefined

.headers          

(property) headers?: Record<string, string> | undefined

? opt

(parameter) opt: ClientRequestOptions

.headers          

(property) headers?: Record<string, string>

: {}), } if (args?

(parameter) args: (ValidationTargets<FormValue> & { param?: Record<string, string>; }) | undefined

.cookie) {          

(property) cookie: Record<string, string> | undefined

const cookies: string[] = []          

const cookies: string[]

for (const [key,

const key: string

value] of

const value: string

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string>(o: { [s: string]: string; } | ArrayLike<string>): [string, string][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(args

(parameter) args: ValidationTargets<FormValue> & { param?: Record<string, string>; }

.cookie)) {          

(property) cookie: Record<string, string>

cookies

const cookies: string[]

.push

(method) Array<string>.push(...items: string[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(serialize

(alias) serialize<string>(name: string, value: string, opt?: CookieOptions | undefined): string import serialize

(key,

const key: string

value, {

const value: string

path: '/' }))          

(property) path?: string | undefined

} headerValues['Cookie'] =

const headerValues: Record<string, string>

cookies

const cookies: string[]

.join(',')          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

} if (this.cType) {          

(property) ClientRequestImpl.cType: string | undefined

headerValues['Content-Type'] = this

const headerValues: Record<string, string>

.cType          

(property) ClientRequestImpl.cType: string

} const headers = new

const headers: Headers

Headers

var Headers: new (init?: HeadersInit) => Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

(headerValues ?? undefined)          

const headerValues: Record<string, string>

let url = this

let url: string

.url          

(property) ClientRequestImpl.url: string

url =

let url: string

removeIndexString

(alias) removeIndexString(urlSting: string): string import removeIndexString

(url)          

let url: string

url =

let url: string

replaceUrlParam

(alias) replaceUrlParam(urlString: string, params: Record<string, string | undefined>): string import replaceUrlParam

(url, this

let url: string

.pathParams)          

(property) ClientRequestImpl.pathParams: Record<string, string>

if (this.queryParams) {          

(property) ClientRequestImpl.queryParams: URLSearchParams | undefined

url =

let url: string

url + '?' + this

let url: string

.queryParams

(property) ClientRequestImpl.queryParams: URLSearchParams

.toString()          

(method) URLSearchParams.toString(): string Returns a string containing a query string suitable for use in a URL. Does not include the question mark.

} methodUpperCase = this

let methodUpperCase: string

.method

(property) ClientRequestImpl.method: string

.toUpperCase()          

(method) String.toUpperCase(): string Converts all the alphabetic characters in a string to uppercase.

const setBody = !

const setBody: boolean

(methodUpperCase === 'GET' ||

let methodUpperCase: string

methodUpperCase === 'HEAD')          

let methodUpperCase: string

// Pass URL string to 1st arg for testing with MSW and node-fetch return (opt?

(parameter) opt: ClientRequestOptions | undefined

.fetch ||

(property) fetch?: ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response>) | ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | undefined

fetch)

function fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response> MDN Reference

(url, {          

let url: string

body:

(property) RequestInit.body?: BodyInit | null | undefined A BodyInit object or null to set request's body.

setBody ? this

const setBody: boolean

.rBody : undefined,          

(property) ClientRequestImpl.rBody: BodyInit | undefined

method:

(property) RequestInit.method?: string | undefined A string to set request's method.

methodUpperCase,          

let methodUpperCase: string

headers:

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

headers,          

const headers: Headers

...opt?

(parameter) opt: ClientRequestOptions | undefined

.init,          

(property) init?: RequestInit | undefined Standard RequestInit, caution that this take highest priority and could be used to overwrite things that Hono sets for you, like body | method | headers.

If you want to add some headers, use in headers instead of init

}) } } // eslint-disable-next-line @typescript-eslint/no-explicit-any export const hc =

const hc: <T extends Hono<any, any, any>>(baseUrl: string, options?: ClientRequestOptions) => UnionToIntersection<Client<T>>

<T extends

(type parameter) T in <T extends Hono<any, any, any>>(baseUrl: string, options?: ClientRequestOptions): UnionToIntersection<Client<T>>

Hono>(          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

baseUrl: string,          

(parameter) baseUrl: string

options?:

(parameter) options: ClientRequestOptions | undefined

ClientRequestOptions          

(alias) type ClientRequestOptions<T = unknown> = { fetch?: typeof fetch | ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response>); webSocket?: (...args: ConstructorParameters<typeof WebSocket>) => WebSocket; init?: RequestInit; } & (keyof T extends never ? { ...; } : { ...; }) import ClientRequestOptions

) => createProxy(function

const createProxy: (callback: Callback, path: string[]) => unknown

proxyCallback

(local function) proxyCallback(opts: CallbackOptions): string | Promise<Response> | URL | WebSocket | ((opts: CallbackOptions) => string | ... 4 more ... | ClientRequestImpl) | ClientRequestImpl

(opts) {          

(parameter) opts: CallbackOptions

const parts = [..

const parts: string[]

.opts

(parameter) opts: CallbackOptions

.path]          

(property) CallbackOptions.path: string[]

// allow calling .toString() and .valueOf() on the proxy if (parts

const parts: string[]

[parts

const parts: string[]

.length - 1] === 'toString') {          

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

if (parts

const parts: string[]

[parts

const parts: string[]

.length - 2] === 'name') {          

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

// e.g. hc().somePath.name.toString() -> "somePath" return parts

const parts: string[]

[parts

const parts: string[]

.length - 3] || ''          

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

} // e.g. hc().somePath.toString() return proxyCallback

(local function) proxyCallback(opts: CallbackOptions): string | Promise<Response> | URL | WebSocket | ((opts: CallbackOptions) => string | ... 4 more ... | ClientRequestImpl) | ClientRequestImpl

.toString()          

(method) Function.toString(): string Returns a string representation of a function.

} if (parts

const parts: string[]

[parts

const parts: string[]

.length - 1] === 'valueOf') {          

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

if (parts

const parts: string[]

[parts

const parts: string[]

.length - 2] === 'name') {          

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

// e.g. hc().somePath.name.valueOf() -> "somePath" return parts

const parts: string[]

[parts

const parts: string[]

.length - 3] || ''          

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

} // e.g. hc().somePath.valueOf() return proxyCallback          

(local function) proxyCallback(opts: CallbackOptions): string | Promise<Response> | URL | WebSocket | ((opts: CallbackOptions) => string | ... 4 more ... | ClientRequestImpl) | ClientRequestImpl

} let method = ''          

let method: string

if (/^\$/.test

(method) RegExp.test(string: string): boolean Returns a Boolean value that indicates whether or not a pattern exists in a searched string.

@param string — String on which to perform the search.

(parts

const parts: string[]

[parts

const parts: string[]

.length - 1])) {          

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

const last =

const last: string | undefined

parts

const parts: string[]

.pop()          

(method) Array<string>.pop(): string | undefined Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

if (last) {          

const last: string | undefined

method =

let method: string

last

const last: string

.replace(/^\$/, '')          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

} } const path =

const path: string

parts

const parts: string[]

.join('/')          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

const url =

const url: string

mergePath

(alias) mergePath(base: string, path: string): string import mergePath

(baseUrl,

(parameter) baseUrl: string

path)          

const path: string

if (method === 'url') {          

let method: string

if (opts

(parameter) opts: CallbackOptions

.args[0] &&

(property) CallbackOptions.args: any[]

opts

(parameter) opts: CallbackOptions

.args[0].param) {          

(property) CallbackOptions.args: any[]

return new URL

var URL: new (url: string | URL, base?: string | URL) => URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

(replaceUrlParam

(alias) replaceUrlParam(urlString: string, params: Record<string, string | undefined>): string import replaceUrlParam

(url,

const url: string

opts

(parameter) opts: CallbackOptions

.args[0].param))          

(property) CallbackOptions.args: any[]

} return new URL

var URL: new (url: string | URL, base?: string | URL) => URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

(url)          

const url: string

} if (method === 'ws') {          

let method: string

const webSocketUrl =

const webSocketUrl: string

replaceUrlProtocol(          

(alias) replaceUrlProtocol(urlString: string, protocol: "ws" | "http"): string import replaceUrlProtocol

opts

(parameter) opts: CallbackOptions

.args[0] &&

(property) CallbackOptions.args: any[]

opts

(parameter) opts: CallbackOptions

.args[0].param ?

(property) CallbackOptions.args: any[]

replaceUrlParam

(alias) replaceUrlParam(urlString: string, params: Record<string, string | undefined>): string import replaceUrlParam

(url,

const url: string

opts

(parameter) opts: CallbackOptions

.args[0].param) :

(property) CallbackOptions.args: any[]

url,          

const url: string

'ws' ) const targetUrl = new

const targetUrl: URL

URL

var URL: new (url: string | URL, base?: string | URL) => URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

(webSocketUrl)          

const webSocketUrl: string

const queryParams:

const queryParams: Record<string, string | string[]> | undefined

Record | undefined =

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

opts

(parameter) opts: CallbackOptions

.args[0]?.query          

(property) CallbackOptions.args: any[]

if (queryParams) {          

const queryParams: Record<string, string | string[]> | undefined

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string | string[]>(o: { [s: string]: string | string[]; } | ArrayLike<string | string[]>): [string, string | string[]][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(queryParams)

const queryParams: Record<string, string | string[]>

.forEach((

(method) Array<[string, string | string[]]>.forEach(callbackfn: (value: [string, string | string[]], index: number, array: [string, string | string[]][]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

[key,

(parameter) key: string

value]) => {          

(parameter) value: string | string[]

if (Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(value)) {          

(parameter) value: string | string[]

value

(parameter) value: string[]

.forEach(

(method) Array<string>.forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(item) =>

(parameter) item: string

targetUrl

const targetUrl: URL

.searchParams

(property) URL.searchParams: URLSearchParams MDN Reference

.append

(method) URLSearchParams.append(name: string, value: string): void Appends a specified key/value pair as a new search parameter.

MDN Reference

(key,

(parameter) key: string

item))          

(parameter) item: string

} else { targetUrl

const targetUrl: URL

.searchParams

(property) URL.searchParams: URLSearchParams MDN Reference

.set

(method) URLSearchParams.set(name: string, value: string): void Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.

MDN Reference

(key,

(parameter) key: string

value)          

(parameter) value: string

} }) } const establishWebSocket = (..

const establishWebSocket: (url: string | URL, protocols?: string | string[] | undefined) => WebSocket

.args:

(parameter) args: [url: string | URL, protocols?: string | string[] | undefined]

ConstructorParameters

type ConstructorParameters<T extends abstract new (...args: any) => any> = T extends abstract new (...args: infer P) => any ? P : never Obtain the parameters of a constructor function type in a tuple

WebSocket>) => {          

var WebSocket: { new (url: string | URL, protocols?: string | string[]): WebSocket; prototype: WebSocket; readonly CONNECTING: 0; readonly OPEN: 1; readonly CLOSING: 2; readonly CLOSED: 3; } Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

if (options?

(parameter) options: ClientRequestOptions | undefined

.webSocket !== undefined && typeof

(property) webSocket?: ((url: string | URL, protocols?: string | string[] | undefined) => WebSocket) | undefined

options

(parameter) options: ClientRequestOptions

.webSocket === 'function') {          

(property) webSocket?: (url: string | URL, protocols?: string | string[] | undefined) => WebSocket

return options

(parameter) options: ClientRequestOptions

.webSocket(..

(property) webSocket?: (url: string | URL, protocols?: string | string[] | undefined) => WebSocket

.args)          

(parameter) args: [url: string | URL, protocols?: string | string[] | undefined]

} return new WebSocket(..

var WebSocket: new (url: string | URL, protocols?: string | string[]) => WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

.args)          

(parameter) args: [url: string | URL, protocols?: string | string[] | undefined]

} return establishWebSocket

const establishWebSocket: (url: string | URL, protocols?: string | string[] | undefined) => WebSocket

(targetUrl

const targetUrl: URL

.toString())          

(method) URL.toString(): string

} const req = new

const req: ClientRequestImpl

ClientRequestImpl

constructor ClientRequestImpl(url: string, method: string): ClientRequestImpl

(url,

const url: string

method)          

let method: string

if (method) {          

let method: string

options ??= {}          

(parameter) options: ClientRequestOptions | undefined

const args =

const args: ClientRequestOptions

deepMerge

(alias) deepMerge<ClientRequestOptions>(target: ClientRequestOptions, source: Record<string, unknown>): ClientRequestOptions import deepMerge

<ClientRequestOptions>

(alias) type ClientRequestOptions<T = unknown> = { fetch?: typeof fetch | ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response>); webSocket?: (...args: ConstructorParameters<typeof WebSocket>) => WebSocket; init?: RequestInit; } & (keyof T extends never ? { ...; } : { ...; }) import ClientRequestOptions

(options, { ...

(parameter) options: ClientRequestOptions

(opts

(parameter) opts: CallbackOptions

.args[1] ?? {}) })          

(property) CallbackOptions.args: any[]

return req

const req: ClientRequestImpl

.fetch

(property) ClientRequestImpl.fetch: (args?: ValidationTargets<FormValue> & { param?: Record<string, string>; }, opt?: ClientRequestOptions) => Promise<Response>

(opts

(parameter) opts: CallbackOptions

.args[0],

(property) CallbackOptions.args: any[]

args)          

const args: ClientRequestOptions

} return req          

const req: ClientRequestImpl

}, []) as UnionToIntersection

(alias) type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never import UnionToIntersection

<Client

(alias) type Client<T> = T extends Hono<any, infer S extends Schema, any> ? S extends Record<infer K extends string | number | symbol, Schema> ? K extends string ? PathToChain<...> : never : never : never import Client

<T>>          

(type parameter) T in <T extends Hono<any, any, any>>(baseUrl: string, options?: ClientRequestOptions): UnionToIntersection<Client<T>>

src/client/index.ts
            
                /**
                 * @module
                 * The HTTP Client for Hono.
                 */
                
                export { hc } from './client'          

(alias) const hc: <T extends Hono<any, any, any>>(baseUrl: string, options?: ClientRequestOptions) => UnionToIntersection<Client<T>> export hc

export type { InferResponseType,          

(alias) type InferResponseType<T, U extends StatusCode = StatusCode> = InferEndpointType<T> extends { output: infer O; status: infer S; } ? S extends U ? O : never : never export InferResponseType

InferRequestType,          

(alias) type InferRequestType<T> = T extends (args: infer R, options: any | undefined) => Promise<ClientResponse<unknown>> ? NonNullable<R> : never export InferRequestType

Fetch,          

(alias) type Fetch<T> = (args?: InferRequestType<T>, opt?: ClientRequestOptions) => Promise<ClientResponseOfEndpoint<...>> export Fetch

ClientRequestOptions,          

(alias) type ClientRequestOptions<T = unknown> = { fetch?: typeof fetch | ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response>); webSocket?: (...args: ConstructorParameters<typeof WebSocket>) => WebSocket; init?: RequestInit; } & (keyof T extends never ? { ...; } : { ...; }) export ClientRequestOptions

ClientRequest,          

(alias) type ClientRequest<S extends Schema> = { [M in keyof S]: S[M] extends Endpoint & { input: infer R; } ? R extends object ? HasRequiredKeys<R> extends true ? (args: R, options?: ClientRequestOptions) => Promise<ClientResponseOfEndpoint<...>> : (args?: R, options?: ClientRequestOptions) => Promise<ClientResponseOfEndpoint<...>> : never : never; } & { ...; } & (S["$get"] extends { ...; } ? S["$get"] extends { ...; } ? { ...; } : {} : {}) export ClientRequest

ClientResponse,          

(alias) interface ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string> export ClientResponse

} from './types'
src/client/types.test.ts
            
                /* eslint-disable @typescript-eslint/no-unused-vars */
                import { expectTypeOf } from 'vitest'
                import { Hono } from '..'
                import { upgradeWebSocket } from '../adapter/deno/websocket'
                import { hc } from '.'
                
                describe('WebSockets', () => {
                  const app = new

const app: Hono<BlankEnv, { "/ws": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; } & { ...; }, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get(          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/ws", "/ws", HandlerResponse<any>, { outputFormat: "ws"; }, any>(path: "/ws", handler: H<any, "/ws", { outputFormat: "ws"; }, HandlerResponse<any>>) => Hono<...> (+22 overloads)

'/ws', upgradeWebSocket(() => ({}))          

(alias) upgradeWebSocket(createEvents: (c: Context) => WSEvents<WebSocket> | Promise<WSEvents<WebSocket>>, options?: UpgradeWebSocketOptions | undefined): MiddlewareHandler<any, string, { outputFormat: "ws"; }> import upgradeWebSocket

) .get('/',

(property) Hono<BlankEnv, { "/ws": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; }, "/">.get: HandlerInterface <"/", "/", JSONRespondReturn<{}, StatusCode>, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json({}))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{}, StatusCode>(object: {}, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{}, StatusCode> (+1 overload)

const client =

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; } & { ws: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/ws": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; } & { ...; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } & { ...; } import hc

app>('/')          

const app: Hono<BlankEnv, { "/ws": { $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }; } & { ...; }, "/">

it('WebSocket route', () => { expectTypeOf(client.ws).toMatchTypeOf<{          

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; } & { ws: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

$ws: () =>

(property) $ws: () => WebSocket

WebSocket          

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

}>() }) it('Not WebSocket Route', () => { expectTypeOf< typeof client.index extends {

const client: { index: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; } & { ws: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; } | { input: {}; output: {}; outputFormat: "ws"; status: StatusCode; }; }>; }

$ws: () =>

(property) $ws: () => WebSocket

WebSocket } ? false : true          

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

>().toEqualTypeOf(true) }) }) describe('without the leading slash', () => { const app = new

const app: Hono<BlankEnv, { foo: { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; } & { "foo/bar": { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; } & { ...; }, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('foo',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"foo", "foo", JSONRespondReturn<{}, StatusCode>, BlankInput, BlankEnv>(path: "foo", handler: H<BlankEnv, "foo", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "foo", BlankInput>

c

(parameter) c: Context<BlankEnv, "foo", BlankInput>

.json({}))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{}, StatusCode>(object: {}, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{}, StatusCode> (+1 overload)

.get('foo/bar',

(property) Hono<BlankEnv, { foo: { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; }, "/">.get: HandlerInterface <"foo/bar", "foo/bar", JSONRespondReturn<{}, StatusCode>, BlankInput, BlankEnv>(path: "foo/bar", handler: H<BlankEnv, "foo/bar", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "foo/bar", BlankInput>

c

(parameter) c: Context<BlankEnv, "foo/bar", BlankInput>

.json({}))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{}, StatusCode>(object: {}, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{}, StatusCode> (+1 overload)

.get('foo/:id/baz',

(property) Hono<BlankEnv, { foo: { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; } & { "foo/bar": { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; }, "/">.get: HandlerInterface <"foo/:id/baz", "foo/:id/baz", JSONRespondReturn<{}, StatusCode>, BlankInput, BlankEnv>(path: "foo/:id/baz", handler: H<BlankEnv, "foo/:id/baz", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "foo/:id/baz", BlankInput>

c

(parameter) c: Context<BlankEnv, "foo/:id/baz", BlankInput>

.json({}))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{}, StatusCode>(object: {}, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{}, StatusCode> (+1 overload)

const client =

const client: { foo: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; } & { foo: { bar: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; }; } & { ...; }

hc

(alias) hc<Hono<BlankEnv, { foo: { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; } & { "foo/bar": { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; } & { ...; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } & ... 1 more ... & { ...; } import hc

app>('')          

const app: Hono<BlankEnv, { foo: { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; } & { "foo/bar": { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; } & { ...; }, "/">

it('`foo` should have `$get`', () => { expectTypeOf(client.foo).toHaveProperty('$get')          

const client: { foo: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; } & { foo: { bar: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; }; } & { ...; }

}) it('`foo.bar` should not have `$get`', () => { expectTypeOf(client.foo.bar).toHaveProperty('$get')          

const client: { foo: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; } & { foo: { bar: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; }; } & { ...; }

}) it('`foo[":id"].baz` should have `$get`', () => { expectTypeOf(client.foo[':id'].baz).toHaveProperty('$get')          

const client: { foo: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; } & { foo: { bar: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; }; } & { ...; }

}) }) describe('with the leading slash', () => { const app = new

const app: Hono<BlankEnv, { "/foo": { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; } & { "/foo/bar": { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; } & { ...; }, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/foo',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/foo", "/foo", JSONRespondReturn<{}, StatusCode>, BlankInput, BlankEnv>(path: "/foo", handler: H<BlankEnv, "/foo", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

c

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

.json({}))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{}, StatusCode>(object: {}, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{}, StatusCode> (+1 overload)

.get('/foo/bar',

(property) Hono<BlankEnv, { "/foo": { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; }, "/">.get: HandlerInterface <"/foo/bar", "/foo/bar", JSONRespondReturn<{}, StatusCode>, BlankInput, BlankEnv>(path: "/foo/bar", handler: H<BlankEnv, "/foo/bar", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/foo/bar", BlankInput>

c

(parameter) c: Context<BlankEnv, "/foo/bar", BlankInput>

.json({}))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{}, StatusCode>(object: {}, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{}, StatusCode> (+1 overload)

.get('/foo/:id/baz',

(property) Hono<BlankEnv, { "/foo": { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; } & { "/foo/bar": { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; }, "/">.get: HandlerInterface <"/foo/:id/baz", "/foo/:id/baz", JSONRespondReturn<{}, StatusCode>, BlankInput, BlankEnv>(path: "/foo/:id/baz", handler: H<BlankEnv, "/foo/:id/baz", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/foo/:id/baz", BlankInput>

c

(parameter) c: Context<BlankEnv, "/foo/:id/baz", BlankInput>

.json({}))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{}, StatusCode>(object: {}, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{}, StatusCode> (+1 overload)

const client =

const client: { foo: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; } & { foo: { bar: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; }; } & { ...; }

hc

(alias) hc<Hono<BlankEnv, { "/foo": { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; } & { "/foo/bar": { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; } & { ...; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } & ... 1 more ... & { ...; } import hc

app>('')          

const app: Hono<BlankEnv, { "/foo": { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; } & { "/foo/bar": { $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }; } & { ...; }, "/">

it('`foo` should have `$get`', () => { expectTypeOf(client.foo).toHaveProperty('$get')          

const client: { foo: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; } & { foo: { bar: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; }; } & { ...; }

}) it('`foo.bar` should not have `$get`', () => { expectTypeOf(client.foo.bar).toHaveProperty('$get')          

const client: { foo: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; } & { foo: { bar: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; }; } & { ...; }

}) it('`foo[":id"].baz` should have `$get`', () => { expectTypeOf(client.foo[':id'].baz).toHaveProperty('$get')          

const client: { foo: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; } & { foo: { bar: ClientRequest<{ $get: { input: {}; output: {}; outputFormat: "json"; status: StatusCode; }; }>; }; } & { ...; }

}) })
src/client/types.ts
            
                import type { Hono } from '../hono'
                import type { Endpoint, ResponseFormat, Schema } from '../types'
                import type { StatusCode, SuccessStatusCode } from '../utils/http-status'
                import type { HasRequiredKeys } from '../utils/types'
                
                type HonoRequest = (typeof

type HonoRequest = (input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => globalThis.Response | Promise<globalThis.Response>

Hono.prototype)['request']          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

export type ClientRequestOptions

type ClientRequestOptions<T = unknown> = { fetch?: typeof fetch | HonoRequest; webSocket?: (...args: ConstructorParameters<typeof WebSocket>) => WebSocket; init?: RequestInit; } & (keyof T extends never ? { headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>); } : { ...; })

<T = unknown> = {          

(type parameter) T in type ClientRequestOptions<T = unknown>

fetch?: typeof

(property) fetch?: ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => globalThis.Response | Promise<globalThis.Response>) | ((input: RequestInfo | URL, init?: RequestInit) => Promise<globalThis.Response>) | undefined

fetch |

function fetch(input: RequestInfo | URL, init?: RequestInit): Promise<globalThis.Response> MDN Reference

HonoRequest          

type HonoRequest = (input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => globalThis.Response | Promise<globalThis.Response>

webSocket?: (..

(property) webSocket?: ((url: string | URL, protocols?: string | string[] | undefined) => WebSocket) | undefined

.args:

(parameter) args: [url: string | URL, protocols?: string | string[] | undefined]

ConstructorParameters

type ConstructorParameters<T extends abstract new (...args: any) => any> = T extends abstract new (...args: infer P) => any ? P : never Obtain the parameters of a constructor function type in a tuple

WebSocket>) =>

var WebSocket: { new (url: string | URL, protocols?: string | string[]): WebSocket; prototype: WebSocket; readonly CONNECTING: 0; readonly OPEN: 1; readonly CLOSING: 2; readonly CLOSED: 3; } Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

WebSocket          

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

/** * Standard `RequestInit`, caution that this take highest priority * and could be used to overwrite things that Hono sets for you, like `body | method | headers`. * * If you want to add some headers, use in `headers` instead of `init` */ init?:

(property) init?: RequestInit | undefined Standard RequestInit, caution that this take highest priority and could be used to overwrite things that Hono sets for you, like body | method | headers.

If you want to add some headers, use in headers instead of init

RequestInit          

interface RequestInit

} & (keyof T extends never          

(type parameter) T in type ClientRequestOptions<T = unknown>

? { headers?:          

(property) headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>) | undefined

| Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

| (() => Record |

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Record>)          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

} : { headers:

(property) headers: T | (() => T | Promise<T>)

T | (() =>

(type parameter) T in type ClientRequestOptions<T = unknown>

T |

(type parameter) T in type ClientRequestOptions<T = unknown>

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<T>)          

(type parameter) T in type ClientRequestOptions<T = unknown>

}) export type ClientRequest

type ClientRequest<S extends Schema> = { [M in keyof S]: S[M] extends Endpoint & { input: infer R; } ? R extends object ? HasRequiredKeys<R> extends true ? (args: R, options?: ClientRequestOptions) => Promise<ClientResponseOfEndpoint<S[M]>> : (args?: R, options?: ClientRequestOptions) => Promise<ClientResponseOfEndpoint<S[M]>> : never : never; } & { ...; } & (S["$get"] extends { ...; } ? S["$get"] extends { ...; } ? { ...; } : {} : {})

<S extends

(type parameter) S in type ClientRequest<S extends Schema>

Schema> = {          

(alias) type Schema = { [Path: string]: { [Method: `$${Lowercase<string>}`]: Endpoint; }; } import Schema

[M in keyof

(type parameter) M

S]:

(type parameter) S in type ClientRequest<S extends Schema>

S

(type parameter) S in type ClientRequest<S extends Schema>

[M] extends

(type parameter) M

Endpoint & {

(alias) type Endpoint = { input: any; output: any; outputFormat: ResponseFormat; status: StatusCode; } import Endpoint

input: infer

(property) input: R

R }          

(type parameter) R

? R extends object          

(type parameter) R

? HasRequiredKeys

(alias) type HasRequiredKeys<BaseType extends object> = Exclude<{ [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]> ? Key : never; }[keyof BaseType], undefined> extends never ? false : true import HasRequiredKeys

<R> extends true          

(type parameter) R

? (args:

(parameter) args: R

R,

(type parameter) R

options?:

(parameter) options: ClientRequestOptions<unknown> | undefined

ClientRequestOptions) =>

type ClientRequestOptions<T = unknown> = { fetch?: typeof fetch | HonoRequest; webSocket?: (...args: ConstructorParameters<typeof WebSocket>) => WebSocket; init?: RequestInit; } & (keyof T extends never ? { headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>); } : { ...; })

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<ClientResponseOfEndpoint

type ClientResponseOfEndpoint<T extends Endpoint = Endpoint> = T extends { output: infer O; outputFormat: infer F; status: infer S; } ? ClientResponse<O, S extends number ? S : never, F extends string ? F : never> : never

<S

(type parameter) S in type ClientRequest<S extends Schema>

[M]>>          

(type parameter) M

: (args?:

(parameter) args: R | undefined

R,

(type parameter) R

options?:

(parameter) options: ClientRequestOptions<unknown> | undefined

ClientRequestOptions) =>

type ClientRequestOptions<T = unknown> = { fetch?: typeof fetch | HonoRequest; webSocket?: (...args: ConstructorParameters<typeof WebSocket>) => WebSocket; init?: RequestInit; } & (keyof T extends never ? { headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>); } : { ...; })

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<ClientResponseOfEndpoint

type ClientResponseOfEndpoint<T extends Endpoint = Endpoint> = T extends { output: infer O; outputFormat: infer F; status: infer S; } ? ClientResponse<O, S extends number ? S : never, F extends string ? F : never> : never

<S

(type parameter) S in type ClientRequest<S extends Schema>

[M]>>          

(type parameter) M

: never : never } & { $url: (          

(property) $url: (arg?: S[keyof S] extends { input: infer R; } ? R extends { param: infer P; } ? { param: P; } : {} : {}) => URL

arg?:

(parameter) arg: (S[keyof S] extends { input: infer R; } ? R extends { param: infer P; } ? { param: P; } : {} : {}) | undefined

S[keyof

(type parameter) S in type ClientRequest<S extends Schema>

S] extends {

(type parameter) S in type ClientRequest<S extends Schema>

input: infer

(property) input: R

R }          

(type parameter) R

? R extends {

(type parameter) R

param: infer

(property) param: P

P }          

(type parameter) P

? { param:

(property) param: P

P }          

(type parameter) P

: {} : {} ) => URL          

interface URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

} & (S['$get'] extends {

(type parameter) S in type ClientRequest<S extends Schema>

outputFormat: 'ws' }          

(property) outputFormat: "ws"

? S['$get'] extends {

(type parameter) S in type ClientRequest<S extends Schema>

input: infer

(property) input: I

I }          

(type parameter) I

? { $ws:

(property) $ws: (args?: I) => WebSocket

(args?:

(parameter) args: I | undefined

I) =>

(type parameter) I

WebSocket          

interface WebSocket Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

MDN Reference

} : {} : {}) // eslint-disable-next-line @typescript-eslint/no-explicit-any type BlankRecordToNever

type BlankRecordToNever<T> = T extends any ? T extends null ? null : keyof T extends never ? never : T : never

<T> =

(type parameter) T in type BlankRecordToNever<T>

T extends any          

(type parameter) T in type BlankRecordToNever<T>

? T extends null          

(type parameter) T in type BlankRecordToNever<T>

? null : keyof T extends never          

(type parameter) T in type BlankRecordToNever<T>

? never : T          

(type parameter) T in type BlankRecordToNever<T>

: never type ClientResponseOfEndpoint

type ClientResponseOfEndpoint<T extends Endpoint = Endpoint> = T extends { output: infer O; outputFormat: infer F; status: infer S; } ? ClientResponse<O, S extends number ? S : never, F extends string ? F : never> : never

<T extends

(type parameter) T in type ClientResponseOfEndpoint<T extends Endpoint = Endpoint>

Endpoint =

(alias) type Endpoint = { input: any; output: any; outputFormat: ResponseFormat; status: StatusCode; } import Endpoint

Endpoint> =

(alias) type Endpoint = { input: any; output: any; outputFormat: ResponseFormat; status: StatusCode; } import Endpoint

T extends {          

(type parameter) T in type ClientResponseOfEndpoint<T extends Endpoint = Endpoint>

output: infer

(property) output: O

O          

(type parameter) O

outputFormat: infer

(property) outputFormat: F

F          

(type parameter) F

status: infer

(property) status: S

S          

(type parameter) S

} ? ClientResponse

interface ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

<O,

(type parameter) O

S extends number ?

(type parameter) S

S : never,

(type parameter) S

F extends

(type parameter) F

ResponseFormat ?

(alias) type ResponseFormat = string import ResponseFormat

F : never>          

(type parameter) F

: never export interface ClientResponse<          

interface ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

T,          

(type parameter) T in ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

U extends number =

(type parameter) U in ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

StatusCode,          

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

F extends

(type parameter) F in ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

ResponseFormat =

(alias) type ResponseFormat = string import ResponseFormat

ResponseFormat          

(alias) type ResponseFormat = string import ResponseFormat

> extends globalThis.Response {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

readonly body:

(property) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.body: ReadableStream<any> | null MDN Reference

ReadableStream | null          

interface ReadableStream<R = any> This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.

MDN Reference

readonly bodyUsed: boolean          

(property) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.bodyUsed: boolean MDN Reference

ok:

(property) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.ok: U extends SuccessStatusCode ? true : U extends InfoStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 ? false : boolean MDN Reference

U extends

(type parameter) U in ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

SuccessStatusCode          

(alias) type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 import SuccessStatusCode

? true : U extends

(type parameter) U in ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

Exclude

type Exclude<T, U> = T extends U ? never : T Exclude from T those types that are assignable to U

<StatusCode,

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

SuccessStatusCode>          

(alias) type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 import SuccessStatusCode

? false : boolean status:

(property) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.status: U extends number = StatusCode MDN Reference

U          

(type parameter) U in ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

statusText: string          

(property) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.statusText: string MDN Reference

headers:

(property) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.headers: Headers MDN Reference

Headers          

interface Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

url: string          

(property) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.url: string MDN Reference

redirect

(method) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.redirect(url: string, status: number): Response

(url: string,

(parameter) url: string

status: number):

(parameter) status: number

Response          

interface Response

clone():

(method) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.clone(): Response MDN Reference

Response          

interface Response

json():

(method) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.json(): F extends "text" ? Promise<never> : F extends "json" ? Promise<BlankRecordToNever<T>> : Promise<unknown> MDN Reference

F extends 'text'          

(type parameter) F in ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

? Promise          

interface Promise<T> Represents the completion of an asynchronous operation

: F extends 'json'          

(type parameter) F in ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

? Promise

interface Promise<T> Represents the completion of an asynchronous operation

<BlankRecordToNever

type BlankRecordToNever<T> = T extends any ? T extends null ? null : keyof T extends never ? never : T : never

<T>>          

(type parameter) T in ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

: Promise          

interface Promise<T> Represents the completion of an asynchronous operation

text():

(method) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.text(): F extends "text" ? (T extends string ? Promise<T> : Promise<never>) : Promise<string> MDN Reference

F extends 'text' ?

(type parameter) F in ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

(T extends string ?

(type parameter) T in ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<T> :

(type parameter) T in ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

Promise) :

interface Promise<T> Represents the completion of an asynchronous operation

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

blob():

(method) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.blob(): Promise<Blob> MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Blob>          

interface Blob A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system.

MDN Reference

formData():

(method) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.formData(): Promise<FormData> MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<FormData>          

interface FormData Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".

MDN Reference

arrayBuffer():

(method) ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>.arrayBuffer(): Promise<ArrayBuffer> MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<ArrayBuffer>          

interface ArrayBuffer Represents a raw buffer of binary data, which is used to store data for the different typed arrays. ArrayBuffers cannot be read from or written to directly, but can be passed to a typed array or DataView Object to interpret the raw buffer as needed.

} export interface Response extends

interface Response

ClientResponse {}          

interface ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

export type Fetch

type Fetch<T> = (args?: InferRequestType<T>, opt?: ClientRequestOptions) => Promise<ClientResponseOfEndpoint<InferEndpointType<T>>>

<T> = (          

(type parameter) T in type Fetch<T>

args?:

(parameter) args: InferRequestType<T> | undefined

InferRequestType

type InferRequestType<T> = T extends (args: infer R, options: any | undefined) => Promise<ClientResponse<unknown>> ? NonNullable<R> : never

<T>,          

(type parameter) T in type Fetch<T>

opt?:

(parameter) opt: ClientRequestOptions<unknown> | undefined

ClientRequestOptions          

type ClientRequestOptions<T = unknown> = { fetch?: typeof fetch | HonoRequest; webSocket?: (...args: ConstructorParameters<typeof WebSocket>) => WebSocket; init?: RequestInit; } & (keyof T extends never ? { headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>); } : { ...; })

) => Promise

interface Promise<T> Represents the completion of an asynchronous operation

<ClientResponseOfEndpoint

type ClientResponseOfEndpoint<T extends Endpoint = Endpoint> = T extends { output: infer O; outputFormat: infer F; status: infer S; } ? ClientResponse<O, S extends number ? S : never, F extends string ? F : never> : never

<InferEndpointType

type InferEndpointType<T> = T extends (args: infer R, options: any | undefined) => Promise<infer U> ? U extends ClientResponse<infer O, infer S extends number, infer F extends string> ? { ...; } extends Endpoint ? { ...; } : never : never : never

<T>>>          

(type parameter) T in type Fetch<T>

type InferEndpointType

type InferEndpointType<T> = T extends (args: infer R, options: any | undefined) => Promise<infer U> ? U extends ClientResponse<infer O, infer S extends number, infer F extends string> ? { ...; } extends Endpoint ? { ...; } : never : never : never

<T> =

(type parameter) T in type InferEndpointType<T>

T extends (          

(type parameter) T in type InferEndpointType<T>

args: infer

(parameter) args: R

R,          

(type parameter) R

// eslint-disable-next-line @typescript-eslint/no-explicit-any options: any | undefined          

(parameter) options: any

) => Promise

interface Promise<T> Represents the completion of an asynchronous operation

U>          

(type parameter) U

? U extends

(type parameter) U

ClientResponse

interface ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

O, infer

(type parameter) O

S, infer

(type parameter) S

F>          

(type parameter) F

? { input:

(property) input: NonNullable<R>

NonNullable

type NonNullable<T> = T & {} Exclude null and undefined from T

<R>;

(type parameter) R

output:

(property) output: O

O;

(type parameter) O

outputFormat:

(property) outputFormat: F extends string

F;

(type parameter) F

status:

(property) status: S extends number

S } extends

(type parameter) S

Endpoint          

(alias) type Endpoint = { input: any; output: any; outputFormat: ResponseFormat; status: StatusCode; } import Endpoint

? { input:

(property) input: NonNullable<R>

NonNullable

type NonNullable<T> = T & {} Exclude null and undefined from T

<R>;

(type parameter) R

output:

(property) output: O

O;

(type parameter) O

outputFormat:

(property) outputFormat: F extends string

F;

(type parameter) F

status:

(property) status: S extends number

S }          

(type parameter) S

: never : never : never export type InferResponseType

type InferResponseType<T, U extends StatusCode = StatusCode> = InferEndpointType<T> extends { output: infer O; status: infer S; } ? S extends U ? O : never : never

<T,

(type parameter) T in type InferResponseType<T, U extends StatusCode = StatusCode>

U extends

(type parameter) U in type InferResponseType<T, U extends StatusCode = StatusCode>

StatusCode =

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

StatusCode> =

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

InferResponseTypeFromEndpoint<          

type InferResponseTypeFromEndpoint<T extends Endpoint, U extends StatusCode> = T extends { output: infer O; status: infer S; } ? S extends U ? O : never : never

InferEndpointType

type InferEndpointType<T> = T extends (args: infer R, options: any | undefined) => Promise<infer U> ? U extends ClientResponse<infer O, infer S extends number, infer F extends string> ? { ...; } extends Endpoint ? { ...; } : never : never : never

<T>,          

(type parameter) T in type InferResponseType<T, U extends StatusCode = StatusCode>

U          

(type parameter) U in type InferResponseType<T, U extends StatusCode = StatusCode>

> type InferResponseTypeFromEndpoint

type InferResponseTypeFromEndpoint<T extends Endpoint, U extends StatusCode> = T extends { output: infer O; status: infer S; } ? S extends U ? O : never : never

<T extends

(type parameter) T in type InferResponseTypeFromEndpoint<T extends Endpoint, U extends StatusCode>

Endpoint,

(alias) type Endpoint = { input: any; output: any; outputFormat: ResponseFormat; status: StatusCode; } import Endpoint

U extends

(type parameter) U in type InferResponseTypeFromEndpoint<T extends Endpoint, U extends StatusCode>

StatusCode> =

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

T extends {          

(type parameter) T in type InferResponseTypeFromEndpoint<T extends Endpoint, U extends StatusCode>

output: infer

(property) output: O

O          

(type parameter) O

status: infer

(property) status: S

S          

(type parameter) S

} ? S extends

(type parameter) S

U          

(type parameter) U in type InferResponseTypeFromEndpoint<T extends Endpoint, U extends StatusCode>

? O          

(type parameter) O

: never : never export type InferRequestType

type InferRequestType<T> = T extends (args: infer R, options: any | undefined) => Promise<ClientResponse<unknown>> ? NonNullable<R> : never

<T> =

(type parameter) T in type InferRequestType<T>

T extends (          

(type parameter) T in type InferRequestType<T>

args: infer

(parameter) args: R

R,          

(type parameter) R

// eslint-disable-next-line @typescript-eslint/no-explicit-any options: any | undefined          

(parameter) options: any

) => Promise

interface Promise<T> Represents the completion of an asynchronous operation

<ClientResponse>          

interface ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

? NonNullable

type NonNullable<T> = T & {} Exclude null and undefined from T

<R>          

(type parameter) R

: never export type InferRequestOptionsType

type InferRequestOptionsType<T> = T extends (args: any, options: infer R) => Promise<ClientResponse<unknown>> ? NonNullable<R> : never

<T> =

(type parameter) T in type InferRequestOptionsType<T>

T extends (          

(type parameter) T in type InferRequestOptionsType<T>

// eslint-disable-next-line @typescript-eslint/no-explicit-any args: any,          

(parameter) args: any

options: infer

(parameter) options: R

R          

(type parameter) R

) => Promise

interface Promise<T> Represents the completion of an asynchronous operation

<ClientResponse>          

interface ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = string>

? NonNullable

type NonNullable<T> = T & {} Exclude null and undefined from T

<R>          

(type parameter) R

: never type PathToChain<          

type PathToChain<Path extends string, E extends Schema, Original extends string = Path> = Path extends `/${infer P}` ? PathToChain<P, E, Path> : Path extends `${infer P}/${infer R}` ? { [K in P]: PathToChain<R, E, Original>; } : { [K in Path extends "" ? "index" : Path]: ClientRequest<...>; }

Path extends string,          

(type parameter) Path in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

E extends

(type parameter) E in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

Schema,          

(alias) type Schema = { [Path: string]: { [Method: `$${Lowercase<string>}`]: Endpoint; }; } import Schema

Original extends string =

(type parameter) Original in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

Path          

(type parameter) Path in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

> = Path extends `/${infer

(type parameter) Path in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

P}`          

(type parameter) P

? PathToChain

type PathToChain<Path extends string, E extends Schema, Original extends string = Path> = Path extends `/${infer P}` ? PathToChain<P, E, Path> : Path extends `${infer P}/${infer R}` ? { [K in P]: PathToChain<R, E, Original>; } : { [K in Path extends "" ? "index" : Path]: ClientRequest<...>; }

<P,

(type parameter) P

E,

(type parameter) E in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

Path>          

(type parameter) Path in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

: Path extends `${infer

(type parameter) Path in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

P}/${infer

(type parameter) P

R}`          

(type parameter) R

? { [K in

(type parameter) K

P]:

(type parameter) P

PathToChain

type PathToChain<Path extends string, E extends Schema, Original extends string = Path> = Path extends `/${infer P}` ? PathToChain<P, E, Path> : Path extends `${infer P}/${infer R}` ? { [K in P]: PathToChain<R, E, Original>; } : { [K in Path extends "" ? "index" : Path]: ClientRequest<...>; }

<R,

(type parameter) R

E,

(type parameter) E in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

Original> }          

(type parameter) Original in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

: { [K in

(type parameter) K

Path extends '' ? 'index' :

(type parameter) Path in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

Path]:

(type parameter) Path in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

ClientRequest<          

type ClientRequest<S extends Schema> = { [M in keyof S]: S[M] extends Endpoint & { input: infer R; } ? R extends object ? HasRequiredKeys<R> extends true ? (args: R, options?: ClientRequestOptions) => Promise<ClientResponseOfEndpoint<S[M]>> : (args?: R, options?: ClientRequestOptions) => Promise<ClientResponseOfEndpoint<S[M]>> : never : never; } & { ...; } & (S["$get"] extends { ...; } ? S["$get"] extends { ...; } ? { ...; } : {} : {})

E extends

(type parameter) E in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

Record ?

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

E

(type parameter) E in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

[Original] : never          

(type parameter) Original in type PathToChain<Path extends string, E extends Schema, Original extends string = Path>

> } // eslint-disable-next-line @typescript-eslint/no-explicit-any export type Client

type Client<T> = T extends Hono<any, infer S extends Schema, any> ? S extends Record<infer K extends string | number | symbol, Schema> ? K extends string ? PathToChain<...> : never : never : never

<T> =

(type parameter) T in type Client<T>

T extends

(type parameter) T in type Client<T>

Hono

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

S, any>          

(type parameter) S

? S extends

(type parameter) S

Record

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

K,

(type parameter) K

Schema>          

(alias) type Schema = { [Path: string]: { [Method: `$${Lowercase<string>}`]: Endpoint; }; } import Schema

? K extends string          

(type parameter) K

? PathToChain

type PathToChain<Path extends string, E extends Schema, Original extends string = Path> = Path extends `/${infer P}` ? PathToChain<P, E, Path> : Path extends `${infer P}/${infer R}` ? { [K in P]: PathToChain<R, E, Original>; } : { [K in Path extends "" ? "index" : Path]: ClientRequest<...>; }

<K,

(type parameter) K

S>          

(type parameter) S

: never : never : never export type Callback =

type Callback = (opts: CallbackOptions) => unknown

(opts:

(parameter) opts: CallbackOptions

CallbackOptions) => unknown          

interface CallbackOptions

interface CallbackOptions {          

interface CallbackOptions

path: string[]          

(property) CallbackOptions.path: string[]

// eslint-disable-next-line @typescript-eslint/no-explicit-any args: any[]          

(property) CallbackOptions.args: any[]

} export type ObjectType

type ObjectType<T = unknown> = { [key: string]: T; }

<T = unknown> = {          

(type parameter) T in type ObjectType<T = unknown>

[key: string]:

(parameter) key: string

T          

(type parameter) T in type ObjectType<T = unknown>

}
src/client/utils.test.ts
            
                import {
                  deepMerge,
                  mergePath,
                  removeIndexString,
                  replaceUrlParam,
                  replaceUrlProtocol,
                } from './utils'
                
                describe('mergePath', () => {
                  it('Should merge paths correctly', () => {
                    expect(mergePath('http://localhost', '/api')).toBe('http://localhost/api')          

(alias) mergePath(base: string, path: string): string import mergePath

expect(mergePath('http://localhost/', '/api')).toBe('http://localhost/api')          

(alias) mergePath(base: string, path: string): string import mergePath

expect(mergePath('http://localhost', 'api')).toBe('http://localhost/api')          

(alias) mergePath(base: string, path: string): string import mergePath

expect(mergePath('http://localhost/', 'api')).toBe('http://localhost/api')          

(alias) mergePath(base: string, path: string): string import mergePath

expect(mergePath('http://localhost/', '/')).toBe('http://localhost/')          

(alias) mergePath(base: string, path: string): string import mergePath

}) }) describe('replaceUrlParams', () => { it('Should replace correctly', () => { const url = 'http://localhost/posts/:postId/comments/:commentId'          

const url: "http://localhost/posts/:postId/comments/:commentId"

const params = {          

const params: { postId: string; commentId: string; }

postId: '123',          

(property) postId: string

commentId: '456',          

(property) commentId: string

} const replacedUrl =

const replacedUrl: string

replaceUrlParam

(alias) replaceUrlParam(urlString: string, params: Record<string, string | undefined>): string import replaceUrlParam

(url,

const url: "http://localhost/posts/:postId/comments/:commentId"

params)          

const params: { postId: string; commentId: string; }

expect(replacedUrl).toBe('http://localhost/posts/123/comments/456')          

const replacedUrl: string

}) it('Should replace correctly when there is regex pattern', () => { const url = 'http://localhost/posts/:postId{[abc]+}/comments/:commentId{[0-9]+}'          

const url: "http://localhost/posts/:postId{[abc]+}/comments/:commentId{[0-9]+}"

const params = {          

const params: { postId: string; commentId: string; }

postId: 'abc',          

(property) postId: string

commentId: '456',          

(property) commentId: string

} const replacedUrl =

const replacedUrl: string

replaceUrlParam

(alias) replaceUrlParam(urlString: string, params: Record<string, string | undefined>): string import replaceUrlParam

(url,

const url: "http://localhost/posts/:postId{[abc]+}/comments/:commentId{[0-9]+}"

params)          

const params: { postId: string; commentId: string; }

expect(replacedUrl).toBe('http://localhost/posts/abc/comments/456')          

const replacedUrl: string

}) it('Should replace correctly when there is regex pattern with length limit', () => { const url = 'http://localhost/year/:year{[1-9]{1}[0-9]{3}}/month/:month{[0-9]{2}}'          

const url: "http://localhost/year/:year{[1-9]{1}[0-9]{3}}/month/:month{[0-9]{2}}"

const params = {          

const params: { year: string; month: string; }

year: '2024',          

(property) year: string

month: '2',          

(property) month: string

} const replacedUrl =

const replacedUrl: string

replaceUrlParam

(alias) replaceUrlParam(urlString: string, params: Record<string, string | undefined>): string import replaceUrlParam

(url,

const url: "http://localhost/year/:year{[1-9]{1}[0-9]{3}}/month/:month{[0-9]{2}}"

params)          

const params: { year: string; month: string; }

expect(replacedUrl).toBe('http://localhost/year/2024/month/2')          

const replacedUrl: string

}) it('Should replace correctly when it has optional parameters', () => { const url = 'http://localhost/something/:firstId/:secondId/:version?'          

const url: "http://localhost/something/:firstId/:secondId/:version?"

const params = {          

const params: { firstId: string; secondId: string; version: undefined; }

firstId: '123',          

(property) firstId: string

secondId: '456',          

(property) secondId: string

version: undefined,          

(property) version: undefined

} const replacedUrl =

const replacedUrl: string

replaceUrlParam

(alias) replaceUrlParam(urlString: string, params: Record<string, string | undefined>): string import replaceUrlParam

(url,

const url: "http://localhost/something/:firstId/:secondId/:version?"

params)          

const params: { firstId: string; secondId: string; version: undefined; }

expect(replacedUrl).toBe('http://localhost/something/123/456')          

const replacedUrl: string

}) }) describe('replaceUrlProtocol', () => { it('Should replace http to ws', () => { const url = 'http://localhost'          

const url: "http://localhost"

const newUrl =

const newUrl: string

replaceUrlProtocol

(alias) replaceUrlProtocol(urlString: string, protocol: "ws" | "http"): string import replaceUrlProtocol

(url, 'ws')          

const url: "http://localhost"

expect(newUrl).toBe('ws://localhost')          

const newUrl: string

}) it('Should replace https to wss', () => { const url = 'https://localhost'          

const url: "https://localhost"

const newUrl =

const newUrl: string

replaceUrlProtocol

(alias) replaceUrlProtocol(urlString: string, protocol: "ws" | "http"): string import replaceUrlProtocol

(url, 'ws')          

const url: "https://localhost"

expect(newUrl).toBe('wss://localhost')          

const newUrl: string

}) it('Should replace ws to http', () => { const url = 'ws://localhost'          

const url: "ws://localhost"

const newUrl =

const newUrl: string

replaceUrlProtocol

(alias) replaceUrlProtocol(urlString: string, protocol: "ws" | "http"): string import replaceUrlProtocol

(url, 'http')          

const url: "ws://localhost"

expect(newUrl).toBe('http://localhost')          

const newUrl: string

}) it('Should replace wss to https', () => { const url = 'wss://localhost'          

const url: "wss://localhost"

const newUrl =

const newUrl: string

replaceUrlProtocol

(alias) replaceUrlProtocol(urlString: string, protocol: "ws" | "http"): string import replaceUrlProtocol

(url, 'http')          

const url: "wss://localhost"

expect(newUrl).toBe('https://localhost')          

const newUrl: string

}) }) describe('removeIndexString', () => { it('Should remove last `/index` string', () => { let url = 'http://localhost/index'          

let url: string

let newUrl =

let newUrl: string

removeIndexString

(alias) removeIndexString(urlSting: string): string import removeIndexString

(url)          

let url: string

expect(newUrl).toBe('http://localhost/')          

let newUrl: string

url = '/index'          

let url: string

newUrl =

let newUrl: string

removeIndexString

(alias) removeIndexString(urlSting: string): string import removeIndexString

(url)          

let url: string

expect(newUrl).toBe('')          

let newUrl: string

url = '/sub/index'          

let url: string

newUrl =

let newUrl: string

removeIndexString

(alias) removeIndexString(urlSting: string): string import removeIndexString

(url)          

let url: string

expect(newUrl).toBe('/sub')          

let newUrl: string

url = '/subindex'          

let url: string

newUrl =

let newUrl: string

removeIndexString

(alias) removeIndexString(urlSting: string): string import removeIndexString

(url)          

let url: string

expect(newUrl).toBe('/subindex')          

let newUrl: string

}) }) describe('deepMerge', () => { it('should return the source object if the target object is not an object', () => { const target = null          

const target: null

const source = 'not an object' as unknown as

const source: Record<string, unknown>

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

const result =

const result: null

deepMerge

(alias) deepMerge<null>(target: null, source: Record<string, unknown>): null import deepMerge

(target,

const target: null

source)          

const source: Record<string, unknown>

expect(result).toEqual

const result: null

(source)          

const source: Record<string, unknown>

}) it('should merge two objects with object properties', () => { expect( deepMerge(          

(alias) deepMerge<{ headers: { hono: string; }; timeout: number; params: {}; }>(target: { headers: { hono: string; }; timeout: number; params: {}; }, source: Record<string, unknown>): { headers: { hono: string; }; timeout: number; params: {}; } import deepMerge

{ headers: {

(property) headers: { hono: string; }

hono: '1' },

(property) hono: string

timeout: 2,

(property) timeout: number

params: {} },          

(property) params: {}

{ headers: {

(property) headers: { hono: string; demo: number; }

hono: '2',

(property) hono: string

demo: 2 },

(property) demo: number

params: undefined }          

(property) params: undefined

) ).toStrictEqual({ params: undefined,          

(property) params: undefined

headers: {

(property) headers: { hono: string; demo: number; }

hono: '2',

(property) hono: string

demo: 2 },          

(property) demo: number

timeout: 2,          

(property) timeout: number

}) }) })
src/client/utils.ts
            
                import type { ObjectType } from './types'
                
                export const mergePath = 

const mergePath: (base: string, path: string) => string

(base: string,

(parameter) base: string

path: string) => {          

(parameter) path: string

base =

(parameter) base: string

base

(parameter) base: string

.replace(/\/+$/, '')          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

base =

(parameter) base: string

base + '/'          

(parameter) base: string

path =

(parameter) path: string

path

(parameter) path: string

.replace(/^\/+/, '')          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

return base +

(parameter) base: string

path          

(parameter) path: string

} export const replaceUrlParam =

const replaceUrlParam: (urlString: string, params: Record<string, string | undefined>) => string

(urlString: string,

(parameter) urlString: string

params:

(parameter) params: Record<string, string | undefined>

Record) => {          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

for (const [k,

const k: string

v] of

const v: string | undefined

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string | undefined>(o: { [s: string]: string | undefined; } | ArrayLike<string | undefined>): [string, string | undefined][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(params)) {          

(parameter) params: Record<string, string | undefined>

const reg = new

const reg: RegExp

RegExp('/:' +

var RegExp: RegExpConstructor new (pattern: RegExp | string, flags?: string) => RegExp (+2 overloads)

k + '(?:{[^/]+})?\\??')          

const k: string

urlString =

(parameter) urlString: string

urlString

(parameter) urlString: string

.replace

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

(reg,

const reg: RegExp

v ? `/$

const v: string | undefined

{v}` : '')          

const v: string

} return urlString          

(parameter) urlString: string

} export const replaceUrlProtocol =

const replaceUrlProtocol: (urlString: string, protocol: "ws" | "http") => string

(urlString: string,

(parameter) urlString: string

protocol: 'ws' | 'http') => {          

(parameter) protocol: "ws" | "http"

switch (protocol) {          

(parameter) protocol: "ws" | "http"

case 'ws': return urlString

(parameter) urlString: string

.replace(/^http/, 'ws')          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

case 'http': return urlString

(parameter) urlString: string

.replace(/^ws/, 'http')          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

} } export const removeIndexString =

const removeIndexString: (urlSting: string) => string

(urlSting: string) => {          

(parameter) urlSting: string

if (/^https?:\/\/[^\/]+?\/index$/.test

(method) RegExp.test(string: string): boolean Returns a Boolean value that indicates whether or not a pattern exists in a searched string.

@param string — String on which to perform the search.

(urlSting)) {          

(parameter) urlSting: string

return urlSting

(parameter) urlSting: string

.replace(/\/index$/, '/')          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

} return urlSting

(parameter) urlSting: string

.replace(/\/index$/, '')          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

} function isObject

function isObject(item: unknown): item is ObjectType

(item: unknown):

(parameter) item: unknown

item is

(parameter) item: unknown

ObjectType {          

(alias) type ObjectType<T = unknown> = { [key: string]: T; } import ObjectType

return typeof item === 'object' &&

(parameter) item: unknown

item !== null &&

(parameter) item: object | null

!Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(item)          

(parameter) item: object

} export function deepMerge

function deepMerge<T>(target: T, source: Record<string, unknown>): T

<T>

(type parameter) T in deepMerge<T>(target: T, source: Record<string, unknown>): T

(target:

(parameter) target: T

T,

(type parameter) T in deepMerge<T>(target: T, source: Record<string, unknown>): T

source:

(parameter) source: Record<string, unknown>

Record):

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

T {          

(type parameter) T in deepMerge<T>(target: T, source: Record<string, unknown>): T

if (!isObject

function isObject(item: unknown): item is ObjectType

(target) &&

(parameter) target: T

!isObject

function isObject(item: unknown): item is ObjectType

(source)) {          

(parameter) source: Record<string, unknown>

return source as

(parameter) source: never

T          

(type parameter) T in deepMerge<T>(target: T, source: Record<string, unknown>): T

} const merged = { ..

const merged: ObjectType<T>

.target } as

(parameter) target: T

ObjectType

(alias) type ObjectType<T = unknown> = { [key: string]: T; } import ObjectType

<T>          

(type parameter) T in deepMerge<T>(target: T, source: Record<string, unknown>): T

for (const key in

const key: string

source) {          

(parameter) source: Record<string, unknown>

const value =

const value: unknown

source

(parameter) source: Record<string, unknown>

[key]          

const key: string

if (isObject

function isObject(item: unknown): item is ObjectType

(merged

const merged: ObjectType<T>

[key]) &&

const key: string

isObject

function isObject(item: unknown): item is ObjectType

(value)) {          

const value: unknown

merged

const merged: ObjectType<T>

[key] =

const key: string

deepMerge

function deepMerge<T>(target: T, source: Record<string, unknown>): T

(merged

const merged: ObjectType<T>

[key],

const key: string

value)          

const value: ObjectType

} else { merged

const merged: ObjectType<T>

[key] =

const key: string

value as

const value: unknown

T[keyof

(type parameter) T in deepMerge<T>(target: T, source: Record<string, unknown>): T

T] &

(type parameter) T in deepMerge<T>(target: T, source: Record<string, unknown>): T

T          

(type parameter) T in deepMerge<T>(target: T, source: Record<string, unknown>): T

} } return merged as

const merged: ObjectType<T>

T          

(type parameter) T in deepMerge<T>(target: T, source: Record<string, unknown>): T

}
src/compose.test.ts
            
                import { compose } from './compose'
                import { Context } from './context'
                import type { Params } from './router'
                
                type C = {          

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

req:

(property) req: Record<string, string>

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

res:

(property) res: Record<string, string>

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

finalized: boolean          

(property) finalized: boolean

} type MiddlewareTuple = [

type MiddlewareTuple = [[Function, unknown], Params]

[Function, unknown],

interface Function Creates a new function.

Params]          

(alias) type Params = { [x: string]: string; } import Params Type representing a map of parameters.

class ExpectedError extends

class ExpectedError

Error {}          

var Error: ErrorConstructor

function buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(fn:

(parameter) fn: Function

Function,

interface Function Creates a new function.

params?:

(parameter) params: Params | undefined

Params):

(alias) type Params = { [x: string]: string; } import Params Type representing a map of parameters.

MiddlewareTuple {          

type MiddlewareTuple = [[Function, unknown], Params]

return [[fn, undefined],

(parameter) fn: Function

params || {}]          

(parameter) params: Params | undefined

} describe('compose', () => { const middleware:

const middleware: MiddlewareTuple[]

MiddlewareTuple[] = []          

type MiddlewareTuple = [[Function, unknown], Params]

const a = async

const a: (c: C, next: Function) => Promise<void>

(c:

(parameter) c: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

c

(parameter) c: C

.req['log'] = 'log'          

(property) req: Record<string, string>

await next()          

(parameter) next: Function

} const b = async

const b: (c: C, next: Function) => Promise<void>

(c:

(parameter) c: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

await next()          

(parameter) next: Function

c

(parameter) c: C

.res['headers'] = 'custom-header'          

(property) res: Record<string, string>

} const c = async

const c: (c: C, next: Function) => Promise<void>

(c:

(parameter) c: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

c

(parameter) c: C

.req['xxx'] = 'yyy'          

(property) req: Record<string, string>

await next()          

(parameter) next: Function

c

(parameter) c: C

.res['zzz'] =

(property) res: Record<string, string>

c

(parameter) c: C

.req['xxx']          

(property) req: Record<string, string>

} const handler = async

const handler: (c: C, next: Function) => Promise<void>

(c:

(parameter) c: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

c

(parameter) c: C

.req['log'] = `$

(property) req: Record<string, string>

{c

(parameter) c: C

.req.log} message`          

(property) req: Record<string, string>

await next()          

(parameter) next: Function

c

(parameter) c: C

.res = {

(property) res: Record<string, string>

message: 'new response' }          

(property) message: string

} middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(a))          

const a: (c: C, next: Function) => Promise<void>

middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(b))          

const b: (c: C, next: Function) => Promise<void>

middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(c))          

const c: (c: C, next: Function) => Promise<void>

middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(handler))          

const handler: (c: C, next: Function) => Promise<void>

it('Request', async () => { const c:

const c: C

C = {

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

req: {},

(property) req: Record<string, string>

res: {},

(property) res: Record<string, string>

finalized: false }          

(property) finalized: boolean

const composed =

const composed: (context: C, next?: Function) => Promise<C>

compose

(alias) compose<C, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: C, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<C>

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

(middleware)          

const middleware: MiddlewareTuple[]

const context = await

const context: C

composed

const composed: (context: C, next?: Function) => Promise<C>

(c)          

const c: C

expect(context

const context: C

.req['log']).not.toBeNull()          

(property) req: Record<string, string>

expect(context

const context: C

.req['log']).toBe('log message')          

(property) req: Record<string, string>

expect(context

const context: C

.req['xxx']).toBe('yyy')          

(property) req: Record<string, string>

}) it('Response', async () => { const c:

const c: C

C = {

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

req: {},

(property) req: Record<string, string>

res: {},

(property) res: Record<string, string>

finalized: false }          

(property) finalized: boolean

const composed =

const composed: (context: C, next?: Function) => Promise<C>

compose

(alias) compose<C, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: C, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<C>

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

(middleware)          

const middleware: MiddlewareTuple[]

const context = await

const context: C

composed

const composed: (context: C, next?: Function) => Promise<C>

(c)          

const c: C

expect(context

const context: C

.res['headers']).not.toBeNull()          

(property) res: Record<string, string>

expect(context

const context: C

.res['headers']).toBe('custom-header')          

(property) res: Record<string, string>

expect(context

const context: C

.res['message']).toBe('new response')          

(property) res: Record<string, string>

expect(context

const context: C

.res['zzz']).toBe('yyy')          

(property) res: Record<string, string>

}) }) describe('compose with returning a promise, non-async function', () => { const handlers:

const handlers: MiddlewareTuple[]

MiddlewareTuple[] = [          

type MiddlewareTuple = [[Function, unknown], Params]

buildMiddlewareTuple(() => {          

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

return new Promise(

var Promise: PromiseConstructor new <unknown>(executor: (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void) => Promise<unknown> Creates a new Promise.

@param executor
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

(resolve) =>          

(parameter) resolve: (value: unknown) => void

setTimeout(() => {          

function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number MDN Reference

resolve({

(parameter) resolve: (value: unknown) => void

message: 'new response' })          

(property) message: string

}, 1) ) }), ] it('Response', async () => { const c:

const c: C

C = {

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

req: {},

(property) req: Record<string, string>

res: {},

(property) res: Record<string, string>

finalized: false }          

(property) finalized: boolean

const composed =

const composed: (context: C, next?: Function) => Promise<C>

compose

(alias) compose<C, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: C, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<C>

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

(handlers)          

const handlers: MiddlewareTuple[]

const context = await

const context: C

composed

const composed: (context: C, next?: Function) => Promise<C>

(c)          

const c: C

expect(context

const context: C

.res['message']).toBe('new response')          

(property) res: Record<string, string>

}) }) describe('Handler and middlewares', () => { const middleware:

const middleware: MiddlewareTuple[]

MiddlewareTuple[] = []          

type MiddlewareTuple = [[Function, unknown], Params]

const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const c:

const c: Context<any, any, {}>

Context = new

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

const mHandlerFoo = async

const mHandlerFoo: (c: Context, next: Function) => Promise<void>

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

c

(parameter) c: Context<any, any, {}>

.req

(property) Context<any, any, {}>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.raw

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.append('x-header-foo', 'foo')          

(method) Headers.append(name: string, value: string): void MDN Reference

await next()          

(parameter) next: Function

} const mHandlerBar = async

const mHandlerBar: (c: Context, next: Function) => Promise<void>

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

await next()          

(parameter) next: Function

c

(parameter) c: Context<any, any, {}>

.header('x-header-bar', 'bar')          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

} const handler =

const handler: (c: Context) => Response & TypedResponse<string, StatusCode, "text">

(c:

(parameter) c: Context<any, any, {}>

Context) => {          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

const foo =

const foo: string

c

(parameter) c: Context<any, any, {}>

.req

(property) Context<any, any, {}>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.header('x-header-foo') || ''          

(method) HonoRequest<any, unknown>.header(name: string): string | undefined (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

return c

(parameter) c: Context<any, any, {}>

.text

(property) Context<any, any, {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(foo)          

const foo: string

} middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(mHandlerFoo))          

const mHandlerFoo: (c: Context, next: Function) => Promise<void>

middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(mHandlerBar))          

const mHandlerBar: (c: Context, next: Function) => Promise<void>

middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(handler))          

const handler: (c: Context) => Response & TypedResponse<string, StatusCode, "text">

it('Should return 200 Response', async () => { const composed =

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

compose

(alias) compose<Context<any, any, {}>, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: Context<...>, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<Context>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

(middleware)          

const middleware: MiddlewareTuple[]

const context = await

const context: Context<any, any, {}>

composed

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

(c)          

const c: Context<any, any, {}>

const res =

const res: Response

context

const context: Context<any, any, {}>

.res          

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('foo')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-header-bar')).toBe('bar')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('compose with Context - 200 success', () => { const middleware:

const middleware: MiddlewareTuple[]

MiddlewareTuple[] = []          

type MiddlewareTuple = [[Function, unknown], Params]

const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const c:

const c: Context<any, any, {}>

Context = new

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

const handler =

const handler: (c: Context) => Response & TypedResponse<"Hello", StatusCode, "text">

(c:

(parameter) c: Context<any, any, {}>

Context) => {          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

return c

(parameter) c: Context<any, any, {}>

.text('Hello')          

(property) Context<any, any, {}>.text: TextRespond <"Hello", StatusCode>(text: "Hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

} const mHandler = async

const mHandler: (_c: Context, next: Function) => Promise<void>

(_c:

(parameter) _c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

await next()          

(parameter) next: Function

} middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(handler))          

const handler: (c: Context) => Response & TypedResponse<"Hello", StatusCode, "text">

middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(mHandler))          

const mHandler: (_c: Context, next: Function) => Promise<void>

it('Should return 200 Response', async () => { const composed =

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

compose

(alias) compose<Context<any, any, {}>, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: Context<...>, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<Context>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

(middleware)          

const middleware: MiddlewareTuple[]

const context = await

const context: Context<any, any, {}>

composed

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

(c)          

const c: Context<any, any, {}>

expect(context

const context: Context<any, any, {}>

.res).not.toBeNull()          

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

expect(context

const context: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await context

const context: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.text()).toBe('Hello')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('compose with Context - 404 not found', () => { const middleware:

const middleware: MiddlewareTuple[]

MiddlewareTuple[] = []          

type MiddlewareTuple = [[Function, unknown], Params]

const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const onNotFound =

const onNotFound: (c: Context) => Response & TypedResponse<"onNotFound", 404, "text">

(c:

(parameter) c: Context<any, any, {}>

Context) => {          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

return c

(parameter) c: Context<any, any, {}>

.text('onNotFound', 404)          

(property) Context<any, any, {}>.text: TextRespond <"onNotFound", 404>(text: "onNotFound", status?: 404 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"onNotFound", 404, "text"> (+1 overload)

} const onNotFoundAsync = async

const onNotFoundAsync: (c: Context) => Promise<Response & TypedResponse<"onNotFoundAsync", 404, "text">>

(c:

(parameter) c: Context<any, any, {}>

Context) => {          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

return c

(parameter) c: Context<any, any, {}>

.text('onNotFoundAsync', 404)          

(property) Context<any, any, {}>.text: TextRespond <"onNotFoundAsync", 404>(text: "onNotFoundAsync", status?: 404 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"onNotFoundAsync", 404, "text"> (+1 overload)

} const mHandler = async

const mHandler: (_c: Context, next: Function) => Promise<void>

(_c:

(parameter) _c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

await next()          

(parameter) next: Function

} middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(mHandler))          

const mHandler: (_c: Context, next: Function) => Promise<void>

it('Should return 404 Response', async () => { const c:

const c: Context<any, any, {}>

Context = new

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

const composed =

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

compose

(alias) compose<Context<any, any, {}>, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: Context<...>, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<Context>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

(middleware, undefined,

const middleware: MiddlewareTuple[]

onNotFound)          

const onNotFound: (c: Context) => Response & TypedResponse<"onNotFound", 404, "text">

const context = await

const context: Context<any, any, {}>

composed

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

(c)          

const c: Context<any, any, {}>

expect(context

const context: Context<any, any, {}>

.res).not.toBeNull()          

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

expect(context

const context: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(await context

const context: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.text()).toBe('onNotFound')          

(method) Body.text(): Promise<string> MDN Reference

expect(context

const context: Context<any, any, {}>

.finalized).toBe(true)          

(property) Context<any, any, {}>.finalized: boolean

}) it('Should return 404 Response - async handler', async () => { const c:

const c: Context<any, any, {}>

Context = new

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

const composed =

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

compose

(alias) compose<Context<any, any, {}>, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: Context<...>, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<Context>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

(middleware, undefined,

const middleware: MiddlewareTuple[]

onNotFoundAsync)          

const onNotFoundAsync: (c: Context) => Promise<Response & TypedResponse<"onNotFoundAsync", 404, "text">>

const context = await

const context: Context<any, any, {}>

composed

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

(c)          

const c: Context<any, any, {}>

expect(context

const context: Context<any, any, {}>

.res).not.toBeNull()          

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

expect(context

const context: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(await context

const context: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.text()).toBe('onNotFoundAsync')          

(method) Body.text(): Promise<string> MDN Reference

expect(context

const context: Context<any, any, {}>

.finalized).toBe(true)          

(property) Context<any, any, {}>.finalized: boolean

}) }) describe('compose with Context - 401 not authorized', () => { const middleware:

const middleware: MiddlewareTuple[]

MiddlewareTuple[] = []          

type MiddlewareTuple = [[Function, unknown], Params]

const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const c:

const c: Context<any, any, {}>

Context = new

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

const handler =

const handler: (c: Context) => Response & TypedResponse<"Hello", StatusCode, "text">

(c:

(parameter) c: Context<any, any, {}>

Context) => {          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

return c

(parameter) c: Context<any, any, {}>

.text('Hello')          

(property) Context<any, any, {}>.text: TextRespond <"Hello", StatusCode>(text: "Hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

} const mHandler = async

const mHandler: (c: Context, next: Function) => Promise<void>

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

await next()          

(parameter) next: Function

c

(parameter) c: Context<any, any, {}>

.res = new

(property) Context<any, any, {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

Response('Not authorized', {

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 401 })          

(property) ResponseInit.status?: number | undefined

} middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(mHandler))          

const mHandler: (c: Context, next: Function) => Promise<void>

middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(handler))          

const handler: (c: Context) => Response & TypedResponse<"Hello", StatusCode, "text">

it('Should return 401 Response', async () => { const composed =

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

compose

(alias) compose<Context<any, any, {}>, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: Context<...>, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<Context>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

(middleware)          

const middleware: MiddlewareTuple[]

const context = await

const context: Context<any, any, {}>

composed

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

(c)          

const c: Context<any, any, {}>

expect(context

const context: Context<any, any, {}>

.res).not.toBeNull()          

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

expect(context

const context: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.status).toBe(401)          

(property) Response.status: number MDN Reference

expect(await context

const context: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.text()).toBe('Not authorized')          

(method) Body.text(): Promise<string> MDN Reference

expect(context

const context: Context<any, any, {}>

.finalized).toBe(true)          

(property) Context<any, any, {}>.finalized: boolean

}) }) describe('compose with Context - next() below', () => { const middleware:

const middleware: MiddlewareTuple[]

MiddlewareTuple[] = []          

type MiddlewareTuple = [[Function, unknown], Params]

const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const c:

const c: Context<any, any, {}>

Context = new

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

const handler =

const handler: (c: Context) => Response & TypedResponse<string, StatusCode, "text">

(c:

(parameter) c: Context<any, any, {}>

Context) => {          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

const message =

const message: string

c

(parameter) c: Context<any, any, {}>

.req

(property) Context<any, any, {}>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.header('x-custom') || 'blank'          

(method) HonoRequest<any, unknown>.header(name: string): string | undefined (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

return c

(parameter) c: Context<any, any, {}>

.text

(property) Context<any, any, {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(message)          

const message: string

} const mHandler = async

const mHandler: (c: Context, next: Function) => Promise<void>

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

c

(parameter) c: Context<any, any, {}>

.req

(property) Context<any, any, {}>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.raw

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.append('x-custom', 'foo')          

(method) Headers.append(name: string, value: string): void MDN Reference

await next()          

(parameter) next: Function

} middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(mHandler))          

const mHandler: (c: Context, next: Function) => Promise<void>

middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(handler))          

const handler: (c: Context) => Response & TypedResponse<string, StatusCode, "text">

it('Should return 200 Response', async () => { const composed =

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

compose

(alias) compose<Context<any, any, {}>, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: Context<...>, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<Context>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

(middleware)          

const middleware: MiddlewareTuple[]

const context = await

const context: Context<any, any, {}>

composed

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

(c)          

const c: Context<any, any, {}>

expect(context

const context: Context<any, any, {}>

.res).not.toBeNull()          

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

expect(context

const context: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await context

const context: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.text()).toBe('foo')          

(method) Body.text(): Promise<string> MDN Reference

expect(context

const context: Context<any, any, {}>

.finalized).toBe(true)          

(property) Context<any, any, {}>.finalized: boolean

}) }) describe('compose with Context - 500 error', () => { const middleware:

const middleware: MiddlewareTuple[]

MiddlewareTuple[] = []          

type MiddlewareTuple = [[Function, unknown], Params]

const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const c:

const c: Context<any, any, {}>

Context = new

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

it('Error on handler', async () => { const handler = () => {          

const handler: () => never

throw new Error()          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

} const mHandler = async

const mHandler: (_c: Context, next: Function) => Promise<void>

(_c:

(parameter) _c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

await next()          

(parameter) next: Function

} middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(mHandler))          

const mHandler: (_c: Context, next: Function) => Promise<void>

middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(handler))          

const handler: () => never

const onNotFound =

const onNotFound: (c: Context) => Response & TypedResponse<"NotFound", 404, "text">

(c:

(parameter) c: Context<any, any, {}>

Context) =>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

c

(parameter) c: Context<any, any, {}>

.text('NotFound', 404)          

(property) Context<any, any, {}>.text: TextRespond <"NotFound", 404>(text: "NotFound", status?: 404 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"NotFound", 404, "text"> (+1 overload)

const onError =

const onError: (_error: Error, c: Context) => Response & TypedResponse<"onError", 500, "text">

(_error:

(parameter) _error: Error

Error,

interface Error

c:

(parameter) c: Context<any, any, {}>

Context) =>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

c

(parameter) c: Context<any, any, {}>

.text('onError', 500)          

(property) Context<any, any, {}>.text: TextRespond <"onError", 500>(text: "onError", status?: 500 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"onError", 500, "text"> (+1 overload)

const composed =

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

compose

(alias) compose<Context<any, any, {}>, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: Context<...>, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<Context>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

(middleware,

const middleware: MiddlewareTuple[]

onError,

const onError: (_error: Error, c: Context) => Response & TypedResponse<"onError", 500, "text">

onNotFound)          

const onNotFound: (c: Context) => Response & TypedResponse<"NotFound", 404, "text">

const context = await

const context: Context<any, any, {}>

composed

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

(c)          

const c: Context<any, any, {}>

expect(context

const context: Context<any, any, {}>

.res).not.toBeNull()          

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

expect(context

const context: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.status).toBe(500)          

(property) Response.status: number MDN Reference

expect(await context

const context: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.text()).toBe('onError')          

(method) Body.text(): Promise<string> MDN Reference

expect(context

const context: Context<any, any, {}>

.finalized).toBe(true)          

(property) Context<any, any, {}>.finalized: boolean

}) it('Error on handler - async', async () => { const handler = () => {          

const handler: () => never

throw new Error()          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

} middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(handler))          

const handler: () => never

const onError = async

const onError: (_error: Error, c: Context) => Promise<Response & TypedResponse<"onError", 500, "text">>

(_error:

(parameter) _error: Error

Error,

interface Error

c:

(parameter) c: Context<any, any, {}>

Context) =>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

c

(parameter) c: Context<any, any, {}>

.text('onError', 500)          

(property) Context<any, any, {}>.text: TextRespond <"onError", 500>(text: "onError", status?: 500 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"onError", 500, "text"> (+1 overload)

const composed =

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

compose

(alias) compose<Context<any, any, {}>, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: Context<...>, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<Context>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

(middleware,

const middleware: MiddlewareTuple[]

onError)          

const onError: (_error: Error, c: Context) => Promise<Response & TypedResponse<"onError", 500, "text">>

const context = await

const context: Context<any, any, {}>

composed

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

(c)          

const c: Context<any, any, {}>

expect(context

const context: Context<any, any, {}>

.res).not.toBeNull()          

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

expect(context

const context: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.status).toBe(500)          

(property) Response.status: number MDN Reference

expect(await context

const context: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.text()).toBe('onError')          

(method) Body.text(): Promise<string> MDN Reference

expect(context

const context: Context<any, any, {}>

.finalized).toBe(true)          

(property) Context<any, any, {}>.finalized: boolean

}) it('Run all the middlewares', async () => { const ctx:

const ctx: C

C = {

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

req: {},

(property) req: Record<string, string>

res: {},

(property) res: Record<string, string>

finalized: false }          

(property) finalized: boolean

const stack: number[] = []          

const stack: number[]

const middlewares = [          

const middlewares: MiddlewareTuple[]

async (_ctx:

(parameter) _ctx: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

stack

const stack: number[]

.push(0)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

await next()          

(parameter) next: Function

}, async (_ctx:

(parameter) _ctx: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

stack

const stack: number[]

.push(1)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

await next()          

(parameter) next: Function

}, async (_ctx:

(parameter) _ctx: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

stack

const stack: number[]

.push(2)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

await next()          

(parameter) next: Function

}, ].map(

(method) Array<(_ctx: C, next: Function) => Promise<void>>.map<MiddlewareTuple>(callbackfn: (value: (_ctx: C, next: Function) => Promise<void>, index: number, array: ((_ctx: C, next: Function) => Promise<void>)[]) => MiddlewareTuple, thisArg?: any): MiddlewareTuple[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(h) =>

(parameter) h: (_ctx: C, next: Function) => Promise<void>

buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(h))          

(parameter) h: (_ctx: C, next: Function) => Promise<void>

const composed =

const composed: (context: ComposeContext, next?: Function) => Promise<ComposeContext>

compose

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

(middlewares)          

const middlewares: MiddlewareTuple[]

await composed

const composed: (context: ComposeContext, next?: Function) => Promise<ComposeContext>

(ctx)          

const ctx: C

expect(stack).toEqual([0, 1, 2])          

const stack: number[]

}) }) describe('compose with Context - not finalized', () => { const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const c:

const c: Context<any, any, {}>

Context = new

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

const onNotFound =

const onNotFound: (c: Context) => Response & TypedResponse<"onNotFound", 404, "text">

(c:

(parameter) c: Context<any, any, {}>

Context) => {          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

return c

(parameter) c: Context<any, any, {}>

.text('onNotFound', 404)          

(property) Context<any, any, {}>.text: TextRespond <"onNotFound", 404>(text: "onNotFound", status?: 404 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"onNotFound", 404, "text"> (+1 overload)

} it('Should not be finalized - lack `next()`', async () => { const middleware:

const middleware: MiddlewareTuple[]

MiddlewareTuple[] = []          

type MiddlewareTuple = [[Function, unknown], Params]

const mHandler = async

const mHandler: (_c: Context, next: Function) => Promise<void>

(_c:

(parameter) _c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

await next()          

(parameter) next: Function

} const mHandler2 = async () => {}          

const mHandler2: () => Promise<void>

middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(mHandler))          

const mHandler: (_c: Context, next: Function) => Promise<void>

middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(mHandler2))          

const mHandler2: () => Promise<void>

const composed =

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

compose

(alias) compose<Context<any, any, {}>, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: Context<...>, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<Context>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

(middleware, undefined,

const middleware: MiddlewareTuple[]

onNotFound)          

const onNotFound: (c: Context) => Response & TypedResponse<"onNotFound", 404, "text">

const context = await

const context: Context<any, any, {}>

composed

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

(c)          

const c: Context<any, any, {}>

expect(context

const context: Context<any, any, {}>

.finalized).toBe(false)          

(property) Context<any, any, {}>.finalized: boolean

}) it('Should not be finalized - lack `return Response`', async () => { const middleware2:

const middleware2: MiddlewareTuple[]

MiddlewareTuple[] = []          

type MiddlewareTuple = [[Function, unknown], Params]

const mHandler3 = async

const mHandler3: (_c: Context, next: Function) => Promise<void>

(_c:

(parameter) _c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

await next()          

(parameter) next: Function

} const handler = async () => {}          

const handler: () => Promise<void>

middleware2

const middleware2: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(mHandler3))          

const mHandler3: (_c: Context, next: Function) => Promise<void>

middleware2

const middleware2: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(handler))          

const handler: () => Promise<void>

const composed =

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

compose

(alias) compose<Context<any, any, {}>, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: Context<...>, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<Context>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

(middleware2, undefined,

const middleware2: MiddlewareTuple[]

onNotFound)          

const onNotFound: (c: Context) => Response & TypedResponse<"onNotFound", 404, "text">

const context = await

const context: Context<any, any, {}>

composed

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

(c)          

const c: Context<any, any, {}>

expect(context

const context: Context<any, any, {}>

.finalized).toBe(false)          

(property) Context<any, any, {}>.finalized: boolean

}) }) describe('Compose', function () { it('should get executed order one by one', async () => { const arr: number[] = []          

const arr: number[]

const stack = []          

const stack: any[]

const called: boolean[] = []          

const called: boolean[]

stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_context:

(parameter) _context: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

called

const called: boolean[]

.push(true)          

(method) Array<boolean>.push(...items: boolean[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

arr

const arr: number[]

.push(1)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

await next()          

(parameter) next: Function

arr

const arr: number[]

.push(6)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

}) ) stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_context:

(parameter) _context: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

called

const called: boolean[]

.push(true)          

(method) Array<boolean>.push(...items: boolean[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

arr

const arr: number[]

.push(2)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

await next()          

(parameter) next: Function

arr

const arr: number[]

.push(5)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

}) ) stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_context:

(parameter) _context: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

called

const called: boolean[]

.push(true)          

(method) Array<boolean>.push(...items: boolean[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

arr

const arr: number[]

.push(3)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

await next()          

(parameter) next: Function

arr

const arr: number[]

.push(4)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

}) ) await compose

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

(stack)({

const stack: MiddlewareTuple[]

res: null,

(property) ComposeContext.res: unknown The result of the composition process. The type is unknown and should be specified based on the context where this interface is used.

finalized: false })          

(property) ComposeContext.finalized: boolean Indicates whether the composition process has been finalized.

expect(called).toEqual([true, true, true])          

const called: boolean[]

expect(arr).toEqual([1, 2, 3, 4, 5, 6])          

const arr: number[]

}) it('should not get executed if previous next() not triggered', async () => { const arr: number[] = []          

const arr: number[]

const stack = []          

const stack: any[]

const called: boolean[] = []          

const called: boolean[]

stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_context:

(parameter) _context: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

called

const called: boolean[]

.push(true)          

(method) Array<boolean>.push(...items: boolean[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

arr

const arr: number[]

.push(1)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

await next()          

(parameter) next: Function

arr

const arr: number[]

.push(6)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

}) ) stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async () => {          

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

called

const called: boolean[]

.push(true)          

(method) Array<boolean>.push(...items: boolean[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

arr

const arr: number[]

.push(2)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

}) ) stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_context:

(parameter) _context: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

called

const called: boolean[]

.push(true)          

(method) Array<boolean>.push(...items: boolean[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

arr

const arr: number[]

.push(3)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

await next()          

(parameter) next: Function

arr

const arr: number[]

.push(4)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

}) ) await compose

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

(stack)({

const stack: MiddlewareTuple[]

res: null,

(property) ComposeContext.res: unknown The result of the composition process. The type is unknown and should be specified based on the context where this interface is used.

finalized: false })          

(property) ComposeContext.finalized: boolean Indicates whether the composition process has been finalized.

expect(called).toEqual([true, true])          

const called: boolean[]

expect(arr).toEqual([1, 2, 6])          

const arr: number[]

}) it('should be able to be called twice', async () => { type C = {          

type C = { arr: number[]; }

arr: number[]          

(property) arr: number[]

} const stack = []          

const stack: any[]

stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(context:

(parameter) context: C

C,

type C = { arr: number[]; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

context

(parameter) context: C

.arr

(property) arr: number[]

.push(1)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

await next()          

(parameter) next: Function

context

(parameter) context: C

.arr

(property) arr: number[]

.push(6)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

}) ) stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(context:

(parameter) context: C

C,

type C = { arr: number[]; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

context

(parameter) context: C

.arr

(property) arr: number[]

.push(2)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

await next()          

(parameter) next: Function

context

(parameter) context: C

.arr

(property) arr: number[]

.push(5)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

}) ) stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(context:

(parameter) context: C

C,

type C = { arr: number[]; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

context

(parameter) context: C

.arr

(property) arr: number[]

.push(3)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

await next()          

(parameter) next: Function

context

(parameter) context: C

.arr

(property) arr: number[]

.push(4)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

}) ) const fn =

const fn: (context: ComposeContext, next?: Function) => Promise<ComposeContext>

compose

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

(stack)          

const stack: MiddlewareTuple[]

const ctx1 = {

const ctx1: { arr: number[]; res: null; finalized: boolean; }

arr: [] as number[],

(property) arr: number[]

res: null,

(property) res: null

finalized: false }          

(property) finalized: boolean

const ctx2 = {

const ctx2: { arr: number[]; res: null; finalized: boolean; }

arr: [] as number[],

(property) arr: number[]

res: null,

(property) res: null

finalized: false }          

(property) finalized: boolean

const out = [1, 2, 3, 4, 5, 6]          

const out: number[]

await fn

const fn: (context: ComposeContext, next?: Function) => Promise<ComposeContext>

(ctx1)          

const ctx1: { arr: number[]; res: null; finalized: boolean; }

expect(out).toEqual

const out: number[]

(ctx1

const ctx1: { arr: number[]; res: null; finalized: boolean; }

.arr)          

(property) arr: number[]

await fn

const fn: (context: ComposeContext, next?: Function) => Promise<ComposeContext>

(ctx2)          

const ctx2: { arr: number[]; res: null; finalized: boolean; }

expect(out).toEqual

const out: number[]

(ctx2

const ctx2: { arr: number[]; res: null; finalized: boolean; }

.arr)          

(property) arr: number[]

}) it('should create next functions that return a Promise', async () => { const stack = []          

const stack: any[]

const arr: unknown[] = []          

const arr: unknown[]

for (let i = 0;

let i: number

i < 5;

let i: number

i++) {          

let i: number

stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_context:

(parameter) _context: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

arr

const arr: unknown[]

.push

(method) Array<unknown>.push(...items: unknown[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(next())          

(parameter) next: Function

}) ) } await compose

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

(stack)({

const stack: MiddlewareTuple[]

res: null,

(property) ComposeContext.res: unknown The result of the composition process. The type is unknown and should be specified based on the context where this interface is used.

finalized: false })          

(property) ComposeContext.finalized: boolean Indicates whether the composition process has been finalized.

for (const next of

const next: unknown

arr) {          

const arr: unknown[]

const isPromise = !!

const isPromise: boolean

(next as {

const next: unknown

then?:

(property) then?: Function | undefined

Function })?

interface Function Creates a new function.

.then          

(property) then?: Function | undefined

expect(isPromise).toBe(true)          

const isPromise: boolean

} }) it('should work with 0 middleware', async () => { await compose([])({

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

res: null,

(property) ComposeContext.res: unknown The result of the composition process. The type is unknown and should be specified based on the context where this interface is used.

finalized: false })          

(property) ComposeContext.finalized: boolean Indicates whether the composition process has been finalized.

}) it('should work when yielding at the end of the stack', async () => { const stack = []          

const stack: any[]

let called = false          

let called: boolean

stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_ctx:

(parameter) _ctx: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

await next()          

(parameter) next: Function

called = true          

let called: boolean

}) ) await compose

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

(stack)({

const stack: MiddlewareTuple[]

res: null,

(property) ComposeContext.res: unknown The result of the composition process. The type is unknown and should be specified based on the context where this interface is used.

finalized: false })          

(property) ComposeContext.finalized: boolean Indicates whether the composition process has been finalized.

expect(called).toBe(true)          

let called: false

}) it('should reject on errors in middleware', async () => { const stack = []          

const stack: any[]

stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(() => {          

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

throw new ExpectedError()          

constructor ExpectedError(message?: string, options?: ErrorOptions): ExpectedError (+1 overload)

}) ) try { await compose

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

(stack)({

const stack: MiddlewareTuple[]

res: null,

(property) ComposeContext.res: unknown The result of the composition process. The type is unknown and should be specified based on the context where this interface is used.

finalized: false })          

(property) ComposeContext.finalized: boolean Indicates whether the composition process has been finalized.

throw new Error('promise was not rejected')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

} catch (e) {          

(local var) e: unknown

expect(e).toBeInstanceOf

(local var) e: unknown

(ExpectedError)          

class ExpectedError

} }) it('should keep the context', async () => { const ctx = {

const ctx: { res: null; finalized: boolean; }

res: null,

(property) res: null

finalized: false }          

(property) finalized: boolean

const stack = []          

const stack: any[]

stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(ctx2:

(parameter) ctx2: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

await next()          

(parameter) next: Function

expect(ctx2).toEqual

(parameter) ctx2: C

(ctx)          

const ctx: { res: null; finalized: boolean; }

}) ) stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(ctx2:

(parameter) ctx2: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

await next()          

(parameter) next: Function

expect(ctx2).toEqual

(parameter) ctx2: C

(ctx)          

const ctx: { res: null; finalized: boolean; }

}) ) stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(ctx2:

(parameter) ctx2: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

await next()          

(parameter) next: Function

expect(ctx2).toEqual

(parameter) ctx2: C

(ctx)          

const ctx: { res: null; finalized: boolean; }

}) ) await compose

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

(stack)

const stack: MiddlewareTuple[]

(ctx)          

const ctx: { res: null; finalized: boolean; }

}) it('should catch downstream errors', async () => { const arr: number[] = []          

const arr: number[]

const stack = []          

const stack: any[]

stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_ctx:

(parameter) _ctx: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

arr

const arr: number[]

.push(1)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

try { arr

const arr: number[]

.push(6)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

await next()          

(parameter) next: Function

arr

const arr: number[]

.push(7)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

} catch { arr

const arr: number[]

.push(2)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

} arr

const arr: number[]

.push(3)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

}) ) stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async () => {          

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

arr

const arr: number[]

.push(4)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

throw new Error()          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) ) await compose

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

(stack)({

const stack: MiddlewareTuple[]

res: null,

(property) ComposeContext.res: unknown The result of the composition process. The type is unknown and should be specified based on the context where this interface is used.

finalized: false })          

(property) ComposeContext.finalized: boolean Indicates whether the composition process has been finalized.

expect(arr).toEqual([1, 6, 4, 2, 3])          

const arr: number[]

}) it('should compose w/ next', async () => { let called = false          

let called: boolean

await compose([])({

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

res: null,

(property) ComposeContext.res: unknown The result of the composition process. The type is unknown and should be specified based on the context where this interface is used.

finalized: false }, async () => {          

(property) ComposeContext.finalized: boolean Indicates whether the composition process has been finalized.

called = true          

let called: boolean

}) expect(called).toBe(true)          

let called: false

}) it('should handle errors in wrapped non-async functions', async () => { const stack = []          

const stack: any[]

stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(function () {          

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

throw new ExpectedError()          

constructor ExpectedError(message?: string, options?: ErrorOptions): ExpectedError (+1 overload)

}) ) try { await compose

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

(stack)({

const stack: MiddlewareTuple[]

res: null,

(property) ComposeContext.res: unknown The result of the composition process. The type is unknown and should be specified based on the context where this interface is used.

finalized: false })          

(property) ComposeContext.finalized: boolean Indicates whether the composition process has been finalized.

throw new Error('promise was not rejected')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

} catch (e) {          

(local var) e: unknown

expect(e).toBeInstanceOf

(local var) e: unknown

(ExpectedError)          

class ExpectedError

} }) // https://github.com/koajs/compose/pull/27#issuecomment-143109739 it('should compose w/ other compositions', async () => { const called: number[] = []          

const called: number[]

await compose([          

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

buildMiddlewareTuple(          

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

compose([          

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

buildMiddlewareTuple(

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_ctx:

(parameter) _ctx: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

called

const called: number[]

.push(1)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

return next()          

(parameter) next: Function

}), buildMiddlewareTuple(

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_ctx:

(parameter) _ctx: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

called

const called: number[]

.push(2)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

return next()          

(parameter) next: Function

}), ]) ), buildMiddlewareTuple(

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_ctx:

(parameter) _ctx: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

called

const called: number[]

.push(3)          

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

return next()          

(parameter) next: Function

}), ])({ res: null,

(property) ComposeContext.res: unknown The result of the composition process. The type is unknown and should be specified based on the context where this interface is used.

finalized: false })          

(property) ComposeContext.finalized: boolean Indicates whether the composition process has been finalized.

expect(called).toEqual([1, 2, 3])          

const called: number[]

}) it('should throw if next() is called multiple times', async () => { try { await compose([          

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_ctx:

(parameter) _ctx: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

await next()          

(parameter) next: Function

await next()          

(parameter) next: Function

}), ])({ res: null,

(property) ComposeContext.res: unknown The result of the composition process. The type is unknown and should be specified based on the context where this interface is used.

finalized: false })          

(property) ComposeContext.finalized: boolean Indicates whether the composition process has been finalized.

throw new Error('boom')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

} catch (err) {          

(local var) err: unknown

expect(err instanceof

(local var) err: unknown

Error && /multiple times/

var Error: ErrorConstructor

.test

(method) RegExp.test(string: string): boolean Returns a Boolean value that indicates whether or not a pattern exists in a searched string.

@param string — String on which to perform the search.

(err

(local var) err: Error

.message)).toBe(true)          

(property) Error.message: string

} }) it('should return a valid middleware', async () => { let val = 0          

let val: number

await compose([          

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

buildMiddlewareTuple(          

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

compose([          

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

buildMiddlewareTuple(

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_ctx:

(parameter) _ctx: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

val++          

let val: number

return next()          

(parameter) next: Function

}), buildMiddlewareTuple(

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_ctx:

(parameter) _ctx: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

val++          

let val: number

return next()          

(parameter) next: Function

}), ]) ), buildMiddlewareTuple(

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(_ctx:

(parameter) _ctx: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

val++          

let val: number

return next()          

(parameter) next: Function

}), ])({ res: null,

(property) ComposeContext.res: unknown The result of the composition process. The type is unknown and should be specified based on the context where this interface is used.

finalized: false })          

(property) ComposeContext.finalized: boolean Indicates whether the composition process has been finalized.

expect(val).toEqual(3)          

let val: number

}) it('should return last return value', async () => { type C = {          

type C = { val: number; finalized: boolean; res: unknown; }

val: number          

(property) val: number

finalized: boolean          

(property) finalized: boolean

res: unknown          

(property) res: unknown

} const stack = []          

const stack: any[]

stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(ctx:

(parameter) ctx: C

C,

type C = { val: number; finalized: boolean; res: unknown; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

await next()          

(parameter) next: Function

expect(ctx

(parameter) ctx: C

.val).toEqual(2)          

(property) val: number

ctx

(parameter) ctx: C

.val = 1          

(property) val: number

}) ) stack

const stack: any[]

.push(          

(method) Array<any>.push(...items: any[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

buildMiddlewareTuple(async

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(ctx:

(parameter) ctx: C

C,

type C = { val: number; finalized: boolean; res: unknown; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

ctx

(parameter) ctx: C

.val = 2          

(property) val: number

await next()          

(parameter) next: Function

expect(ctx

(parameter) ctx: C

.val).toEqual(2)          

(property) val: number

}) ) const res = await

const res: C

compose

(alias) compose<C, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: C, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<C>

type C = { val: number; finalized: boolean; res: unknown; }

(stack)({

const stack: MiddlewareTuple[]

val: 0,

(property) val: number

res: null,

(property) res: unknown

finalized: false })          

(property) finalized: boolean

expect(res

const res: C

.val).toEqual(1)          

(property) val: number

}) it('should not affect the original middleware array', () => { const middleware:

const middleware: MiddlewareTuple[]

MiddlewareTuple[] = []          

type MiddlewareTuple = [[Function, unknown], Params]

const fn1 =

const fn1: (_ctx: C, next: Function) => any

(_ctx:

(parameter) _ctx: C

C,

type C = { req: Record<string, string>; res: Record<string, string>; finalized: boolean; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

return next()          

(parameter) next: Function

} middleware

const middleware: MiddlewareTuple[]

.push

(method) Array<MiddlewareTuple>.push(...items: MiddlewareTuple[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(buildMiddlewareTuple

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(fn1))          

const fn1: (_ctx: C, next: Function) => any

for (const [[fn]] of

const fn: Function

middleware) {          

const middleware: MiddlewareTuple[]

expect(fn).toEqual

const fn: Function

(fn1)          

const fn1: (_ctx: C, next: Function) => any

} compose

(alias) compose<ComposeContext, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: ComposeContext, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

(middleware)          

const middleware: MiddlewareTuple[]

for (const [[fn]] of

const fn: Function

middleware) {          

const middleware: MiddlewareTuple[]

expect(fn).toEqual

const fn: Function

(fn1)          

const fn1: (_ctx: C, next: Function) => any

} }) it('should not get stuck on the passed in next', async () => { type C = {          

type C = { middleware: number; next: number; finalized: boolean; res: unknown; }

middleware: number          

(property) middleware: number

next: number          

(property) next: number

finalized: boolean          

(property) finalized: boolean

res: unknown          

(property) res: unknown

} const middleware = [          

const middleware: MiddlewareTuple[]

buildMiddlewareTuple(

function buildMiddlewareTuple(fn: Function, params?: Params): MiddlewareTuple

(ctx:

(parameter) ctx: C

C,

type C = { middleware: number; next: number; finalized: boolean; res: unknown; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

ctx

(parameter) ctx: C

.middleware++          

(property) middleware: number

return next()          

(parameter) next: Function

}), ] const ctx = {          

const ctx: { middleware: number; next: number; finalized: boolean; res: null; }

middleware: 0,          

(property) middleware: number

next: 0,          

(property) next: number

finalized: false,          

(property) finalized: boolean

res: null,          

(property) res: null

} await compose

(alias) compose<C, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: C, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<C>

type C = { middleware: number; next: number; finalized: boolean; res: unknown; }

(middleware)

const middleware: MiddlewareTuple[]

(ctx,

const ctx: { middleware: number; next: number; finalized: boolean; res: null; }

(ctx:

(parameter) ctx: C

C,

type C = { middleware: number; next: number; finalized: boolean; res: unknown; }

next:

(parameter) next: Function

Function) => {          

interface Function Creates a new function.

ctx

(parameter) ctx: C

.next++          

(property) next: number

return next()          

(parameter) next: Function

}) expect(ctx

const ctx: { middleware: number; next: number; finalized: boolean; res: null; }

.middleware).toEqual(1)          

(property) middleware: number

expect(ctx

const ctx: { middleware: number; next: number; finalized: boolean; res: null; }

.next).toEqual(1)          

(property) next: number

}) })
src/compose.ts
            
                import { Context } from './context'
                import type { ParamIndexMap, Params } from './router'
                import type { Env, ErrorHandler, NotFoundHandler } from './types'
                
                /**
                 * Interface representing the context for a composition operation.
                 */
                interface ComposeContext {          

interface ComposeContext Interface representing the context for a composition operation.

/** * Indicates whether the composition process has been finalized. */ finalized: boolean          

(property) ComposeContext.finalized: boolean Indicates whether the composition process has been finalized.

/** * The result of the composition process. The type is unknown and should be * specified based on the context where this interface is used. */ res: unknown          

(property) ComposeContext.res: unknown The result of the composition process. The type is unknown and should be specified based on the context where this interface is used.

} /** * Compose middleware functions into a single function based on `koa-compose` package. * * @template C - The context type. * @template E - The environment type. * * @param {[[Function, unknown], ParamIndexMap | Params][]} middleware - An array of middleware functions and their corresponding parameters. * @param {ErrorHandler} [onError] - An optional error handler function. * @param {NotFoundHandler} [onNotFound] - An optional not-found handler function. * * @returns {(context: C, next?: Function) => Promise} - A composed middleware function. */ export const compose =

const compose: <C extends ComposeContext, E extends Env = Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<E>, onNotFound?: NotFoundHandler<E>) => ((context: C, next?: Function) => Promise<C>) Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<C extends

(type parameter) C in <C extends ComposeContext, E extends Env = Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<E>, onNotFound?: NotFoundHandler<E>): ((context: C, next?: Function) => Promise<C>) - The context type.

@template C — The context type.

ComposeContext,

interface ComposeContext Interface representing the context for a composition operation.

E extends

(type parameter) E in <C extends ComposeContext, E extends Env = Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<E>, onNotFound?: NotFoundHandler<E>): ((context: C, next?: Function) => Promise<C>) - The environment type.

@template E — The environment type.

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env>(          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

middleware: [

(parameter) middleware: [[Function, unknown], ParamIndexMap | Params][] - An array of middleware functions and their corresponding parameters.

@param middleware — An array of middleware functions and their corresponding parameters.

[Function, unknown],

interface Function Creates a new function.

ParamIndexMap |

(alias) type ParamIndexMap = { [x: string]: number; } import ParamIndexMap Type representing a map of parameter indices.

Params][],          

(alias) type Params = { [x: string]: string; } import Params Type representing a map of parameters.

onError?:

(parameter) onError: ErrorHandler<E> | undefined - An optional error handler function.

@param onError — An optional error handler function.

ErrorHandler

(alias) type ErrorHandler<E extends Env = any> = (err: Error | HTTPResponseError, c: Context<E>) => Response | Promise<Response> import ErrorHandler

<E>,          

(type parameter) E in <C extends ComposeContext, E extends Env = Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<E>, onNotFound?: NotFoundHandler<E>): ((context: C, next?: Function) => Promise<C>) - The environment type.

@template E — The environment type.

onNotFound?:

(parameter) onNotFound: NotFoundHandler<E> | undefined - An optional not-found handler function.

@param onNotFound — An optional not-found handler function.

NotFoundHandler

(alias) type NotFoundHandler<E extends Env = any> = (c: Context<E>) => Response | Promise<Response> import NotFoundHandler

<E>          

(type parameter) E in <C extends ComposeContext, E extends Env = Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<E>, onNotFound?: NotFoundHandler<E>): ((context: C, next?: Function) => Promise<C>) - The environment type.

@template E — The environment type.

): ((context:

(parameter) context: C extends ComposeContext

C,

(type parameter) C in <C extends ComposeContext, E extends Env = Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<E>, onNotFound?: NotFoundHandler<E>): ((context: C, next?: Function) => Promise<C>) - The context type.

@template C — The context type.

next?:

(parameter) next: Function | undefined

Function) =>

interface Function Creates a new function.

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<C>) => {          

(type parameter) C in <C extends ComposeContext, E extends Env = Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<E>, onNotFound?: NotFoundHandler<E>): ((context: C, next?: Function) => Promise<C>) - The context type.

@template C — The context type.

return (context,

(parameter) context: C extends ComposeContext

next) => {          

(parameter) next: Function | undefined

let index = -1          

let index: number

return dispatch(0)          

(local function) dispatch(i: number): Promise<C> Dispatch the middleware functions.

@param i — The current index in the middleware array.

@returns — - A promise that resolves to the context.

/** * Dispatch the middleware functions. * * @param {number} i - The current index in the middleware array. * * @returns {Promise} - A promise that resolves to the context. */ async function dispatch

(local function) dispatch(i: number): Promise<C> Dispatch the middleware functions.

@param i — The current index in the middleware array.

@returns — - A promise that resolves to the context.

(i: number):

(parameter) i: number - The current index in the middleware array.

@param i — The current index in the middleware array.

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<C> {          

(type parameter) C in <C extends ComposeContext, E extends Env = Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<E>, onNotFound?: NotFoundHandler<E>): ((context: C, next?: Function) => Promise<C>) - The context type.

@template C — The context type.

if (i <=

(parameter) i: number - The current index in the middleware array.

@param i — The current index in the middleware array.

index) {          

let index: number

throw new Error('next() called multiple times')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

} index =

let index: number

i          

(parameter) i: number - The current index in the middleware array.

@param i — The current index in the middleware array.

let res          

let res: any

let isError = false          

let isError: boolean

let handler          

let handler: any

if (middleware

(parameter) middleware: [[Function, unknown], ParamIndexMap | Params][] - An array of middleware functions and their corresponding parameters.

@param middleware — An array of middleware functions and their corresponding parameters.

[i]) {          

(parameter) i: number - The current index in the middleware array.

@param i — The current index in the middleware array.

handler =

let handler: any

middleware

(parameter) middleware: [[Function, unknown], ParamIndexMap | Params][] - An array of middleware functions and their corresponding parameters.

@param middleware — An array of middleware functions and their corresponding parameters.

[i][0][0]          

(parameter) i: number - The current index in the middleware array.

@param i — The current index in the middleware array.

if (context instanceof

(parameter) context: C extends ComposeContext

Context) {          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

context

(parameter) context: C & Context<any, any, any>

.req

(property) Context<any, any, any>.req: HonoRequest<any, any> .req is the instance of HonoRequest.

.routeIndex =

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.routeIndex: number

i          

(parameter) i: number - The current index in the middleware array.

@param i — The current index in the middleware array.

} } else { handler =

let handler: any

(i ===

(parameter) i: number - The current index in the middleware array.

@param i — The current index in the middleware array.

middleware

(parameter) middleware: [[Function, unknown], ParamIndexMap | Params][] - An array of middleware functions and their corresponding parameters.

@param middleware — An array of middleware functions and their corresponding parameters.

.length &&

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

next) || undefined          

(parameter) next: Function | undefined

} if (!handler) {          

let handler: Function | undefined

if (context instanceof

(parameter) context: C extends ComposeContext

Context &&

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

context

(parameter) context: C & Context<any, any, any>

.finalized === false &&

(property) finalized: boolean Indicates whether the composition process has been finalized.

onNotFound) {          

(parameter) onNotFound: NotFoundHandler<E> | undefined - An optional not-found handler function.

@param onNotFound — An optional not-found handler function.

res = await

let res: any

onNotFound

(parameter) onNotFound: (c: Context<E, any, {}>) => Response | Promise<Response> - An optional not-found handler function.

@param onNotFound — An optional not-found handler function.

(context)          

(parameter) context: C & Context<any, any, any>

} } else { try { res = await

let res: any

handler

let handler: Function

(context, () => {          

(parameter) context: C extends ComposeContext

return dispatch

(local function) dispatch(i: number): Promise<C> Dispatch the middleware functions.

@param i — The current index in the middleware array.

@returns — - A promise that resolves to the context.

(i + 1)          

(parameter) i: number - The current index in the middleware array.

@param i — The current index in the middleware array.

}) } catch (err) {          

(local var) err: unknown

if (err instanceof

(local var) err: unknown

Error &&

var Error: ErrorConstructor

context instanceof

(parameter) context: C extends ComposeContext

Context &&

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

onError) {          

(parameter) onError: ErrorHandler<E> | undefined - An optional error handler function.

@param onError — An optional error handler function.

context

(parameter) context: C & Context<any, any, any>

.error =

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.error: Error | undefined .error can get the error object from the middleware if the Handler throws an error.

@see — https://hono.dev/docs/api/context#error

@example
ts app.use('*', async (c, next) => { await next() if (c.error) { // do something... } })

err          

(local var) err: Error

res = await

let res: any

onError

(parameter) onError: (err: Error | HTTPResponseError, c: Context<E, any, {}>) => Response | Promise<Response> - An optional error handler function.

@param onError — An optional error handler function.

(err,

(local var) err: Error

context)          

(parameter) context: C & Context<any, any, any>

isError = true          

let isError: boolean

} else { throw err          

(local var) err: unknown

} } } if (res &&

let res: any

(context

(parameter) context: C extends ComposeContext

.finalized === false ||

(property) ComposeContext.finalized: boolean Indicates whether the composition process has been finalized.

isError)) {          

let isError: boolean

context

(parameter) context: C extends ComposeContext

.res =

(property) ComposeContext.res: unknown The result of the composition process. The type is unknown and should be specified based on the context where this interface is used.

res          

let res: any

} return context          

(parameter) context: C extends ComposeContext

} } }
src/context.test.ts
            
                import { Context } from './context'
                import { setCookie } from './helper/cookie'
                
                const makeResponseHeaderImmutable = 

const makeResponseHeaderImmutable: (res: Response) => Response

(res:

(parameter) res: Response

Response) => {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.defineProperty

(method) ObjectConstructor.defineProperty<Response>(o: Response, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>): Response Adds a property to an object, or modifies attributes of an existing property.

@param o — Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object.

@param p — The property name.

@param attributes — Descriptor for the property. It can be for a data property or an accessor property.

(res, 'headers', {          

(parameter) res: Response

value: new

(property) PropertyDescriptor.value?: any

Proxy

var Proxy: ProxyConstructor new <Headers>(target: Headers, handler: ProxyHandler<Headers>) => Headers Creates a Proxy object. The Proxy object allows you to create an object that can be used in place of the original object, but which may redefine fundamental Object operations like getting, setting, and defining properties. Proxy objects are commonly used to log property accesses, validate, format, or sanitize inputs.

@param target — A target object to wrap with Proxy.

@param handler — An object whose properties define the behavior of Proxy when an operation is attempted on it.

(res

(parameter) res: Response

.headers, {          

(property) Response.headers: Headers MDN Reference

set

(method) ProxyHandler<Headers>.set?(target: Headers, p: string | symbol, newValue: any, receiver: any): boolean A trap for setting a property value.

@param target — The original object which is being proxied.

@param p — The name or Symbol of the property to set.

@param receiver — The object to which the assignment was originally directed.

@returns — A Boolean indicating whether or not the property was set.

(target,

(parameter) target: Headers

prop,

(parameter) prop: string | symbol

value) {          

(parameter) value: any

if (prop === 'set') {          

(parameter) prop: string | symbol

throw new TypeError('Cannot modify headers: Headers are immutable')          

var TypeError: TypeErrorConstructor new (message?: string, options?: ErrorOptions) => TypeError (+3 overloads)

} return Reflect

namespace Reflect

.set

function Reflect.set<Headers, string | symbol>(target: Headers, propertyKey: string | symbol, value: any, receiver?: any): boolean (+1 overload) Sets the property of target, equivalent to target[propertyKey] = value when receiver === target.

@param target — Object that contains the property on itself or in its prototype chain.

@param propertyKey — Name of the property.

@param receiver
The reference to use as the this value in the setter function, if target[propertyKey] is an accessor property.

(target,

(parameter) target: Headers

prop,

(parameter) prop: string | symbol

value)          

(parameter) value: any

}, get

(method) ProxyHandler<Headers>.get?(target: Headers, p: string | symbol, receiver: any): any A trap for getting a property value.

@param target — The original object which is being proxied.

@param p — The name or Symbol of the property to get.

@param receiver — The proxy or an object that inherits from the proxy.

(target,

(parameter) target: Headers

prop) {          

(parameter) prop: string | symbol

if (prop === 'set') {          

(parameter) prop: string | symbol

return function () { throw new TypeError('Cannot modify headers: Headers are immutable')          

var TypeError: TypeErrorConstructor new (message?: string, options?: ErrorOptions) => TypeError (+3 overloads)

} } return Reflect

namespace Reflect

.get

function Reflect.get<Headers, string | symbol>(target: Headers, propertyKey: string | symbol, receiver?: unknown): any Gets the property of target, equivalent to target[propertyKey] when receiver === target.

@param target — Object that contains the property on itself or in its prototype chain.

@param propertyKey — The property name.

@param receiver
The reference to use as the this value in the getter function, if target[propertyKey] is an accessor property.

(target,

(parameter) target: Headers

prop)          

(parameter) prop: string | symbol

}, }), writable: false,          

(property) PropertyDescriptor.writable?: boolean | undefined

}) return res          

(parameter) res: Response

} describe('Context', () => { const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

let c:

let c: Context<any, any, {}>

Context          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

beforeEach(() => { c = new

let c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

}) it('c.text()', async () => { const res =

const res: Response & TypedResponse<"text in c", 201, "text">

c

let c: Context<any, any, {}>

.text('text in c', 201, { 'X-Custom': 'Message' })          

(property) Context<any, any, {}>.text: TextRespond <"text in c", 201>(text: "text in c", status?: 201 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"text in c", 201, "text"> (+1 overload)

expect(res

const res: Response & TypedResponse<"text in c", 201, "text">

.status).toBe(201)          

(property) Response.status: number MDN Reference

expect(res

const res: Response & TypedResponse<"text in c", 201, "text">

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toMatch(/^text\/plain/)          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response & TypedResponse<"text in c", 201, "text">

.text()).toBe('text in c')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response & TypedResponse<"text in c", 201, "text">

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Custom')).toBe('Message')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('c.text() with c.status()', async () => { c

let c: Context<any, any, {}>

.status(404)          

(property) Context<any, any, {}>.status: (status: StatusCode) => void

const res =

const res: Response & TypedResponse<"not found", StatusCode, "text">

c

let c: Context<any, any, {}>

.text('not found')          

(property) Context<any, any, {}>.text: TextRespond <"not found", StatusCode>(text: "not found", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

expect(res

const res: Response & TypedResponse<"not found", StatusCode, "text">

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(res

const res: Response & TypedResponse<"not found", StatusCode, "text">

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toMatch(/^text\/plain/)          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response & TypedResponse<"not found", StatusCode, "text">

.text()).toBe('not found')          

(method) Body.text(): Promise<string> MDN Reference

}) it('c.json()', async () => { const res =

const res: JSONRespondReturn<{ message: string; }, 201>

c

let c: Context<any, any, {}>

.json({

(property) Context<any, any, {}>.json: JSONRespond <{ message: string; }, 201>(object: { message: string; }, status?: 201 | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ message: string; }, 201> (+1 overload)

message: 'Hello' }, 201, { 'X-Custom': 'Message' })          

(property) message: string

expect(res

const res: JSONRespondReturn<{ message: string; }, 201>

.status).toBe(201)          

(property) Response.status: number MDN Reference

expect(res

const res: JSONRespondReturn<{ message: string; }, 201>

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toMatch('application/json; charset=UTF-8')          

(method) Headers.get(name: string): string | null MDN Reference

const text = await

const text: string

res

const res: JSONRespondReturn<{ message: string; }, 201>

.text()          

(method) Body.text(): Promise<string> MDN Reference

expect(text).toBe('{"message":"Hello"}')          

const text: string

expect(res

const res: JSONRespondReturn<{ message: string; }, 201>

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Custom')).toBe('Message')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('c.html()', async () => { const res:

const res: Response

Response =

interface Response This Fetch API interface represents the response to a request.

MDN Reference

c

let c: Context<any, any, {}>

.html('

Hello! Hono!

', 201, { 'X-Custom': 'Message' })          

(property) Context<any, any, {}>.html: HTMLRespond <"<h1>Hello! Hono!</h1>">(html: "<h1>Hello! Hono!</h1>", status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

expect(res

const res: Response

.status).toBe(201)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toMatch('text/html')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('

Hello! Hono!

')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Custom')).toBe('Message')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('c.html() with async', async () => { const resPromise:

const resPromise: Promise<Response>

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response> =

interface Response This Fetch API interface represents the response to a request.

MDN Reference

c

let c: Context<any, any, {}>

.html(          

(property) Context<any, any, {}>.html: HTMLRespond <Promise<string>>(html: Promise<string>, status?: StatusCode, headers?: HeaderRecord) => Promise<Response> (+1 overload)

new Promise(

var Promise: PromiseConstructor new <string>(executor: (resolve: (value: string | PromiseLike<string>) => void, reject: (reason?: any) => void) => void) => Promise<string> Creates a new Promise.

@param executor
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

(resolve) =>

(parameter) resolve: (value: string | PromiseLike<string>) => void

setTimeout(() =>

function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number MDN Reference

resolve('

Hello! Hono!

'), 0)),          

(parameter) resolve: (value: string | PromiseLike<string>) => void

201, { 'X-Custom': 'Message', } ) const res = await

const res: Response

resPromise          

const resPromise: Promise<Response>

expect(res

const res: Response

.status).toBe(201)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toMatch('text/html')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('

Hello! Hono!

')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Custom')).toBe('Message')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('c.redirect()', async () => { let res =

let res: Response & TypedResponse<undefined, 302, "redirect">

c

let c: Context<any, any, {}>

.redirect('/destination')          

(property) Context<any, any, {}>.redirect: <302>(location: string, status?: 302 | undefined) => Response & TypedResponse<undefined, 302, "redirect"> .redirect() can Redirect, default status code is 302.

@see — https://hono.dev/docs/api/context#redirect

@example
ts app.get('/redirect', (c) => { return c.redirect('/') }) app.get('/redirect-permanently', (c) => { return c.redirect('/', 301) })

expect(res

let res: Response & TypedResponse<undefined, 302, "redirect">

.status).toBe(302)          

(property) Response.status: number MDN Reference

expect(res

let res: Response & TypedResponse<undefined, 302, "redirect">

.headers

(property) Response.headers: Headers MDN Reference

.get('Location')).toBe('/destination')          

(method) Headers.get(name: string): string | null MDN Reference

res =

let res: Response & TypedResponse<undefined, 302, "redirect">

c

let c: Context<any, any, {}>

.redirect('https://example.com/destination')          

(property) Context<any, any, {}>.redirect: <302>(location: string, status?: 302 | undefined) => Response & TypedResponse<undefined, 302, "redirect"> .redirect() can Redirect, default status code is 302.

@see — https://hono.dev/docs/api/context#redirect

@example
ts app.get('/redirect', (c) => { return c.redirect('/') }) app.get('/redirect-permanently', (c) => { return c.redirect('/', 301) })

expect(res

let res: Response & TypedResponse<undefined, 302, "redirect">

.status).toBe(302)          

(property) Response.status: number MDN Reference

expect(res

let res: Response & TypedResponse<undefined, 302, "redirect">

.headers

(property) Response.headers: Headers MDN Reference

.get('Location')).toBe('https://example.com/destination')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('c.header()', async () => { c

let c: Context<any, any, {}>

.header('X-Foo', 'Bar')          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

const res =

const res: Response

c

let c: Context<any, any, {}>

.body('Hi')          

(property) Context<any, any, {}>.body: BodyRespond (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

const foo =

const foo: string | null

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Foo')          

(method) Headers.get(name: string): string | null MDN Reference

expect(foo).toBe('Bar')          

const foo: string | null

}) it('c.header() - append', async () => { c

let c: Context<any, any, {}>

.header('X-Foo', 'Bar')          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

let c: Context<any, any, {}>

.header('X-Foo', 'Buzz', {

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

append: true })          

(property) SetHeadersOptions.append?: boolean | undefined

const res =

const res: Response

c

let c: Context<any, any, {}>

.body('Hi')          

(property) Context<any, any, {}>.body: BodyRespond (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

const foo =

const foo: string | null

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Foo')          

(method) Headers.get(name: string): string | null MDN Reference

expect(foo).toBe('Bar, Buzz')          

const foo: string | null

}) it('c.set() and c.get()', async () => { expect(c

let c: Context<any, any, {}>

.get('foo')).toBe(undefined)          

(property) Context<any, any, {}>.get: Get <"foo">(key: "foo") => any (+1 overload)

c

let c: Context<any, any, {}>

.set('foo', 'bar')          

(property) Context<any, any, {}>.set: Set <"foo">(key: "foo", value: any) => void (+1 overload)

expect(c

let c: Context<any, any, {}>

.get('foo')).toBe('bar')          

(property) Context<any, any, {}>.get: Get <"foo">(key: "foo") => any (+1 overload)

expect(c

let c: Context<any, any, {}>

.get('foo2')).toBe(undefined)          

(property) Context<any, any, {}>.get: Get <"foo2">(key: "foo2") => any (+1 overload)

}) it('c.var', async () => { expect(c

let c: Context<any, any, {}>

.var.foo).toBe(undefined)          

(property) Context<any, any, {}>.var: Readonly<ContextVariableMap & Record<string, any>> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

c

let c: Context<any, any, {}>

.set('foo', 'bar')          

(property) Context<any, any, {}>.set: Set <"foo">(key: "foo", value: any) => void (+1 overload)

expect(c

let c: Context<any, any, {}>

.var.foo).toBe('bar')          

(property) Context<any, any, {}>.var: Readonly<ContextVariableMap & Record<string, any>> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

expect(c

let c: Context<any, any, {}>

.var.foo2).toBe(undefined)          

(property) Context<any, any, {}>.var: Readonly<ContextVariableMap & Record<string, any>> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

}) it('c.notFound()', async () => { const res =

const res: Response | Promise<Response>

c

let c: Context<any, any, {}>

.notFound()          

(property) Context<any, any, {}>.notFound: () => Response | Promise<Response> .notFound() can return the Not Found Response.

@see — https://hono.dev/docs/api/context#notfound

@example
ts app.get('/notfound', (c) => { return c.notFound() })

expect(res).instanceOf

const res: Response | Promise<Response>

(Response)          

var Response: { new (body?: BodyInit | null, init?: ResponseInit): Response; prototype: Response; error(): Response; json(data: any, init?: ResponseInit): Response; redirect(url: string | URL, status?: number): Response; } This Fetch API interface represents the response to a request.

MDN Reference

}) it('Should set headers if already this.#headers is created by `c.header()`', async () => { c

let c: Context<any, any, {}>

.header('X-Foo', 'Bar')          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

let c: Context<any, any, {}>

.header('X-Foo', 'Buzz', {

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

append: true })          

(property) SetHeadersOptions.append?: boolean | undefined

const res =

const res: Response

c

let c: Context<any, any, {}>

.body('Hi', {          

(property) Context<any, any, {}>.body: BodyRespond (data: Data | null, init?: ResponseInit) => Response (+1 overload)

headers: {          

(property) ResponseInit.headers?: ResponseHeadersInit | undefined

'X-Message': 'Hi', }, }) expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Foo')).toBe('Bar, Buzz')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Message')).toBe('Hi')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('c.header() - append, c.html()', async () => { c

let c: Context<any, any, {}>

.header('X-Foo', 'Bar', {

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

append: true })          

(property) SetHeadersOptions.append?: boolean | undefined

const res = await

const res: Response

c

let c: Context<any, any, {}>

.html('

This rendered fine

')          

(property) Context<any, any, {}>.html: HTMLRespond <"<h1>This rendered fine</h1>">(html: "<h1>This rendered fine</h1>", status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('content-type')).toMatch(/^text\/html/)          

(method) Headers.get(name: string): string | null MDN Reference

}) it('c.header() - clear the header', async () => { c

let c: Context<any, any, {}>

.header('X-Foo', 'Bar')          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

let c: Context<any, any, {}>

.header('X-Foo', undefined)          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

let c: Context<any, any, {}>

.header('X-Foo2', 'Bar')          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

let res =

let res: Response

c

let c: Context<any, any, {}>

.body('Hi')          

(property) Context<any, any, {}>.body: BodyRespond (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

expect(res

let res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Foo')).toBe(null)          

(method) Headers.get(name: string): string | null MDN Reference

c

let c: Context<any, any, {}>

.header('X-Foo2', undefined)          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

res =

let res: Response

c

let c: Context<any, any, {}>

.res          

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

expect(res

let res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Foo2')).toBe(null)          

(method) Headers.get(name: string): string | null MDN Reference

}) it('c.header() - clear the header when append is true', async () => { c

let c: Context<any, any, {}>

.header('X-Foo', 'Bar', {

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

append: true })          

(property) SetHeadersOptions.append?: boolean | undefined

c

let c: Context<any, any, {}>

.header('X-Foo', undefined)          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

expect(c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Foo')).toBe(null)          

(method) Headers.get(name: string): string | null MDN Reference

}) it('c.body() - multiple header', async () => { const res =

const res: Response

c

let c: Context<any, any, {}>

.body('Hi', 200, {          

(property) Context<any, any, {}>.body: BodyRespond (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

'X-Foo': ['Bar', 'Buzz'], }) const foo =

const foo: string | null

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Foo')          

(method) Headers.get(name: string): string | null MDN Reference

expect(foo).toBe('Bar, Buzz')          

const foo: string | null

}) it('c.status()', async () => { c

let c: Context<any, any, {}>

.status(201)          

(property) Context<any, any, {}>.status: (status: StatusCode) => void

const res =

const res: Response

c

let c: Context<any, any, {}>

.body('Hi')          

(property) Context<any, any, {}>.body: BodyRespond (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

expect(res

const res: Response

.status).toBe(201)          

(property) Response.status: number MDN Reference

}) it('Complex pattern', async () => { c

let c: Context<any, any, {}>

.status(404)          

(property) Context<any, any, {}>.status: (status: StatusCode) => void

const res =

const res: JSONRespondReturn<{ hono: string; }, StatusCode>

c

let c: Context<any, any, {}>

.json({

(property) Context<any, any, {}>.json: JSONRespond <{ hono: string; }, StatusCode>(object: { hono: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ hono: string; }, StatusCode> (+1 overload)

hono: 'great app' })          

(property) hono: string

expect(res

const res: JSONRespondReturn<{ hono: string; }, StatusCode>

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(res

const res: JSONRespondReturn<{ hono: string; }, StatusCode>

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toMatch('application/json; charset=UTF-8')          

(method) Headers.get(name: string): string | null MDN Reference

const obj: {

const obj: { [key: string]: string; }

[key: string]: string } = await

(parameter) key: string

res

const res: JSONRespondReturn<{ hono: string; }, StatusCode>

.json()          

(method) Body.json(): Promise<any> MDN Reference

expect(obj['hono']).toBe('great app')          

const obj: { [key: string]: string; }

}) it('Has headers and status', async () => { c

let c: Context<any, any, {}>

.header('x-custom1', 'Message1')          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

let c: Context<any, any, {}>

.header('x-custom2', 'Message2')          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

let c: Context<any, any, {}>

.status(200)          

(property) Context<any, any, {}>.status: (status: StatusCode) => void

const res =

const res: Response

c

let c: Context<any, any, {}>

.newResponse('this is body', 201, {          

(property) Context<any, any, {}>.newResponse: NewResponse (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

'x-custom3': 'Message3', 'x-custom2': 'Message2-Override', }) expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-Custom1')).toBe('Message1')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-Custom2')).toBe('Message2-Override')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-Custom3')).toBe('Message3')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.status).toBe(201)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('this is body')          

(method) Body.text(): Promise<string> MDN Reference

// res is already set. c

let c: Context<any, any, {}>

.res =

(property) Context<any, any, {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

res          

const res: Response

c

let c: Context<any, any, {}>

.header('X-Custom4', 'Message4')          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

let c: Context<any, any, {}>

.status(202)          

(property) Context<any, any, {}>.status: (status: StatusCode) => void

expect(c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Custom4')).toBe('Message4')          

(method) Headers.get(name: string): string | null MDN Reference

expect(c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.status).toBe(201)          

(property) Response.status: number MDN Reference

}) it('Inherit current status if not specified', async () => { c

let c: Context<any, any, {}>

.status(201)          

(property) Context<any, any, {}>.status: (status: StatusCode) => void

const res =

const res: Response

c

let c: Context<any, any, {}>

.newResponse('this is body', {          

(property) Context<any, any, {}>.newResponse: NewResponse (data: Data | null, init?: ResponseInit) => Response (+1 overload)

headers: {          

(property) ResponseInit.headers?: ResponseHeadersInit | undefined

'x-custom3': 'Message3', 'x-custom2': 'Message2-Override', }, }) expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-Custom2')).toBe('Message2-Override')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-Custom3')).toBe('Message3')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.status).toBe(201)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('this is body')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should append the previous headers to new Response', () => { c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.set('x-Custom1', 'Message1')          

(method) Headers.set(name: string, value: string): void MDN Reference

const res2 = new

const res2: Response

Response('foo2', {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

headers: {          

(property) ResponseInit.headers?: HeadersInit | undefined

'Content-Type': 'application/json', }, }) res2

const res2: Response

.headers

(property) Response.headers: Headers MDN Reference

.set('x-Custom2', 'Message2')          

(method) Headers.set(name: string, value: string): void MDN Reference

c

let c: Context<any, any, {}>

.res =

(property) Context<any, any, {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

res2          

const res2: Response

expect(c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.get('x-Custom1')).toBe('Message1')          

(method) Headers.get(name: string): string | null MDN Reference

expect(c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toBe('application/json')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Should return 200 response', async () => { const res =

const res: Response & TypedResponse<"Text", StatusCode, "text">

c

let c: Context<any, any, {}>

.text('Text')          

(property) Context<any, any, {}>.text: TextRespond <"Text", StatusCode>(text: "Text", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Text", StatusCode, "text"> (+1 overload)

expect(res

const res: Response & TypedResponse<"Text", StatusCode, "text">

.status).toBe(200)          

(property) Response.status: number MDN Reference

}) it('Should return 204 response', async () => { c

let c: Context<any, any, {}>

.status(204)          

(property) Context<any, any, {}>.status: (status: StatusCode) => void

const res =

const res: Response

c

let c: Context<any, any, {}>

.body(null)          

(property) Context<any, any, {}>.body: BodyRespond (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

expect(res

const res: Response

.status).toBe(204)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should be able read env', async () => { const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const key = 'a-secret-key'          

const key: "a-secret-key"

const ctx = new

const ctx: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req, {          

const req: Request

env: {          

(property) env: any Bindings for the environment.

API_KEY:

(property) API_KEY: string

key,          

const key: "a-secret-key"

}, }) expect(ctx

const ctx: Context<any, any, {}>

.env.API_KEY).toBe

(property) Context<any, any, {}>.env: any .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

(key)          

const key: "a-secret-key"

}) it('set and set', async () => { const ctx = new

const ctx: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

expect(ctx

const ctx: Context<any, any, {}>

.get('k-foo')).toEqual(undefined)          

(property) Context<any, any, {}>.get: Get <"k-foo">(key: "k-foo") => any (+1 overload)

ctx

const ctx: Context<any, any, {}>

.set('k-foo', 'v-foo')          

(property) Context<any, any, {}>.set: Set <"k-foo">(key: "k-foo", value: any) => void (+1 overload)

expect(ctx

const ctx: Context<any, any, {}>

.get('k-foo')).toEqual('v-foo')          

(property) Context<any, any, {}>.get: Get <"k-foo">(key: "k-foo") => any (+1 overload)

expect(ctx

const ctx: Context<any, any, {}>

.get('k-bar')).toEqual(undefined)          

(property) Context<any, any, {}>.get: Get <"k-bar">(key: "k-bar") => any (+1 overload)

ctx

const ctx: Context<any, any, {}>

.set('k-bar', {

(property) Context<any, any, {}>.set: Set <"k-bar">(key: "k-bar", value: any) => void (+1 overload)

k: 'v' })          

(property) k: string

expect(ctx

const ctx: Context<any, any, {}>

.get('k-bar')).toEqual({

(property) Context<any, any, {}>.get: Get <"k-bar">(key: "k-bar") => any (+1 overload)

k: 'v' })          

(property) k: string

}) it('has res object by default', async () => { c = new

let c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.append('foo', 'bar')          

(method) Headers.append(name: string, value: string): void MDN Reference

const res =

const res: Response & TypedResponse<"foo", StatusCode, "text">

c

let c: Context<any, any, {}>

.text('foo')          

(property) Context<any, any, {}>.text: TextRespond <"foo", StatusCode>(text: "foo", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"foo", StatusCode, "text"> (+1 overload)

expect(res

const res: Response & TypedResponse<"foo", StatusCode, "text">

.headers

(property) Response.headers: Headers MDN Reference

.get('foo')).not.toBeNull()          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response & TypedResponse<"foo", StatusCode, "text">

.headers

(property) Response.headers: Headers MDN Reference

.get('foo')).toBe('bar')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('event and executionCtx', () => { const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

it('Should return the event if accessing c.event', () => { const respondWith = vi.fn()          

const respondWith: any

const c = new

const c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req, {          

const req: Request

// @ts-expect-error the type is not correct executionCtx: {          

(property) executionCtx?: FetchEventLike | ExecutionContext | undefined Execution context for the request.

respondWith:

(method) FetchEventLike.respondWith(promise: Response | Promise<Response>): void

respondWith,          

const respondWith: any

}, }) expect(() => c

const c: Context<any, any, {}>

.event).not.toThrowError()          

(property) Context<any, any, {}>.event: FetchEventLike

@see — https://hono.dev/docs/api/context#eventThe FetchEvent associated with the current request.

@throws — Will throw an error if the context does not have a FetchEvent.

c

const c: Context<any, any, {}>

.event

(property) Context<any, any, {}>.event: FetchEventLike

@see — https://hono.dev/docs/api/context#eventThe FetchEvent associated with the current request.

@throws — Will throw an error if the context does not have a FetchEvent.

.respondWith(new

(method) FetchEventLike.respondWith(promise: Response | Promise<Response>): void

Response())          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

expect(respondWith).toHaveBeenCalled()          

const respondWith: any

}) it('Should throw an error if accessing c.event', () => { const c = new

const c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

expect(() => c

const c: Context<any, any, {}>

.event).toThrowError()          

(property) Context<any, any, {}>.event: FetchEventLike

@see — https://hono.dev/docs/api/context#eventThe FetchEvent associated with the current request.

@throws — Will throw an error if the context does not have a FetchEvent.

}) it('Should return the executionCtx if accessing c.executionCtx', () => { const pathThroughOnException = vi.fn()          

const pathThroughOnException: any

const waitUntil = vi.fn()          

const waitUntil: any

const c = new

const c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req, {          

const req: Request

executionCtx: {          

(property) executionCtx?: FetchEventLike | ExecutionContext | undefined Execution context for the request.

passThroughOnException:

(property) passThroughOnException: any

pathThroughOnException,          

const pathThroughOnException: any

waitUntil:

(property) waitUntil: any

waitUntil,          

const waitUntil: any

}, env: {},          

(property) env: any Bindings for the environment.

}) expect(() => c

const c: Context<any, any, {}>

.executionCtx).not.toThrowError()          

(property) Context<any, any, {}>.executionCtx: ExecutionContext

@see — https://hono.dev/docs/api/context#executionctxThe ExecutionContext associated with the current request.

@throws — Will throw an error if the context does not have an ExecutionContext.

c

const c: Context<any, any, {}>

.executionCtx

(property) Context<any, any, {}>.executionCtx: ExecutionContext

@see — https://hono.dev/docs/api/context#executionctxThe ExecutionContext associated with the current request.

@throws — Will throw an error if the context does not have an ExecutionContext.

.passThroughOnException()          

(method) ExecutionContext.passThroughOnException(): void Allows the event to be passed through to subsequent event listeners.

expect(pathThroughOnException).toHaveBeenCalled()          

const pathThroughOnException: any

const asyncFunc = async () => {}          

const asyncFunc: () => Promise<void>

c

const c: Context<any, any, {}>

.executionCtx

(property) Context<any, any, {}>.executionCtx: ExecutionContext

@see — https://hono.dev/docs/api/context#executionctxThe ExecutionContext associated with the current request.

@throws — Will throw an error if the context does not have an ExecutionContext.

.waitUntil

(method) ExecutionContext.waitUntil(promise: Promise<unknown>): void Extends the lifetime of the event callback until the promise is settled.

@param promise — A promise to wait for.

(asyncFunc())          

const asyncFunc: () => Promise<void>

expect(waitUntil).toHaveBeenCalled()          

const waitUntil: any

}) it('Should throw an error if accessing c.executionCtx', () => { const c = new

const c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

expect(() => c

const c: Context<any, any, {}>

.executionCtx).toThrowError()          

(property) Context<any, any, {}>.executionCtx: ExecutionContext

@see — https://hono.dev/docs/api/context#executionctxThe ExecutionContext associated with the current request.

@throws — Will throw an error if the context does not have an ExecutionContext.

}) }) describe('Context header', () => { const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

let c:

let c: Context<any, any, {}>

Context          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

beforeEach(() => { c = new

let c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

}) it('Should return only one content-type value', async () => { c

let c: Context<any, any, {}>

.header('Content-Type', 'foo')          

(property) Context<any, any, {}>.header: SetHeaders (name: ResponseHeader, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

const res = await

const res: Response

c

let c: Context<any, any, {}>

.html('foo')          

(property) Context<any, any, {}>.html: HTMLRespond <"foo">(html: "foo", status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toBe('text/html; charset=UTF-8')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Should rewrite header values correctly', async () => { c

let c: Context<any, any, {}>

.res = await

(property) Context<any, any, {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

c

let c: Context<any, any, {}>

.html('foo')          

(property) Context<any, any, {}>.html: HTMLRespond <"foo">(html: "foo", status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

const res =

const res: Response & TypedResponse<"foo", StatusCode, "text">

c

let c: Context<any, any, {}>

.text('foo')          

(property) Context<any, any, {}>.text: TextRespond <"foo", StatusCode>(text: "foo", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"foo", StatusCode, "text"> (+1 overload)

expect(res

const res: Response & TypedResponse<"foo", StatusCode, "text">

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toMatch(/^text\/plain/)          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Should set header values if the #this.headers is set and the arg is ResponseInit', async () => { c

let c: Context<any, any, {}>

.header('foo', 'bar')          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

const res =

const res: Response

c

let c: Context<any, any, {}>

.body('foo', {          

(property) Context<any, any, {}>.body: BodyRespond (data: Data | null, init?: ResponseInit) => Response (+1 overload)

headers: {          

(property) ResponseInit.headers?: ResponseHeadersInit | undefined

'Content-Type': 'text/plain', }, }) expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('foo')).toBe('bar')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Should set cookie headers when re-assigning Response to `c.res`', () => { const cookies = ['foo=bar; Path=/', 'foo2=bar2; Path=/']          

const cookies: string[]

const res = new

const res: Response

Response(null)          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.append('set-cookie',

(method) Headers.append(name: string, value: string): void MDN Reference

cookies[0])          

const cookies: string[]

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.append('set-cookie',

(method) Headers.append(name: string, value: string): void MDN Reference

cookies[1])          

const cookies: string[]

c

let c: Context<any, any, {}>

.res =

(property) Context<any, any, {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

res          

const res: Response

expect(c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.getSetCookie()

(method) Headers.getSetCookie(): string[] MDN Reference

.length).toBe(2)          

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

// Re-assign const newCookies = ['foo3=bar3; Path=/']          

const newCookies: string[]

const newResponse = new

const newResponse: Response

Response(null)          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

newResponse

const newResponse: Response

.headers

(property) Response.headers: Headers MDN Reference

.append('set-cookie',

(method) Headers.append(name: string, value: string): void MDN Reference

newCookies[0])          

const newCookies: string[]

c

let c: Context<any, any, {}>

.res =

(property) Context<any, any, {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

newResponse          

const newResponse: Response

expect(c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.getSetCookie()

(method) Headers.getSetCookie(): string[] MDN Reference

.length).toBe

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

(cookies

const cookies: string[]

.length)          

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

expect(c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.getSetCookie()).toEqual

(method) Headers.getSetCookie(): string[] MDN Reference

(cookies)          

const cookies: string[]

}) it('Should keep previous cookies in response headers', () => { c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.append('set-cookie', 'foo=bar; Path=/')          

(method) Headers.append(name: string, value: string): void MDN Reference

setCookie

(alias) setCookie(c: Context, name: string, value: string, opt?: CookieOptions): void import setCookie

(c, 'foo2', 'bar2', {

let c: Context<any, any, {}>

path: '/' })          

(property) path?: string | undefined

const res =

const res: JSONRespondReturn<{ message: string; }, StatusCode>

c

let c: Context<any, any, {}>

.json({

(property) Context<any, any, {}>.json: JSONRespond <{ message: string; }, StatusCode>(object: { message: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ message: string; }, StatusCode> (+1 overload)

message: 'Hello' })          

(property) message: string

const cookies =

const cookies: string[]

res

const res: JSONRespondReturn<{ message: string; }, StatusCode>

.headers

(property) Response.headers: Headers MDN Reference

.getSetCookie()          

(method) Headers.getSetCookie(): string[] MDN Reference

expect(cookies

const cookies: string[]

.includes('foo=bar; Path=/')).toBe(true)          

(method) Array<string>.includes(searchElement: string, fromIndex?: number): boolean Determines whether an array includes a certain element, returning true or false as appropriate.

@param searchElement — The element to search for.

@param fromIndex — The position in this array at which to begin searching for searchElement.

expect(cookies

const cookies: string[]

.includes('foo2=bar2; Path=/')).toBe(true)          

(method) Array<string>.includes(searchElement: string, fromIndex?: number): boolean Determines whether an array includes a certain element, returning true or false as appropriate.

@param searchElement — The element to search for.

@param fromIndex — The position in this array at which to begin searching for searchElement.

}) it('Should set set-cookie header values if c.res is already defined', () => { c

let c: Context<any, any, {}>

.res = new

(property) Context<any, any, {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

Response(null, {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

headers: [          

(property) ResponseInit.headers?: HeadersInit | undefined

['set-cookie', 'a'], ['set-cookie', 'b'], ['set-cookie', 'c'], ], }) const res =

const res: Response & TypedResponse<"Hi", StatusCode, "text">

c

let c: Context<any, any, {}>

.text('Hi')          

(property) Context<any, any, {}>.text: TextRespond <"Hi", StatusCode>(text: "Hi", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Hi", StatusCode, "text"> (+1 overload)

expect(res

const res: Response & TypedResponse<"Hi", StatusCode, "text">

.headers

(property) Response.headers: Headers MDN Reference

.get('set-cookie')).toBe('a, b, c')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Should be able to overwrite a fetch response with a new response.', async () => { c

let c: Context<any, any, {}>

.res =

(property) Context<any, any, {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

makeResponseHeaderImmutable(new

const makeResponseHeaderImmutable: (res: Response) => Response

Response('bar'))          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

c

let c: Context<any, any, {}>

.res = new

(property) Context<any, any, {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

Response('foo', {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

headers: {          

(property) ResponseInit.headers?: HeadersInit | undefined

'X-Custom': 'Message', }, }) expect(c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.text()).resolves.toBe('foo')          

(method) Body.text(): Promise<string> MDN Reference

expect(c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Custom')).toBe('Message')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Should be able to overwrite a response with a fetch response.', async () => { c

let c: Context<any, any, {}>

.res = new

(property) Context<any, any, {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

Response('foo', {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

headers: {          

(property) ResponseInit.headers?: HeadersInit | undefined

'X-Custom': 'Message', }, }) c

let c: Context<any, any, {}>

.res =

(property) Context<any, any, {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

makeResponseHeaderImmutable(new

const makeResponseHeaderImmutable: (res: Response) => Response

Response('bar'))          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

expect(c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.text()).resolves.toBe('bar')          

(method) Body.text(): Promise<string> MDN Reference

expect(c

let c: Context<any, any, {}>

.res

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Custom')).toBe('Message')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('Pass a ResponseInit to respond methods', () => { const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

let c:

let c: Context<any, any, {}>

Context          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

beforeEach(() => { c = new

let c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

}) it('c.json()', async () => { const originalResponse = new

const originalResponse: Response

Response('Unauthorized', {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

headers: {          

(property) ResponseInit.headers?: HeadersInit | undefined

'content-type': 'text/plain', 'x-custom': 'custom message', }, status: 401,          

(property) ResponseInit.status?: number | undefined

}) const res =

const res: JSONRespondReturn<{ message: string; }, StatusCode>

c

let c: Context<any, any, {}>

.json(          

(property) Context<any, any, {}>.json: JSONRespond <{ message: string; }, StatusCode>(object: { message: string; }, init?: ResponseInit) => JSONRespondReturn<{ message: string; }, StatusCode> (+1 overload)

{ message: 'Unauthorized',          

(property) message: string

}, originalResponse          

const originalResponse: Response

) expect(res

const res: JSONRespondReturn<{ message: string; }, StatusCode>

.status).toBe(401)          

(property) Response.status: number MDN Reference

expect(res

const res: JSONRespondReturn<{ message: string; }, StatusCode>

.headers

(property) Response.headers: Headers MDN Reference

.get('content-type')).toMatch(/^application\/json/)          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: JSONRespondReturn<{ message: string; }, StatusCode>

.headers

(property) Response.headers: Headers MDN Reference

.get('x-custom')).toBe('custom message')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: JSONRespondReturn<{ message: string; }, StatusCode>

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

message: 'Unauthorized',          

(property) message: string

}) }) it('c.body()', async () => { const originalResponse = new

const originalResponse: Response

Response('

Hello

', {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

headers: {          

(property) ResponseInit.headers?: HeadersInit | undefined

'content-type': 'text/html', }, }) const res =

const res: Response

c

let c: Context<any, any, {}>

.body('

Hello

',

(property) Context<any, any, {}>.body: BodyRespond (data: Data | null, init?: ResponseInit) => Response (+1 overload)

originalResponse)          

const originalResponse: Response

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('content-type')).toMatch(/^text\/html/)          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('

Hello

')          

(method) Body.text(): Promise<string> MDN Reference

}) it('c.body() should retain context cookies from context and original response', async () => { setCookie

(alias) setCookie(c: Context, name: string, value: string, opt?: CookieOptions): void import setCookie

(c, 'context', '1')          

let c: Context<any, any, {}>

setCookie

(alias) setCookie(c: Context, name: string, value: string, opt?: CookieOptions): void import setCookie

(c, 'context', '2')          

let c: Context<any, any, {}>

const originalResponse = new

const originalResponse: Response

Response('', {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

headers: {          

(property) ResponseInit.headers?: HeadersInit | undefined

'set-cookie': 'response=1; Path=/', }, }) const res =

const res: Response

c

let c: Context<any, any, {}>

.body('',

(property) Context<any, any, {}>.body: BodyRespond (data: Data | null, init?: ResponseInit) => Response (+1 overload)

originalResponse)          

const originalResponse: Response

const cookies =

const cookies: string[]

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.getSetCookie()          

(method) Headers.getSetCookie(): string[] MDN Reference

expect(cookies

const cookies: string[]

.includes('context=1; Path=/')).toBe(true)          

(method) Array<string>.includes(searchElement: string, fromIndex?: number): boolean Determines whether an array includes a certain element, returning true or false as appropriate.

@param searchElement — The element to search for.

@param fromIndex — The position in this array at which to begin searching for searchElement.

expect(cookies

const cookies: string[]

.includes('context=2; Path=/')).toBe(true)          

(method) Array<string>.includes(searchElement: string, fromIndex?: number): boolean Determines whether an array includes a certain element, returning true or false as appropriate.

@param searchElement — The element to search for.

@param fromIndex — The position in this array at which to begin searching for searchElement.

expect(cookies

const cookies: string[]

.includes('response=1; Path=/')).toBe(true)          

(method) Array<string>.includes(searchElement: string, fromIndex?: number): boolean Determines whether an array includes a certain element, returning true or false as appropriate.

@param searchElement — The element to search for.

@param fromIndex — The position in this array at which to begin searching for searchElement.

}) it('c.text()', async () => { const originalResponse = new

const originalResponse: Response

Response

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

(JSON

var JSON: JSON An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.

.stringify({

(method) JSON.stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string (+1 overload) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.

@param value — A JavaScript value, usually an object or array, to be converted.

@param replacer — A function that transforms the results.

@param space — Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.

foo: 'bar' }))          

(property) foo: string

const res =

const res: Response & TypedResponse<"foo", StatusCode, "text">

c

let c: Context<any, any, {}>

.text('foo',

(property) Context<any, any, {}>.text: TextRespond <"foo", StatusCode>(text: "foo", init?: ResponseInit) => Response & TypedResponse<"foo", StatusCode, "text"> (+1 overload)

originalResponse)          

const originalResponse: Response

expect(res

const res: Response & TypedResponse<"foo", StatusCode, "text">

.headers

(property) Response.headers: Headers MDN Reference

.get('content-type')).toMatch(/^text\/plain/)          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response & TypedResponse<"foo", StatusCode, "text">

.text()).toBe('foo')          

(method) Body.text(): Promise<string> MDN Reference

}) it('c.html()', async () => { const originalResponse = new

const originalResponse: Response

Response('foo')          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

const res = await

const res: Response

c

let c: Context<any, any, {}>

.html('

foo

',

(property) Context<any, any, {}>.html: HTMLRespond <"<h1>foo</h1>">(html: "<h1>foo</h1>", init?: ResponseInit) => Response (+1 overload)

originalResponse)          

const originalResponse: Response

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('content-type')).toMatch(/^text\/html/)          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('

foo

')          

(method) Body.text(): Promise<string> MDN Reference

}) }) declare module './context' { interface ContextRenderer {          

interface ContextRenderer Interface for context renderer.

(content: string |

(parameter) content: string | Promise<string>

Promise,

interface Promise<T> Represents the completion of an asynchronous operation

head: {

(parameter) head: { title: string; }

title: string }):

(property) title: string

Response |

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response>          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

} } describe('c.render', () => { const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

let c:

let c: Context<any, any, {}>

Context          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

beforeEach(() => { c = new

let c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

}) it('Should return a Response from the default renderer', async () => { c

let c: Context<any, any, {}>

.header('foo', 'bar')          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

const res = await

const res: Response

c

let c: Context<any, any, {}>

.render('

content

', {

(property) Context<any, any, {}>.render: ContextRenderer (content: string | Promise<string>, head: { title: string; }) => Response | Promise<Response> (+1 overload)

title: 'dummy ' })          

(property) title: string

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('foo')).toBe('bar')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('

content

')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return a Response from the custom renderer', async () => { c

let c: Context<any, any, {}>

.setRenderer(

(property) Context<any, any, {}>.setRenderer: (renderer: ContextRenderer) => void .setRenderer() can set the layout in the custom middleware.

@see — https://hono.dev/docs/api/context#render-setrenderer

@example
tsx app.use('*', async (c, next) => { c.setRenderer((content) => { return c.html( <html> <body> <p>{content}</p> </body> </html> ) }) await next() })

(content,

(parameter) content: string | Promise<string>

head) => {          

(parameter) head: { title: string; } | { title: string; }

return c

let c: Context<any, any, {}>

.html(`$

(property) Context<any, any, {}>.html: HTMLRespond <`<html><head>${string}</head><body>${string}</body></html>`>(html: `<html><head>${string}</head><body>${string}</body></html>`, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

{head

(parameter) head: { title: string; } | { title: string; }

.title}$

(property) title: string

{content}`)          

(parameter) content: string | Promise<string>

}) c

let c: Context<any, any, {}>

.header('foo', 'bar')          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

const res = await

const res: Response

c

let c: Context<any, any, {}>

.render('

content

', {

(property) Context<any, any, {}>.render: ContextRenderer (content: string | Promise<string>, head: { title: string; }) => Response | Promise<Response> (+1 overload)

title: 'title' })          

(property) title: string

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('foo')).toBe('bar')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('title

content

')          

(method) Body.text(): Promise<string> MDN Reference

}) })
src/context.ts
            
                import { HonoRequest } from './request'
                import type { Result } from './router'
                import type {
                  Env,
                  FetchEventLike,
                  H,
                  Input,
                  NotFoundHandler,
                  RouterRoute,
                  TypedResponse,
                } from './types'
                import { HtmlEscapedCallbackPhase, resolveCallback } from './utils/html'
                import type { RedirectStatusCode, StatusCode } from './utils/http-status'
                import type { BaseMime } from './utils/mime'
                import type {
                  InvalidJSONValue,
                  IsAny,
                  JSONParsed,
                  JSONValue,
                  SimplifyDeepArray,
                } from './utils/types'
                
                type HeaderRecord =          

type HeaderRecord = Record<string, string | string[]> | Record<"Content-Type", BaseMime> | Record<ResponseHeader, string | string[]>

| Record<'Content-Type',

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

BaseMime>          

(alias) type BaseMime = "application/json" | "audio/aac" | "video/x-msvideo" | "image/avif" | "video/av1" | "application/octet-stream" | "image/bmp" | "text/css" | "text/csv" | "application/vnd.ms-fontobject" | ... 38 more ... | "model/gltf-binary" import BaseMime Union types for BaseMime

| Record

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

<ResponseHeader, string | string[]>          

type ResponseHeader = "Content-Type" | "Cookie" | "Access-Control-Allow-Credentials" | "Access-Control-Allow-Headers" | "Access-Control-Allow-Methods" | "Access-Control-Allow-Origin" | "Access-Control-Expose-Headers" | ... 61 more ... | "X-XSS-Protection"

| Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

/** * Data type can be a string, ArrayBuffer, or ReadableStream. */ export type Data = string |

type Data = string | ArrayBuffer | ReadableStream<any> Data type can be a string, ArrayBuffer, or ReadableStream.

ArrayBuffer |

interface ArrayBuffer Represents a raw buffer of binary data, which is used to store data for the different typed arrays. ArrayBuffers cannot be read from or written to directly, but can be passed to a typed array or DataView Object to interpret the raw buffer as needed.

ReadableStream          

interface ReadableStream<R = any> This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.

MDN Reference

/** * Interface for the execution context in a web worker or similar environment. */ export interface ExecutionContext {          

interface ExecutionContext Interface for the execution context in a web worker or similar environment.

/** * Extends the lifetime of the event callback until the promise is settled. * * @param promise - A promise to wait for. */ waitUntil

(method) ExecutionContext.waitUntil(promise: Promise<unknown>): void Extends the lifetime of the event callback until the promise is settled.

@param promise — A promise to wait for.

(promise:

(parameter) promise: Promise<unknown> - A promise to wait for.

@param promise — A promise to wait for.

Promise): void          

interface Promise<T> Represents the completion of an asynchronous operation

/** * Allows the event to be passed through to subsequent event listeners. */ passThroughOnException(): void          

(method) ExecutionContext.passThroughOnException(): void Allows the event to be passed through to subsequent event listeners.

} /** * Interface for context variable mapping. */ export interface ContextVariableMap {}          

interface ContextVariableMap Interface for context variable mapping.

/** * Interface for context renderer. */ export interface ContextRenderer {}          

interface ContextRenderer Interface for context renderer.

/** * Interface representing a renderer for content. * * @interface DefaultRenderer * @param {string | Promise} content - The content to be rendered, which can be either a string or a Promise resolving to a string. * @returns {Response | Promise} - The response after rendering the content, which can be either a Response or a Promise resolving to a Response. */ interface DefaultRenderer {          

interface DefaultRenderer Interface representing a renderer for content.

@interface — DefaultRenderer

@param content — The content to be rendered, which can be either a string or a Promise resolving to a string.

@returns — - The response after rendering the content, which can be either a Response or a Promise resolving to a Response.

(content: string |

(parameter) content: string | Promise<string>

Promise):

interface Promise<T> Represents the completion of an asynchronous operation

Response |

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response>          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

} /** * Renderer type which can either be a ContextRenderer or DefaultRenderer. */ export type Renderer =

type Renderer = ContextRenderer Renderer type which can either be a ContextRenderer or DefaultRenderer.

ContextRenderer extends

interface ContextRenderer Interface for context renderer.

Function ?

interface Function Creates a new function.

ContextRenderer :

interface ContextRenderer Interface for context renderer.

DefaultRenderer          

interface DefaultRenderer Interface representing a renderer for content.

@interface — DefaultRenderer

@param content — The content to be rendered, which can be either a string or a Promise resolving to a string.

@returns — - The response after rendering the content, which can be either a Response or a Promise resolving to a Response.

/** * Extracts the props for the renderer. */ export type PropsForRenderer = [..

type PropsForRenderer = { title: string; } Extracts the props for the renderer.

.Required

type Required<T> = { [P in keyof T]-?: T[P]; } Make all properties in T required

<Parameters

type Parameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never Obtain the parameters of a function type in a tuple

<Renderer>>] extends [unknown, infer

type Renderer = ContextRenderer Renderer type which can either be a ContextRenderer or DefaultRenderer.

Props]          

(type parameter) Props

? Props          

(type parameter) Props

: unknown // eslint-disable-next-line @typescript-eslint/no-explicit-any export type Layout

type Layout<T = Record<string, any>> = (props: T) => any

<T =

(type parameter) T in type Layout<T = Record<string, any>>

Record> =

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

(props:

(parameter) props: T = Record<string, any>

T) => any          

(type parameter) T in type Layout<T = Record<string, any>>

/** * Interface for getting context variables. * * @template E - Environment type. */ interface Get

interface Get<E extends Env> Interface for getting context variables.

@template E — Environment type.

<E extends

(type parameter) E in Get<E extends Env> - Environment type.

@template E — Environment type.

Env> {          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

<Key extends keyof

(type parameter) Key in <Key extends keyof E["Variables"]>(key: Key): E["Variables"][Key]

E['Variables']>

(type parameter) E in Get<E extends Env> - Environment type.

@template E — Environment type.

(key:

(parameter) key: Key extends keyof E["Variables"]

Key):

(type parameter) Key in <Key extends keyof E["Variables"]>(key: Key): E["Variables"][Key]

E['Variables']

(type parameter) E in Get<E extends Env> - Environment type.

@template E — Environment type.

[Key]          

(type parameter) Key in <Key extends keyof E["Variables"]>(key: Key): E["Variables"][Key]

<Key extends keyof

(type parameter) Key in <Key extends keyof ContextVariableMap>(key: Key): ContextVariableMap[Key]

ContextVariableMap>

interface ContextVariableMap Interface for context variable mapping.

(key:

(parameter) key: Key extends keyof ContextVariableMap

Key):

(type parameter) Key in <Key extends keyof ContextVariableMap>(key: Key): ContextVariableMap[Key]

ContextVariableMap

interface ContextVariableMap Interface for context variable mapping.

[Key]          

(type parameter) Key in <Key extends keyof ContextVariableMap>(key: Key): ContextVariableMap[Key]

} /** * Interface for setting context variables. * * @template E - Environment type. */ interface Set

interface Set<E extends Env> Interface for setting context variables.

@template E — Environment type.

<E extends

(type parameter) E in Set<E extends Env> - Environment type.

@template E — Environment type.

Env> {          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

<Key extends keyof

(type parameter) Key in <Key extends keyof E["Variables"]>(key: Key, value: E["Variables"][Key]): void

E['Variables']>

(type parameter) E in Set<E extends Env> - Environment type.

@template E — Environment type.

(key:

(parameter) key: Key extends keyof E["Variables"]

Key,

(type parameter) Key in <Key extends keyof E["Variables"]>(key: Key, value: E["Variables"][Key]): void

value:

(parameter) value: E["Variables"][Key]

E['Variables']

(type parameter) E in Set<E extends Env> - Environment type.

@template E — Environment type.

[Key]): void          

(type parameter) Key in <Key extends keyof E["Variables"]>(key: Key, value: E["Variables"][Key]): void

<Key extends keyof

(type parameter) Key in <Key extends keyof ContextVariableMap>(key: Key, value: ContextVariableMap[Key]): void

ContextVariableMap>

interface ContextVariableMap Interface for context variable mapping.

(key:

(parameter) key: Key extends keyof ContextVariableMap

Key,

(type parameter) Key in <Key extends keyof ContextVariableMap>(key: Key, value: ContextVariableMap[Key]): void

value:

(parameter) value: ContextVariableMap[Key]

ContextVariableMap

interface ContextVariableMap Interface for context variable mapping.

[Key]): void          

(type parameter) Key in <Key extends keyof ContextVariableMap>(key: Key, value: ContextVariableMap[Key]): void

} /** * Interface for creating a new response. */ interface NewResponse {          

interface NewResponse Interface for creating a new response.

(data:

(parameter) data: Data | null

Data | null,

type Data = string | ArrayBuffer | ReadableStream<any> Data type can be a string, ArrayBuffer, or ReadableStream.

status?:

(parameter) status: StatusCode | undefined

StatusCode,

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

headers?:

(parameter) headers: HeaderRecord | undefined

HeaderRecord):

type HeaderRecord = Record<string, string | string[]> | Record<"Content-Type", BaseMime> | Record<ResponseHeader, string | string[]>

Response          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

(data:

(parameter) data: Data | null

Data | null,

type Data = string | ArrayBuffer | ReadableStream<any> Data type can be a string, ArrayBuffer, or ReadableStream.

init?:

(parameter) init: ResponseInit | undefined

ResponseInit):

interface ResponseInit

Response          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

} /** * Interface for responding with a body. */ interface BodyRespond extends

interface BodyRespond Interface for responding with a body.

NewResponse {}          

interface NewResponse Interface for creating a new response.

/** * Interface for responding with text. * * @interface TextRespond * @template T - The type of the text content. * @template U - The type of the status code. * * @param {T} text - The text content to be included in the response. * @param {U} [status] - An optional status code for the response. * @param {HeaderRecord} [headers] - An optional record of headers to include in the response. * * @returns {Response & TypedResponse} - The response after rendering the text content, typed with the provided text and status code types. */ interface TextRespond {          

interface TextRespond Interface for responding with text.

@interface — TextRespond

@template T — The type of the text content.

@template U — The type of the status code.

@param text — The text content to be included in the response.

@param status — An optional status code for the response.

@param headers — An optional record of headers to include in the response.

@returns — - The response after rendering the text content, typed with the provided text and status code types.

<T extends string,

(type parameter) T in <T extends string, U extends StatusCode = StatusCode>(text: T, status?: U, headers?: HeaderRecord): Response & TypedResponse<T, U, "text">

U extends

(type parameter) U in <T extends string, U extends StatusCode = StatusCode>(text: T, status?: U, headers?: HeaderRecord): Response & TypedResponse<T, U, "text">

StatusCode =

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

StatusCode>(          

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

text:

(parameter) text: T extends string

T,          

(type parameter) T in <T extends string, U extends StatusCode = StatusCode>(text: T, status?: U, headers?: HeaderRecord): Response & TypedResponse<T, U, "text">

status?:

(parameter) status: U | undefined

U,          

(type parameter) U in <T extends string, U extends StatusCode = StatusCode>(text: T, status?: U, headers?: HeaderRecord): Response & TypedResponse<T, U, "text">

headers?:

(parameter) headers: HeaderRecord | undefined

HeaderRecord          

type HeaderRecord = Record<string, string | string[]> | Record<"Content-Type", BaseMime> | Record<ResponseHeader, string | string[]>

): Response &

interface Response This Fetch API interface represents the response to a request.

MDN Reference

TypedResponse

(alias) type TypedResponse<T = unknown, U extends StatusCode = StatusCode, F extends ResponseFormat = T extends string ? "text" : T extends JSONValue ? "json" : string> = { _data: T; _status: U; _format: F; } import TypedResponse

<T,

(type parameter) T in <T extends string, U extends StatusCode = StatusCode>(text: T, status?: U, headers?: HeaderRecord): Response & TypedResponse<T, U, "text">

U, 'text'>          

(type parameter) U in <T extends string, U extends StatusCode = StatusCode>(text: T, status?: U, headers?: HeaderRecord): Response & TypedResponse<T, U, "text">

<T extends string,

(type parameter) T in <T extends string, U extends StatusCode = StatusCode>(text: T, init?: ResponseInit): Response & TypedResponse<T, U, "text">

U extends

(type parameter) U in <T extends string, U extends StatusCode = StatusCode>(text: T, init?: ResponseInit): Response & TypedResponse<T, U, "text">

StatusCode =

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

StatusCode>

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

(text:

(parameter) text: T extends string

T,

(type parameter) T in <T extends string, U extends StatusCode = StatusCode>(text: T, init?: ResponseInit): Response & TypedResponse<T, U, "text">

init?:

(parameter) init: ResponseInit | undefined

ResponseInit):

interface ResponseInit

Response &          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

TypedResponse

(alias) type TypedResponse<T = unknown, U extends StatusCode = StatusCode, F extends ResponseFormat = T extends string ? "text" : T extends JSONValue ? "json" : string> = { _data: T; _status: U; _format: F; } import TypedResponse

<T,

(type parameter) T in <T extends string, U extends StatusCode = StatusCode>(text: T, init?: ResponseInit): Response & TypedResponse<T, U, "text">

U, 'text'>          

(type parameter) U in <T extends string, U extends StatusCode = StatusCode>(text: T, init?: ResponseInit): Response & TypedResponse<T, U, "text">

} /** * Interface for responding with JSON. * * @interface JSONRespond * @template T - The type of the JSON value or simplified unknown type. * @template U - The type of the status code. * * @param {T} object - The JSON object to be included in the response. * @param {U} [status] - An optional status code for the response. * @param {HeaderRecord} [headers] - An optional record of headers to include in the response. * * @returns {JSONRespondReturn} - The response after rendering the JSON object, typed with the provided object and status code types. */ interface JSONRespond {          

interface JSONRespond Interface for responding with JSON.

@interface — JSONRespond

@template T — The type of the JSON value or simplified unknown type.

@template U — The type of the status code.

@param object — The JSON object to be included in the response.

@param status — An optional status code for the response.

@param headers — An optional record of headers to include in the response.

@returns — - The response after rendering the JSON object, typed with the provided object and status code types.

< T extends

(type parameter) T in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, status?: U, headers?: HeaderRecord): JSONRespondReturn<T, U>

JSONValue |

(alias) type JSONValue = JSONObject | JSONArray | JSONPrimitive import JSONValue

SimplifyDeepArray |

(alias) type SimplifyDeepArray<T> = T extends any[] ? { [E in keyof T]: SimplifyDeepArray<T[E]>; } : { [KeyType in keyof T]: T[KeyType]; } import SimplifyDeepArray A simple extension of Simplify that will deeply traverse array elements.

InvalidJSONValue,          

(alias) type InvalidJSONValue = symbol | ((...args: unknown[]) => unknown) | undefined import InvalidJSONValue

U extends

(type parameter) U in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, status?: U, headers?: HeaderRecord): JSONRespondReturn<T, U>

StatusCode =

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

StatusCode          

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

>( object:

(parameter) object: T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue

T,          

(type parameter) T in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, status?: U, headers?: HeaderRecord): JSONRespondReturn<T, U>

status?:

(parameter) status: U | undefined

U,          

(type parameter) U in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, status?: U, headers?: HeaderRecord): JSONRespondReturn<T, U>

headers?:

(parameter) headers: HeaderRecord | undefined

HeaderRecord          

type HeaderRecord = Record<string, string | string[]> | Record<"Content-Type", BaseMime> | Record<ResponseHeader, string | string[]>

): JSONRespondReturn

type JSONRespondReturn<T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode> = Response & TypedResponse<SimplifyDeepArray<T> extends JSONValue ? JSONValue extends SimplifyDeepArray<T> ? never : JSONParsed<...> : never, U, "json">

@template T — The type of the JSON value or simplified unknown type.

@template U — The type of the status code.

@returns — - The response after rendering the JSON object, typed with the provided object and status code types.

<T,

(type parameter) T in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, status?: U, headers?: HeaderRecord): JSONRespondReturn<T, U>

U>          

(type parameter) U in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, status?: U, headers?: HeaderRecord): JSONRespondReturn<T, U>

< T extends

(type parameter) T in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, init?: ResponseInit): JSONRespondReturn<T, U>

JSONValue |

(alias) type JSONValue = JSONObject | JSONArray | JSONPrimitive import JSONValue

SimplifyDeepArray |

(alias) type SimplifyDeepArray<T> = T extends any[] ? { [E in keyof T]: SimplifyDeepArray<T[E]>; } : { [KeyType in keyof T]: T[KeyType]; } import SimplifyDeepArray A simple extension of Simplify that will deeply traverse array elements.

InvalidJSONValue,          

(alias) type InvalidJSONValue = symbol | ((...args: unknown[]) => unknown) | undefined import InvalidJSONValue

U extends

(type parameter) U in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, init?: ResponseInit): JSONRespondReturn<T, U>

StatusCode =

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

StatusCode          

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

>( object:

(parameter) object: T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue

T,          

(type parameter) T in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, init?: ResponseInit): JSONRespondReturn<T, U>

init?:

(parameter) init: ResponseInit | undefined

ResponseInit          

interface ResponseInit

): JSONRespondReturn

type JSONRespondReturn<T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode> = Response & TypedResponse<SimplifyDeepArray<T> extends JSONValue ? JSONValue extends SimplifyDeepArray<T> ? never : JSONParsed<...> : never, U, "json">

@template T — The type of the JSON value or simplified unknown type.

@template U — The type of the status code.

@returns — - The response after rendering the JSON object, typed with the provided object and status code types.

<T,

(type parameter) T in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, init?: ResponseInit): JSONRespondReturn<T, U>

U>          

(type parameter) U in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, init?: ResponseInit): JSONRespondReturn<T, U>

} /** * @template T - The type of the JSON value or simplified unknown type. * @template U - The type of the status code. * * @returns {Response & TypedResponse extends JSONValue ? (JSONValue extends SimplifyDeepArray ? never : JSONParsed) : never, U, 'json'>} - The response after rendering the JSON object, typed with the provided object and status code types. */ type JSONRespondReturn<          

type JSONRespondReturn<T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode> = Response & TypedResponse<SimplifyDeepArray<T> extends JSONValue ? JSONValue extends SimplifyDeepArray<T> ? never : JSONParsed<...> : never, U, "json">

@template T — The type of the JSON value or simplified unknown type.

@template U — The type of the status code.

@returns — - The response after rendering the JSON object, typed with the provided object and status code types.

T extends

(type parameter) T in type JSONRespondReturn<T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode> - The type of the JSON value or simplified unknown type.

@template T — The type of the JSON value or simplified unknown type.

JSONValue |

(alias) type JSONValue = JSONObject | JSONArray | JSONPrimitive import JSONValue

SimplifyDeepArray |

(alias) type SimplifyDeepArray<T> = T extends any[] ? { [E in keyof T]: SimplifyDeepArray<T[E]>; } : { [KeyType in keyof T]: T[KeyType]; } import SimplifyDeepArray A simple extension of Simplify that will deeply traverse array elements.

InvalidJSONValue,          

(alias) type InvalidJSONValue = symbol | ((...args: unknown[]) => unknown) | undefined import InvalidJSONValue

U extends

(type parameter) U in type JSONRespondReturn<T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode> - The type of the status code.

@template U — The type of the status code.

StatusCode          

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

> = Response &          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

TypedResponse<          

(alias) type TypedResponse<T = unknown, U extends StatusCode = StatusCode, F extends ResponseFormat = T extends string ? "text" : T extends JSONValue ? "json" : string> = { _data: T; _status: U; _format: F; } import TypedResponse

SimplifyDeepArray

(alias) type SimplifyDeepArray<T> = T extends any[] ? { [E in keyof T]: SimplifyDeepArray<T[E]>; } : { [KeyType in keyof T]: T[KeyType]; } import SimplifyDeepArray A simple extension of Simplify that will deeply traverse array elements.

<T> extends

(type parameter) T in type JSONRespondReturn<T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode> - The type of the JSON value or simplified unknown type.

@template T — The type of the JSON value or simplified unknown type.

JSONValue          

(alias) type JSONValue = JSONObject | JSONArray | JSONPrimitive import JSONValue

? JSONValue extends

(alias) type JSONValue = JSONObject | JSONArray | JSONPrimitive import JSONValue

SimplifyDeepArray

(alias) type SimplifyDeepArray<T> = T extends any[] ? { [E in keyof T]: SimplifyDeepArray<T[E]>; } : { [KeyType in keyof T]: T[KeyType]; } import SimplifyDeepArray A simple extension of Simplify that will deeply traverse array elements.

<T>          

(type parameter) T in type JSONRespondReturn<T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode> - The type of the JSON value or simplified unknown type.

@template T — The type of the JSON value or simplified unknown type.

? never : JSONParsed

(alias) type JSONParsed<T> = T extends { toJSON(): infer J; } ? (() => J) extends () => JSONPrimitive ? J : (() => J) extends () => { toJSON(): unknown; } ? {} : JSONParsed<J> : T extends JSONPrimitive ? T : T extends InvalidJSONValue ? never : T extends readonly unknown[] ? { [K in keyof T]: JSONParsed<...>; } : T extends Map<...> | globalThis.Set<...> ? {} : T extends object ? { [K in keyof OmitSymbolKeys<...> as IsInvalid<...> extends true ? never : K]: boolean extends IsInvalid<...> ? JSONParsed<...> | undefined : JSONParsed<...>; } : never import JSONParsed

<T>          

(type parameter) T in type JSONRespondReturn<T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode> - The type of the JSON value or simplified unknown type.

@template T — The type of the JSON value or simplified unknown type.

: never, U,          

(type parameter) U in type JSONRespondReturn<T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode> - The type of the status code.

@template U — The type of the status code.

'json' > /** * Interface representing a function that responds with HTML content. * * @param html - The HTML content to respond with, which can be a string or a Promise that resolves to a string. * @param status - (Optional) The HTTP status code for the response. * @param headers - (Optional) A record of headers to include in the response. * @param init - (Optional) The response initialization object. * * @returns A Response object or a Promise that resolves to a Response object. */ interface HTMLRespond {          

interface HTMLRespond Interface representing a function that responds with HTML content.

@param html — The HTML content to respond with, which can be a string or a Promise that resolves to a string.

@param status — (Optional) The HTTP status code for the response.

@param headers — (Optional) A record of headers to include in the response.

@param init — (Optional) The response initialization object.

@returns — A Response object or a Promise that resolves to a Response object.

<T extends string |

(type parameter) T in <T extends string | Promise<string>>(html: T, status?: StatusCode, headers?: HeaderRecord): T extends string ? Response : Promise<Response>

Promise>(          

interface Promise<T> Represents the completion of an asynchronous operation

html:

(parameter) html: T extends string | Promise<string>

T,          

(type parameter) T in <T extends string | Promise<string>>(html: T, status?: StatusCode, headers?: HeaderRecord): T extends string ? Response : Promise<Response>

status?:

(parameter) status: StatusCode | undefined

StatusCode,          

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

headers?:

(parameter) headers: HeaderRecord | undefined

HeaderRecord          

type HeaderRecord = Record<string, string | string[]> | Record<"Content-Type", BaseMime> | Record<ResponseHeader, string | string[]>

): T extends string ?

(type parameter) T in <T extends string | Promise<string>>(html: T, status?: StatusCode, headers?: HeaderRecord): T extends string ? Response : Promise<Response>

Response :

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response>          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

<T extends string |

(type parameter) T in <T extends string | Promise<string>>(html: T, init?: ResponseInit): T extends string ? Response : Promise<Response>

Promise>

interface Promise<T> Represents the completion of an asynchronous operation

(html:

(parameter) html: T extends string | Promise<string>

T,

(type parameter) T in <T extends string | Promise<string>>(html: T, init?: ResponseInit): T extends string ? Response : Promise<Response>

init?:

(parameter) init: ResponseInit | undefined

ResponseInit):

interface ResponseInit

T extends string          

(type parameter) T in <T extends string | Promise<string>>(html: T, init?: ResponseInit): T extends string ? Response : Promise<Response>

? Response          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

: Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response>          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

} /** * Options for configuring the context. * * @template E - Environment type. */ type ContextOptions

type ContextOptions<E extends Env> = { env: E["Bindings"]; executionCtx?: FetchEventLike | ExecutionContext | undefined; notFoundHandler?: NotFoundHandler<E>; matchResult?: Result<[H, RouterRoute]>; path?: string; } Options for configuring the context.

@template E — Environment type.

<E extends

(type parameter) E in type ContextOptions<E extends Env> - Environment type.

@template E — Environment type.

Env> = {          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

/** * Bindings for the environment. */ env:

(property) env: E["Bindings"] Bindings for the environment.

E['Bindings']          

(type parameter) E in type ContextOptions<E extends Env> - Environment type.

@template E — Environment type.

/** * Execution context for the request. */ executionCtx?:

(property) executionCtx?: FetchEventLike | ExecutionContext | undefined Execution context for the request.

FetchEventLike |

(alias) class FetchEventLike import FetchEventLike

ExecutionContext | undefined          

interface ExecutionContext Interface for the execution context in a web worker or similar environment.

/** * Handler for not found responses. */ notFoundHandler?:

(property) notFoundHandler?: NotFoundHandler<E> | undefined Handler for not found responses.

NotFoundHandler

(alias) type NotFoundHandler<E extends Env = any> = (c: Context<E>) => Response | Promise<Response> import NotFoundHandler

<E>          

(type parameter) E in type ContextOptions<E extends Env> - Environment type.

@template E — Environment type.

matchResult?:

(property) matchResult?: Result<[H, RouterRoute]> | undefined

Result<

(alias) type Result<T> = [[T, ParamIndexMap][], ParamStash] | [[T, Params][]] import Result Type representing the result of a route match.

The result can be in one of two formats: 1. An array of handlers with their corresponding parameter index maps, followed by a parameter stash. 2. An array of handlers with their corresponding parameter maps.

Example:

[[handler, paramIndexMap][], paramArray] [ [ [middlewareA, {}], // '*' [funcA, {'id': 0}], // '/user/:id/*' [funcB, {'id': 0, 'action': 1}], // '/user/:id/:action' ], ['123', 'abc'] ]

[[handler, params][]] [ [ [middlewareA, {}], // '*' [funcA, {'id': '123'}], // '/user/:id/*' [funcB, {'id': '123', 'action': 'abc'}], // '/user/:id/:action' ] ]

[H,

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

RouterRoute]>          

(alias) interface RouterRoute import RouterRoute

path?: string          

(property) path?: string | undefined

} interface SetHeadersOptions {          

interface SetHeadersOptions

append?: boolean          

(property) SetHeadersOptions.append?: boolean | undefined

} type ResponseHeader =          

type ResponseHeader = "Content-Type" | "Cookie" | "Access-Control-Allow-Credentials" | "Access-Control-Allow-Headers" | "Access-Control-Allow-Methods" | "Access-Control-Allow-Origin" | "Access-Control-Expose-Headers" | ... 61 more ... | "X-XSS-Protection"

| 'Access-Control-Allow-Credentials' | 'Access-Control-Allow-Headers' | 'Access-Control-Allow-Methods' | 'Access-Control-Allow-Origin' | 'Access-Control-Expose-Headers' | 'Access-Control-Max-Age' | 'Age' | 'Allow' | 'Cache-Control' | 'Clear-Site-Data' | 'Content-Disposition' | 'Content-Encoding' | 'Content-Language' | 'Content-Length' | 'Content-Location' | 'Content-Range' | 'Content-Security-Policy' | 'Content-Security-Policy-Report-Only' | 'Content-Type' | 'Cookie' | 'Cross-Origin-Embedder-Policy' | 'Cross-Origin-Opener-Policy' | 'Cross-Origin-Resource-Policy' | 'Date' | 'ETag' | 'Expires' | 'Last-Modified' | 'Location' | 'Permissions-Policy' | 'Pragma' | 'Retry-After' | 'Save-Data' | 'Sec-CH-Prefers-Color-Scheme' | 'Sec-CH-Prefers-Reduced-Motion' | 'Sec-CH-UA' | 'Sec-CH-UA-Arch' | 'Sec-CH-UA-Bitness' | 'Sec-CH-UA-Form-Factor' | 'Sec-CH-UA-Full-Version' | 'Sec-CH-UA-Full-Version-List' | 'Sec-CH-UA-Mobile' | 'Sec-CH-UA-Model' | 'Sec-CH-UA-Platform' | 'Sec-CH-UA-Platform-Version' | 'Sec-CH-UA-WoW64' | 'Sec-Fetch-Dest' | 'Sec-Fetch-Mode' | 'Sec-Fetch-Site' | 'Sec-Fetch-User' | 'Sec-GPC' | 'Server' | 'Server-Timing' | 'Service-Worker-Navigation-Preload' | 'Set-Cookie' | 'Strict-Transport-Security' | 'Timing-Allow-Origin' | 'Trailer' | 'Transfer-Encoding' | 'Upgrade' | 'Vary' | 'WWW-Authenticate' | 'Warning' | 'X-Content-Type-Options' | 'X-DNS-Prefetch-Control' | 'X-Frame-Options' | 'X-Permitted-Cross-Domain-Policies' | 'X-Powered-By' | 'X-Robots-Tag' | 'X-XSS-Protection' interface SetHeaders {          

interface SetHeaders

(name: 'Content-Type',

(parameter) name: "Content-Type"

value?:

(parameter) value: BaseMime | undefined

BaseMime,

(alias) type BaseMime = "application/json" | "audio/aac" | "video/x-msvideo" | "image/avif" | "video/av1" | "application/octet-stream" | "image/bmp" | "text/css" | "text/csv" | "application/vnd.ms-fontobject" | ... 38 more ... | "model/gltf-binary" import BaseMime Union types for BaseMime

options?:

(parameter) options: SetHeadersOptions | undefined

SetHeadersOptions): void          

interface SetHeadersOptions

(name:

(parameter) name: ResponseHeader

ResponseHeader,

type ResponseHeader = "Content-Type" | "Cookie" | "Access-Control-Allow-Credentials" | "Access-Control-Allow-Headers" | "Access-Control-Allow-Methods" | "Access-Control-Allow-Origin" | "Access-Control-Expose-Headers" | ... 61 more ... | "X-XSS-Protection"

value?: string,

(parameter) value: string | undefined

options?:

(parameter) options: SetHeadersOptions | undefined

SetHeadersOptions): void          

interface SetHeadersOptions

(name: string,

(parameter) name: string

value?: string,

(parameter) value: string | undefined

options?:

(parameter) options: SetHeadersOptions | undefined

SetHeadersOptions): void          

interface SetHeadersOptions

} type ResponseHeadersInit =          

type ResponseHeadersInit = Record<string, string> | Headers | [string, string][] | Record<"Content-Type", BaseMime> | Record<ResponseHeader, string>

| [string, string][] | Record<'Content-Type',

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

BaseMime>          

(alias) type BaseMime = "application/json" | "audio/aac" | "video/x-msvideo" | "image/avif" | "video/av1" | "application/octet-stream" | "image/bmp" | "text/css" | "text/csv" | "application/vnd.ms-fontobject" | ... 38 more ... | "model/gltf-binary" import BaseMime Union types for BaseMime

| Record

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

<ResponseHeader, string>          

type ResponseHeader = "Content-Type" | "Cookie" | "Access-Control-Allow-Credentials" | "Access-Control-Allow-Headers" | "Access-Control-Allow-Methods" | "Access-Control-Allow-Origin" | "Access-Control-Expose-Headers" | ... 61 more ... | "X-XSS-Protection"

| Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

| Headers          

interface Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

interface ResponseInit {          

interface ResponseInit

headers?:

(property) ResponseInit.headers?: ResponseHeadersInit | undefined

ResponseHeadersInit          

type ResponseHeadersInit = Record<string, string> | Headers | [string, string][] | Record<"Content-Type", BaseMime> | Record<ResponseHeader, string>

status?: number          

(property) ResponseInit.status?: number | undefined

statusText?: string          

(property) ResponseInit.statusText?: string | undefined

} export const TEXT_PLAIN = 'text/plain; charset=UTF-8'          

const TEXT_PLAIN: "text/plain; charset=UTF-8"

/** * Sets the headers of a response. * * @param headers - The Headers object to set the headers on. * @param map - A record of header key-value pairs to set. * @returns The updated Headers object. */ const setHeaders =

const setHeaders: (headers: Headers, map?: Record<string, string>) => Headers Sets the headers of a response.

@param headers — The Headers object to set the headers on.

@param map — A record of header key-value pairs to set.

@returns — The updated Headers object.

(headers:

(parameter) headers: Headers - The Headers object to set the headers on.

@param headers — The Headers object to set the headers on.

Headers,

interface Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

map:

(parameter) map: Record<string, string> - A record of header key-value pairs to set.

@param map — A record of header key-value pairs to set.

Record = {}) => {          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string>(o: { [s: string]: string; } | ArrayLike<string>): [string, string][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(map)

(parameter) map: Record<string, string> - A record of header key-value pairs to set.

@param map — A record of header key-value pairs to set.

.forEach((

(method) Array<[string, string]>.forEach(callbackfn: (value: [string, string], index: number, array: [string, string][]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

[key,

(parameter) key: string

value]) =>

(parameter) value: string

headers

(parameter) headers: Headers - The Headers object to set the headers on.

@param headers — The Headers object to set the headers on.

.set

(method) Headers.set(name: string, value: string): void MDN Reference

(key,

(parameter) key: string

value))          

(parameter) value: string

return headers          

(parameter) headers: Headers - The Headers object to set the headers on.

@param headers — The Headers object to set the headers on.

} export class Context<          

class Context<E extends Env = any, P extends string = any, I extends Input = {}>

// eslint-disable-next-line @typescript-eslint/no-explicit-any E extends

(type parameter) E in Context<E extends Env = any, P extends string = any, I extends Input = {}>

Env = any,          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

// eslint-disable-next-line @typescript-eslint/no-explicit-any P extends string = any,          

(type parameter) P in Context<E extends Env = any, P extends string = any, I extends Input = {}>

I extends

(type parameter) I in Context<E extends Env = any, P extends string = any, I extends Input = {}>

Input = {}          

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

> { #rawRequest: Request          

interface Request This Fetch API interface represents a resource request.

MDN Reference

#req: HonoRequest

(alias) class HonoRequest<P extends string = "/", I extends Input["out"] = {}> import HonoRequest

<P,

(type parameter) P in Context<E extends Env = any, P extends string = any, I extends Input = {}>

I['out']> | undefined          

(type parameter) I in Context<E extends Env = any, P extends string = any, I extends Input = {}>

/** * `.env` can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers. * * @see {@link https://hono.dev/docs/api/context#env} * * @example * ```ts * // Environment object for Cloudflare Workers * app.get('*', async c => { * const counter = c.env.COUNTER * }) * ``` */ env:

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.env: E["Bindings"] .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

E['Bindings'] = {}          

(type parameter) E in Context<E extends Env = any, P extends string = any, I extends Input = {}>

#var: Map | undefined          

interface Map<K, V>

finalized: boolean = false          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.finalized: boolean

/** * `.error` can get the error object from the middleware if the Handler throws an error. * * @see {@link https://hono.dev/docs/api/context#error} * * @example * ```ts * app.use('*', async (c, next) => { * await next() * if (c.error) { * // do something... * } * }) * ``` */ error:

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.error: Error | undefined .error can get the error object from the middleware if the Handler throws an error.

@see — https://hono.dev/docs/api/context#error

@example
ts app.use('*', async (c, next) => { await next() if (c.error) { // do something... } })

Error | undefined          

interface Error

#status: StatusCode = 200          

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

#executionCtx: FetchEventLike |

(alias) class FetchEventLike import FetchEventLike

ExecutionContext | undefined          

interface ExecutionContext Interface for the execution context in a web worker or similar environment.

#headers: Headers | undefined          

interface Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

#preparedHeaders: Record | undefined          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

#res: Response | undefined          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

#isFresh = true #layout: Layout

type Layout<T = Record<string, any>> = (props: T) => any

<PropsForRenderer & {

type PropsForRenderer = { title: string; } Extracts the props for the renderer.

Layout:

(property) Layout: Layout<Record<string, any>>

Layout }> | undefined          

type Layout<T = Record<string, any>> = (props: T) => any

#renderer: Renderer | undefined          

type Renderer = ContextRenderer Renderer type which can either be a ContextRenderer or DefaultRenderer.

#notFoundHandler: NotFoundHandler

(alias) type NotFoundHandler<E extends Env = any> = (c: Context<E>) => Response | Promise<Response> import NotFoundHandler

<E> | undefined          

(type parameter) E in Context<E extends Env = any, P extends string = any, I extends Input = {}>

#matchResult: Result<

(alias) type Result<T> = [[T, ParamIndexMap][], ParamStash] | [[T, Params][]] import Result Type representing the result of a route match.

The result can be in one of two formats: 1. An array of handlers with their corresponding parameter index maps, followed by a parameter stash. 2. An array of handlers with their corresponding parameter maps.

Example:

[[handler, paramIndexMap][], paramArray] [ [ [middlewareA, {}], // '*' [funcA, {'id': 0}], // '/user/:id/*' [funcB, {'id': 0, 'action': 1}], // '/user/:id/:action' ], ['123', 'abc'] ]

[[handler, params][]] [ [ [middlewareA, {}], // '*' [funcA, {'id': '123'}], // '/user/:id/*' [funcB, {'id': '123', 'action': 'abc'}], // '/user/:id/:action' ] ]

[H,

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

RouterRoute]> | undefined          

(alias) interface RouterRoute import RouterRoute

#path: string | undefined /** * Creates an instance of the Context class. * * @param req - The Request object. * @param options - Optional configuration options for the context. */ constructor(req:

(parameter) req: Request - The Request object.

@param req — The Request object.

Request,

interface Request This Fetch API interface represents a resource request.

MDN Reference

options?:

(parameter) options: ContextOptions<E> | undefined - Optional configuration options for the context.

@param options — Optional configuration options for the context.

ContextOptions

type ContextOptions<E extends Env> = { env: E["Bindings"]; executionCtx?: FetchEventLike | ExecutionContext | undefined; notFoundHandler?: NotFoundHandler<E>; matchResult?: Result<[H, RouterRoute]>; path?: string; } Options for configuring the context.

@template E — Environment type.

<E>) {          

(type parameter) E in Context<E extends Env = any, P extends string = any, I extends Input = {}>

this.#rawRequest = req          

(parameter) req: Request - The Request object.

@param req — The Request object.

if (options) {          

(parameter) options: ContextOptions<E> | undefined - Optional configuration options for the context.

@param options — Optional configuration options for the context.

this.#executionCtx = options

(parameter) options: ContextOptions<E> - Optional configuration options for the context.

@param options — Optional configuration options for the context.

.executionCtx          

(property) executionCtx?: FetchEventLike | ExecutionContext | undefined Execution context for the request.

this.env =

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.env: E["Bindings"] .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

options

(parameter) options: ContextOptions<E> - Optional configuration options for the context.

@param options — Optional configuration options for the context.

.env          

(property) env: E["Bindings"] Bindings for the environment.

this.#notFoundHandler = options

(parameter) options: ContextOptions<E> - Optional configuration options for the context.

@param options — Optional configuration options for the context.

.notFoundHandler          

(property) notFoundHandler?: NotFoundHandler<E> | undefined Handler for not found responses.

this.#path = options

(parameter) options: ContextOptions<E> - Optional configuration options for the context.

@param options — Optional configuration options for the context.

.path          

(property) path?: string | undefined

this.#matchResult = options

(parameter) options: ContextOptions<E> - Optional configuration options for the context.

@param options — Optional configuration options for the context.

.matchResult          

(property) matchResult?: Result<[H, RouterRoute]> | undefined

} } /** * `.req` is the instance of {@link HonoRequest}. */ get req():

(getter) Context<E extends Env = any, P extends string = any, I extends Input = {}>.req: HonoRequest<P, I["out"]> .req is the instance of HonoRequest.

HonoRequest

(alias) class HonoRequest<P extends string = "/", I extends Input["out"] = {}> import HonoRequest

<P,

(type parameter) P in Context<E extends Env = any, P extends string = any, I extends Input = {}>

I['out']> {          

(type parameter) I in Context<E extends Env = any, P extends string = any, I extends Input = {}>

this.#req ??= new HonoRequest(this.#rawRequest, this.#path, this.#matchResult)          

(alias) new HonoRequest<P, I["out"]>(request: Request, path?: string, matchResult?: Result<[unknown, RouterRoute]>): HonoRequest<P, I["out"]> import HonoRequest

return this.#req } /** * @see {@link https://hono.dev/docs/api/context#event} * The FetchEvent associated with the current request. * * @throws Will throw an error if the context does not have a FetchEvent. */ get event():

(getter) Context<E extends Env = any, P extends string = any, I extends Input = {}>.event: FetchEventLike

@see — https://hono.dev/docs/api/context#eventThe FetchEvent associated with the current request.

@throws — Will throw an error if the context does not have a FetchEvent.

FetchEventLike {          

(alias) class FetchEventLike import FetchEventLike

if (this.#executionCtx && 'respondWith' in this.#executionCtx) { return this.#executionCtx } else { throw Error('This context has no FetchEvent')          

var Error: ErrorConstructor (message?: string, options?: ErrorOptions) => Error (+1 overload)

} } /** * @see {@link https://hono.dev/docs/api/context#executionctx} * The ExecutionContext associated with the current request. * * @throws Will throw an error if the context does not have an ExecutionContext. */ get executionCtx():

(getter) Context<E extends Env = any, P extends string = any, I extends Input = {}>.executionCtx: ExecutionContext

@see — https://hono.dev/docs/api/context#executionctxThe ExecutionContext associated with the current request.

@throws — Will throw an error if the context does not have an ExecutionContext.

ExecutionContext {          

interface ExecutionContext Interface for the execution context in a web worker or similar environment.

if (this.#executionCtx) { return this.#executionCtx as ExecutionContext          

interface ExecutionContext Interface for the execution context in a web worker or similar environment.

} else { throw Error('This context has no ExecutionContext')          

var Error: ErrorConstructor (message?: string, options?: ErrorOptions) => Error (+1 overload)

} } /** * @see {@link https://hono.dev/docs/api/context#res} * The Response object for the current request. */ get res():

(getter) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

Response {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

this.#isFresh = false return (this.#res ||= new Response('404 Not Found', {

var Response: new (body?: BodyInit | null, init?: globalThis.ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 404 }))          

(property) ResponseInit.status?: number | undefined

} /** * Sets the Response object for the current request. * * @param _res - The Response object to set. */ set res

(setter) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response | undefined Sets the Response object for the current request.

@param _res — The Response object to set.

(_res:

(parameter) _res: Response | undefined - The Response object to set.

@param _res — The Response object to set.

Response | undefined) {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

this.#isFresh = false if (this.#res && _res) {          

(parameter) _res: Response | undefined - The Response object to set.

@param _res — The Response object to set.

try { for (const [k,

const k: string

v] of this.#res

const v: string

.headers

(property) Response.headers: Headers MDN Reference

.entries()) {          

(method) Headers.entries(): HeadersIterator<[string, string]> Returns an iterator allowing to go through all key/value pairs contained in this object.

if (k === 'content-type') {          

const k: string

continue } if (k === 'set-cookie') {          

const k: string

const cookies = this.#res

const cookies: string[]

.headers

(property) Response.headers: Headers MDN Reference

.getSetCookie()          

(method) Headers.getSetCookie(): string[] MDN Reference

_res

(parameter) _res: Response - The Response object to set.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.delete('set-cookie')          

(method) Headers.delete(name: string): void MDN Reference

for (const cookie of

const cookie: string

cookies) {          

const cookies: string[]

_res

(parameter) _res: Response - The Response object to set.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.append('set-cookie',

(method) Headers.append(name: string, value: string): void MDN Reference

cookie)          

const cookie: string

} } else { _res

(parameter) _res: Response - The Response object to set.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.set

(method) Headers.set(name: string, value: string): void MDN Reference

(k,

const k: string

v)          

const v: string

} } } catch (e) {          

(local var) e: unknown

if (e instanceof

(local var) e: unknown

TypeError &&

var TypeError: TypeErrorConstructor

e

(local var) e: TypeError

.message

(property) Error.message: string

.includes('immutable')) {          

(method) String.includes(searchString: string, position?: number): boolean Returns true if searchString appears as a substring of the result of converting this object to a String, at one or more positions that are greater than or equal to position; otherwise, returns false.

@param searchString — search string

@param position — If position is undefined, 0 is assumed, so as to search all of the String.

// `_res` is immutable (probably a response from a fetch API), so retry with a new response. this.res = new

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response | undefined Sets the Response object for the current request.

@param _res — The Response object to set.

Response

var Response: new (body?: BodyInit | null, init?: globalThis.ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

(_res

(parameter) _res: Response - The Response object to set.

@param _res — The Response object to set.

.body, {          

(property) Body.body: ReadableStream<Uint8Array> | null MDN Reference

headers:

(property) ResponseInit.headers?: HeadersInit | undefined

_res

(parameter) _res: Response - The Response object to set.

@param _res — The Response object to set.

.headers,          

(property) Response.headers: Headers MDN Reference

status:

(property) ResponseInit.status?: number | undefined

_res

(parameter) _res: Response - The Response object to set.

@param _res — The Response object to set.

.status,          

(property) Response.status: number MDN Reference

}) return } else { throw e          

(local var) e: unknown

} } } this.#res = _res          

(parameter) _res: Response | undefined - The Response object to set.

@param _res — The Response object to set.

this.finalized = true          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.finalized: boolean

} /** * `.render()` can create a response within a layout. * * @see {@link https://hono.dev/docs/api/context#render-setrenderer} * * @example * ```ts * app.get('/', (c) => { * return c.render('Hello!') * }) * ``` */ render:

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.render: ContextRenderer .render() can create a response within a layout.

@see — https://hono.dev/docs/api/context#render-setrenderer

@example
ts app.get('/', (c) => { return c.render('Hello!') })

Renderer = (..

type Renderer = ContextRenderer Renderer type which can either be a ContextRenderer or DefaultRenderer.

.args) => {          

(parameter) args: [content: string | Promise<string>, head: { title: string; }]

this.#renderer ??= (content: string |

(parameter) content: string | Promise<string>

Promise) => this

interface Promise<T> Represents the completion of an asynchronous operation

.html

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.html: HTMLRespond <string | Promise<string>>(html: string | Promise<string>, status?: StatusCode, headers?: HeaderRecord) => Response | Promise<Response> (+1 overload)

(content)          

(parameter) content: string | Promise<string>

return this.#renderer(...args)          

(parameter) args: [content: string | Promise<string>, head: { title: string; }]

} /** * Sets the layout for the response. * * @param layout - The layout to set. * @returns The layout function. */ setLayout = (          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.setLayout: (layout: Layout<PropsForRenderer & { Layout: Layout; }>) => Layout<PropsForRenderer & { Layout: Layout; }> Sets the layout for the response.

@param layout — The layout to set.

@returns — The layout function.

layout:

(parameter) layout: Layout<{ title: string; } & { Layout: Layout; }> - The layout to set.

@param layout — The layout to set.

Layout

type Layout<T = Record<string, any>> = (props: T) => any

<PropsForRenderer & {

type PropsForRenderer = { title: string; } Extracts the props for the renderer.

Layout:

(property) Layout: Layout<Record<string, any>>

Layout }>          

type Layout<T = Record<string, any>> = (props: T) => any

): Layout<          

type Layout<T = Record<string, any>> = (props: T) => any

PropsForRenderer & {          

type PropsForRenderer = { title: string; } Extracts the props for the renderer.

Layout:

(property) Layout: Layout<Record<string, any>>

Layout          

type Layout<T = Record<string, any>> = (props: T) => any

} > => (this.#layout = layout)          

(parameter) layout: Layout<{ title: string; } & { Layout: Layout; }> - The layout to set.

@param layout — The layout to set.

/** * Gets the current layout for the response. * * @returns The current layout function. */ getLayout = ():

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.getLayout: () => Layout<PropsForRenderer & { Layout: Layout; }> | undefined Gets the current layout for the response.

@returns — The current layout function.

Layout

type Layout<T = Record<string, any>> = (props: T) => any

<PropsForRenderer & {

type PropsForRenderer = { title: string; } Extracts the props for the renderer.

Layout:

(property) Layout: Layout<Record<string, any>>

Layout }> | undefined => this.#layout          

type Layout<T = Record<string, any>> = (props: T) => any

/** * `.setRenderer()` can set the layout in the custom middleware. * * @see {@link https://hono.dev/docs/api/context#render-setrenderer} * * @example * ```tsx * app.use('*', async (c, next) => { * c.setRenderer((content) => { * return c.html( * * *

{content}

* * * ) * }) * await next() * }) * ``` */ setRenderer =

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.setRenderer: (renderer: Renderer) => void .setRenderer() can set the layout in the custom middleware.

@see — https://hono.dev/docs/api/context#render-setrenderer

@example
tsx app.use('*', async (c, next) => { c.setRenderer((content) => { return c.html( <html> <body> <p>{content}</p> </body> </html> ) }) await next() })

(renderer:

(parameter) renderer: ContextRenderer

Renderer): void => {          

type Renderer = ContextRenderer Renderer type which can either be a ContextRenderer or DefaultRenderer.

this.#renderer = renderer          

(parameter) renderer: ContextRenderer

} /** * `.header()` can set headers. * * @see {@link https://hono.dev/docs/api/context#body} * * @example * ```ts * app.get('/welcome', (c) => { * // Set headers * c.header('X-Message', 'Hello!') * c.header('Content-Type', 'text/plain') * * return c.body('Thank you for coming') * }) * ``` */ header:

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders .header() can set headers.

@see — https://hono.dev/docs/api/context#body

@example
```ts app.get('/welcome', (c) => { // Set headers c.header('X-Message', 'Hello!') c.header('Content-Type', 'text/plain')

return c.body('Thank you for coming') }) ```

SetHeaders =

interface SetHeaders

(name,

(parameter) name: string

value,

(parameter) value: string | undefined

options): void => {          

(parameter) options: SetHeadersOptions | undefined

// Clear the header if (value === undefined) {          

(parameter) value: string | undefined

if (this.#headers) { this.#headers.delete

(method) Headers.delete(name: string): void MDN Reference

(name)          

(parameter) name: string

} else if (this.#preparedHeaders) { delete this.#preparedHeaders[name

(parameter) name: string

.toLocaleLowerCase()]          

(method) String.toLocaleLowerCase(locales?: Intl.LocalesArgument): string (+1 overload) Converts all alphabetic characters to lowercase, taking into account the host environment's current locale.

} if (this.finalized) {          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.finalized: boolean

this.res

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.delete

(method) Headers.delete(name: string): void MDN Reference

(name)          

(parameter) name: string

} return } if (options?

(parameter) options: SetHeadersOptions | undefined

.append) {          

(property) SetHeadersOptions.append?: boolean | undefined

if (!this.#headers) { this.#isFresh = false this.#headers = new Headers(this.#preparedHeaders)          

var Headers: new (init?: HeadersInit) => Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

this.#preparedHeaders = {} } this.#headers.append

(method) Headers.append(name: string, value: string): void MDN Reference

(name,

(parameter) name: string

value)          

(parameter) value: string

} else { if (this.#headers) { this.#headers.set

(method) Headers.set(name: string, value: string): void MDN Reference

(name,

(parameter) name: string

value)          

(parameter) value: string

} else { this.#preparedHeaders ??= {} this.#preparedHeaders[name

(parameter) name: string

.toLowerCase()] =

(method) String.toLowerCase(): string Converts all the alphabetic characters in a string to lowercase.

value          

(parameter) value: string

} } if (this.finalized) {          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.finalized: boolean

if (options?

(parameter) options: SetHeadersOptions | undefined

.append) {          

(property) SetHeadersOptions.append?: boolean | undefined

this.res

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.append

(method) Headers.append(name: string, value: string): void MDN Reference

(name,

(parameter) name: string

value)          

(parameter) value: string

} else { this.res

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.set

(method) Headers.set(name: string, value: string): void MDN Reference

(name,

(parameter) name: string

value)          

(parameter) value: string

} } } status =

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.status: (status: StatusCode) => void

(status:

(parameter) status: StatusCode

StatusCode): void => {          

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

this.#isFresh = false this.#status = status          

(parameter) status: StatusCode

} /** * `.set()` can set the value specified by the key. * * @see {@link https://hono.dev/docs/api/context#set-get} * * @example * ```ts * app.use('*', async (c, next) => { * c.set('message', 'Hono is cool!!') * await next() * }) * ``` */ set:

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.set: Set<IsAny<E> extends true ? { Variables: ContextVariableMap & Record<string, any>; } : E> .set() can set the value specified by the key.

@see — https://hono.dev/docs/api/context#set-get

@example
ts app.use('*', async (c, next) => { c.set('message', 'Hono is cool!!') await next() })

Set<          

interface Set<E extends Env> Interface for setting context variables.

@template E — Environment type.

IsAny

(alias) type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false import IsAny

<E> extends true          

(type parameter) E in Context<E extends Env = any, P extends string = any, I extends Input = {}>

? { // eslint-disable-next-line @typescript-eslint/no-explicit-any Variables:

(property) Variables: ContextVariableMap & Record<string, any>

ContextVariableMap &

interface ContextVariableMap Interface for context variable mapping.

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

} : E          

(type parameter) E in Context<E extends Env = any, P extends string = any, I extends Input = {}>

> = (key: string,

(parameter) key: string

value: unknown) => {          

(parameter) value: unknown

this.#var ??= new Map()          

var Map: MapConstructor new () => Map<any, any> (+3 overloads)

this.#var.set

(method) Map<unknown, unknown>.set(key: unknown, value: unknown): Map<unknown, unknown> Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.

(key,

(parameter) key: string

value)          

(parameter) value: unknown

} /** * `.get()` can use the value specified by the key. * * @see {@link https://hono.dev/docs/api/context#set-get} * * @example * ```ts * app.get('/', (c) => { * const message = c.get('message') * return c.text(`The message is "${message}"`) * }) * ``` */ get:

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.get: Get<IsAny<E> extends true ? { Variables: ContextVariableMap & Record<string, any>; } : E> .get() can use the value specified by the key.

@see — https://hono.dev/docs/api/context#set-get

@example
ts app.get('/', (c) => { const message = c.get('message') return c.text(`The message is "${message}"`) })

Get<          

interface Get<E extends Env> Interface for getting context variables.

@template E — Environment type.

IsAny

(alias) type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false import IsAny

<E> extends true          

(type parameter) E in Context<E extends Env = any, P extends string = any, I extends Input = {}>

? { // eslint-disable-next-line @typescript-eslint/no-explicit-any Variables:

(property) Variables: ContextVariableMap & Record<string, any>

ContextVariableMap &

interface ContextVariableMap Interface for context variable mapping.

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

} : E          

(type parameter) E in Context<E extends Env = any, P extends string = any, I extends Input = {}>

> = (key: string) => {          

(parameter) key: string

return this.#var ? this.#var.get

(method) Map<unknown, unknown>.get(key: unknown): unknown Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.

@returns — Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.

(key) : undefined          

(parameter) key: string

} /** * `.var` can access the value of a variable. * * @see {@link https://hono.dev/docs/api/context#var} * * @example * ```ts * const result = c.var.client.oneMethod() * ``` */ // c.var.propName is a read-only get var():

(getter) Context<E extends Env = any, P extends string = any, I extends Input = {}>.var: Readonly<ContextVariableMap & (IsAny<E["Variables"]> extends true ? Record<string, any> : E["Variables"])> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

Readonly<          

type Readonly<T> = { readonly [P in keyof T]: T[P]; } Make all properties in T readonly

// eslint-disable-next-line @typescript-eslint/no-explicit-any ContextVariableMap &

interface ContextVariableMap Interface for context variable mapping.

(IsAny

(alias) type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false import IsAny

<E['Variables']> extends true ?

(type parameter) E in Context<E extends Env = any, P extends string = any, I extends Input = {}>

Record :

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

E['Variables'])          

(type parameter) E in Context<E extends Env = any, P extends string = any, I extends Input = {}>

> { if (!this.#var) { // eslint-disable-next-line @typescript-eslint/no-explicit-any return {} as any } return Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.fromEntries(this.#var)          

(method) ObjectConstructor.fromEntries(entries: Iterable<readonly any[]>): any (+1 overload) Returns an object created by key-value entries for properties and methods

@param entries — An iterable object that contains key-value entries for properties and methods.

} newResponse:

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.newResponse: NewResponse

NewResponse = (          

interface NewResponse Interface for creating a new response.

data:

(parameter) data: Data | null

Data | null,          

type Data = string | ArrayBuffer | ReadableStream<any> Data type can be a string, ArrayBuffer, or ReadableStream.

arg?:

(parameter) arg: StatusCode | ResponseInit | undefined

StatusCode |

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

ResponseInit,          

interface ResponseInit

headers?:

(parameter) headers: HeaderRecord | undefined

HeaderRecord          

type HeaderRecord = Record<"Content-Type", BaseMime> | Record<ResponseHeader, string | string[]> | Record<string, string | string[]>

): Response => {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

// Optimized if (this.#isFresh && !headers &&

(parameter) headers: HeaderRecord | undefined

!arg && this.#status === 200) {          

(parameter) arg: StatusCode | ResponseInit | undefined

return new Response

var Response: new (body?: BodyInit | null, init?: globalThis.ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

(data, {          

(parameter) data: Data | null

headers: this.#preparedHeaders,          

(property) ResponseInit.headers?: HeadersInit | undefined

}) } if (arg && typeof

(parameter) arg: StatusCode | ResponseInit | undefined

arg !== 'number') {          

(parameter) arg: StatusCode | ResponseInit

const header = new

const header: Headers

Headers

var Headers: new (init?: HeadersInit) => Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

(arg

(parameter) arg: ResponseInit

.headers)          

(property) ResponseInit.headers?: ResponseHeadersInit | undefined

if (this.#headers) { // If the header is set by c.header() and arg.headers, c.header() will be prioritized. this.#headers.forEach(

(method) Headers.forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void

(v,

(parameter) v: string

k) => {          

(parameter) k: string

if (k === 'set-cookie') {          

(parameter) k: string

header

const header: Headers

.append

(method) Headers.append(name: string, value: string): void MDN Reference

(k,

(parameter) k: "set-cookie"

v)          

(parameter) v: string

} else { header

const header: Headers

.set

(method) Headers.set(name: string, value: string): void MDN Reference

(k,

(parameter) k: string

v)          

(parameter) v: string

} }) } const headers =

const headers: Headers

setHeaders

const setHeaders: (headers: Headers, map?: Record<string, string>) => Headers Sets the headers of a response.

@param headers — The Headers object to set the headers on.

@param map — A record of header key-value pairs to set.

@returns — The updated Headers object.

(header, this.#preparedHeaders)          

const header: Headers

return new Response

var Response: new (body?: BodyInit | null, init?: globalThis.ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

(data, {          

(parameter) data: Data | null

headers,          

(property) ResponseInit.headers?: HeadersInit | undefined

status:

(property) ResponseInit.status?: number | undefined

arg

(parameter) arg: ResponseInit

.status ?? this.#status,          

(property) ResponseInit.status?: number | undefined

}) } const status = typeof

const status: StatusCode

arg === 'number' ?

(parameter) arg: StatusCode | undefined

arg : this.#status          

(parameter) arg: StatusCode

this.#preparedHeaders ??= {} this.#headers ??= new Headers()          

var Headers: new (init?: HeadersInit) => Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

setHeaders(this.#headers, this.#preparedHeaders)          

const setHeaders: (headers: Headers, map?: Record<string, string>) => Headers Sets the headers of a response.

@param headers — The Headers object to set the headers on.

@param map — A record of header key-value pairs to set.

@returns — The updated Headers object.

if (this.#res) { this.#res.headers

(property) Response.headers: Headers MDN Reference

.forEach(

(method) Headers.forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void

(v,

(parameter) v: string

k) => {          

(parameter) k: string

if (k === 'set-cookie') {          

(parameter) k: string

this.#headers?.append

(method) Headers.append(name: string, value: string): void MDN Reference

(k,

(parameter) k: "set-cookie"

v)          

(parameter) v: string

} else { this.#headers?.set

(method) Headers.set(name: string, value: string): void MDN Reference

(k,

(parameter) k: string

v)          

(parameter) v: string

} }) setHeaders(this.#headers, this.#preparedHeaders)          

const setHeaders: (headers: Headers, map?: Record<string, string>) => Headers Sets the headers of a response.

@param headers — The Headers object to set the headers on.

@param map — A record of header key-value pairs to set.

@returns — The updated Headers object.

} headers ??= {}          

(parameter) headers: HeaderRecord | undefined

for (const [k,

const k: string

v] of

const v: string | string[]

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string | string[]>(o: { [s: string]: string | string[]; } | ArrayLike<string | string[]>): [string, string | string[]][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(headers)) {          

(parameter) headers: HeaderRecord

if (typeof v === 'string') {          

const v: string | string[]

this.#headers.set

(method) Headers.set(name: string, value: string): void MDN Reference

(k,

const k: string

v)          

const v: string

} else { this.#headers.delete

(method) Headers.delete(name: string): void MDN Reference

(k)          

const k: string

for (const v2 of

const v2: string

v) {          

const v: string[]

this.#headers.append

(method) Headers.append(name: string, value: string): void MDN Reference

(k,

const k: string

v2)          

const v2: string

} } } return new Response

var Response: new (body?: BodyInit | null, init?: globalThis.ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

(data, {          

(parameter) data: Data | null

status,          

(property) ResponseInit.status?: number | undefined

headers: this.#headers,          

(property) ResponseInit.headers?: HeadersInit | undefined

}) } /** * `.body()` can return the HTTP response. * You can set headers with `.header()` and set HTTP status code with `.status`. * This can also be set in `.text()`, `.json()` and so on. * * @see {@link https://hono.dev/docs/api/context#body} * * @example * ```ts * app.get('/welcome', (c) => { * // Set headers * c.header('X-Message', 'Hello!') * c.header('Content-Type', 'text/plain') * // Set HTTP status code * c.status(201) * * // Return the response body * return c.body('Thank you for coming') * }) * ``` */ body:

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.body: BodyRespond .body() can return the HTTP response. You can set headers with .header() and set HTTP status code with .status. This can also be set in .text(), .json() and so on.

@see — https://hono.dev/docs/api/context#body

@example
```ts app.get('/welcome', (c) => { // Set headers c.header('X-Message', 'Hello!') c.header('Content-Type', 'text/plain') // Set HTTP status code c.status(201)

// Return the response body return c.body('Thank you for coming') }) ```

BodyRespond = (          

interface BodyRespond Interface for responding with a body.

data:

(parameter) data: Data | null

Data | null,          

type Data = string | ArrayBuffer | ReadableStream<any> Data type can be a string, ArrayBuffer, or ReadableStream.

arg?:

(parameter) arg: StatusCode | ResponseInit | undefined

StatusCode |

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

ResponseInit,          

interface ResponseInit

headers?:

(parameter) headers: HeaderRecord | undefined

HeaderRecord          

type HeaderRecord = Record<"Content-Type", BaseMime> | Record<ResponseHeader, string | string[]> | Record<string, string | string[]>

): Response => {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

return typeof arg === 'number'          

(parameter) arg: StatusCode | ResponseInit | undefined

? this.newResponse

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.newResponse: NewResponse (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

(data,

(parameter) data: Data | null

arg,

(parameter) arg: StatusCode

headers)          

(parameter) headers: HeaderRecord | undefined

: this.newResponse

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.newResponse: NewResponse (data: Data | null, init?: ResponseInit) => Response (+1 overload)

(data,

(parameter) data: Data | null

arg)          

(parameter) arg: ResponseInit | undefined

} /** * `.text()` can render text as `Content-Type:text/plain`. * * @see {@link https://hono.dev/docs/api/context#text} * * @example * ```ts * app.get('/say', (c) => { * return c.text('Hello!') * }) * ``` */ text:

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond .text() can render text as Content-Type:text/plain.

@see — https://hono.dev/docs/api/context#text

@example
ts app.get('/say', (c) => { return c.text('Hello!') })

TextRespond = (          

interface TextRespond Interface for responding with text.

@interface — TextRespond

@template T — The type of the text content.

@template U — The type of the status code.

@param text — The text content to be included in the response.

@param status — An optional status code for the response.

@param headers — An optional record of headers to include in the response.

@returns — - The response after rendering the text content, typed with the provided text and status code types.

text: string,          

(parameter) text: string

arg?:

(parameter) arg: StatusCode | ResponseInit | undefined

StatusCode |

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

ResponseInit,          

interface ResponseInit

headers?:

(parameter) headers: HeaderRecord | undefined

HeaderRecord          

type HeaderRecord = Record<"Content-Type", BaseMime> | Record<ResponseHeader, string | string[]> | Record<string, string | string[]>

): ReturnType

type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any Obtain the return type of a function type

<TextRespond> => {          

interface TextRespond Interface for responding with text.

@interface — TextRespond

@template T — The type of the text content.

@template U — The type of the status code.

@param text — The text content to be included in the response.

@param status — An optional status code for the response.

@param headers — An optional record of headers to include in the response.

@returns — - The response after rendering the text content, typed with the provided text and status code types.

// If the header is empty, return Response immediately. // Content-Type will be added automatically as `text/plain`. if (!this.#preparedHeaders) { if (this.#isFresh && !headers &&

(parameter) headers: HeaderRecord | undefined

!arg) {          

(parameter) arg: StatusCode | ResponseInit | undefined

// @ts-expect-error `Response` due to missing some types-only keys return new Response

var Response: new (body?: BodyInit | null, init?: globalThis.ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

(text)          

(parameter) text: string

} this.#preparedHeaders = {} } this.#preparedHeaders['content-type'] = TEXT_PLAIN          

const TEXT_PLAIN: "text/plain; charset=UTF-8"

// @ts-expect-error `Response` due to missing some types-only keys return typeof arg === 'number'          

(parameter) arg: StatusCode | ResponseInit | undefined

? this.newResponse

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.newResponse: NewResponse (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

(text,

(parameter) text: string

arg,

(parameter) arg: StatusCode

headers)          

(parameter) headers: HeaderRecord | undefined

: this.newResponse

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.newResponse: NewResponse (data: Data | null, init?: ResponseInit) => Response (+1 overload)

(text,

(parameter) text: string

arg)          

(parameter) arg: ResponseInit | undefined

} /** * `.json()` can render JSON as `Content-Type:application/json`. * * @see {@link https://hono.dev/docs/api/context#json} * * @example * ```ts * app.get('/api', (c) => { * return c.json({ message: 'Hello!' }) * }) * ``` */ json:

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond .json() can render JSON as Content-Type:application/json.

@see — https://hono.dev/docs/api/context#json

@example
ts app.get('/api', (c) => { return c.json({ message: 'Hello!' }) })

JSONRespond = <          

interface JSONRespond Interface for responding with JSON.

@interface — JSONRespond

@template T — The type of the JSON value or simplified unknown type.

@template U — The type of the status code.

@param object — The JSON object to be included in the response.

@param status — An optional status code for the response.

@param headers — An optional record of headers to include in the response.

@returns — - The response after rendering the JSON object, typed with the provided object and status code types.

T extends

(type parameter) T in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, arg?: U | ResponseInit, headers?: HeaderRecord): JSONRespondReturn<T, U>

JSONValue |

(alias) type JSONValue = JSONObject | JSONArray | JSONPrimitive import JSONValue

SimplifyDeepArray |

(alias) type SimplifyDeepArray<T> = T extends any[] ? { [E in keyof T]: SimplifyDeepArray<T[E]>; } : { [KeyType in keyof T]: T[KeyType]; } import SimplifyDeepArray A simple extension of Simplify that will deeply traverse array elements.

InvalidJSONValue,          

(alias) type InvalidJSONValue = symbol | ((...args: unknown[]) => unknown) | undefined import InvalidJSONValue

U extends

(type parameter) U in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, arg?: U | ResponseInit, headers?: HeaderRecord): JSONRespondReturn<T, U>

StatusCode =

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

StatusCode          

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

>( object:

(parameter) object: T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue

T,          

(type parameter) T in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, arg?: U | ResponseInit, headers?: HeaderRecord): JSONRespondReturn<T, U>

arg?:

(parameter) arg: ResponseInit | U | undefined

U |

(type parameter) U in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, arg?: U | ResponseInit, headers?: HeaderRecord): JSONRespondReturn<T, U>

ResponseInit,          

interface ResponseInit

headers?:

(parameter) headers: HeaderRecord | undefined

HeaderRecord          

type HeaderRecord = Record<"Content-Type", BaseMime> | Record<ResponseHeader, string | string[]> | Record<string, string | string[]>

): JSONRespondReturn

type JSONRespondReturn<T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode> = Response & TypedResponse<SimplifyDeepArray<T> extends JSONValue ? JSONValue extends SimplifyDeepArray<T> ? never : JSONParsed<...> : never, U, "json">

@template T — The type of the JSON value or simplified unknown type.

@template U — The type of the status code.

@returns — - The response after rendering the JSON object, typed with the provided object and status code types.

<T,

(type parameter) T in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, arg?: U | ResponseInit, headers?: HeaderRecord): JSONRespondReturn<T, U>

U> => {          

(type parameter) U in <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, arg?: U | ResponseInit, headers?: HeaderRecord): JSONRespondReturn<T, U>

const body =

const body: string

JSON

var JSON: JSON An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.

.stringify

(method) JSON.stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string (+1 overload) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.

@param value — A JavaScript value, usually an object or array, to be converted.

@param replacer — A function that transforms the results.

@param space — Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.

(object)          

(parameter) object: JSONValue | {} | InvalidJSONValue

this.#preparedHeaders ??= {} this.#preparedHeaders['content-type'] = 'application/json; charset=UTF-8' /* eslint-disable @typescript-eslint/no-explicit-any */ return ( typeof arg === 'number' ? this

(parameter) arg: ResponseInit | U | undefined

.newResponse

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.newResponse: NewResponse (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

(body,

const body: string

arg,

(parameter) arg: StatusCode

headers) : this

(parameter) headers: HeaderRecord | undefined

.newResponse

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.newResponse: NewResponse (data: Data | null, init?: ResponseInit) => Response (+1 overload)

(body,

const body: string

arg)          

(parameter) arg: ResponseInit | undefined

) as any } html:

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.html: HTMLRespond

HTMLRespond = (          

interface HTMLRespond Interface representing a function that responds with HTML content.

@param html — The HTML content to respond with, which can be a string or a Promise that resolves to a string.

@param status — (Optional) The HTTP status code for the response.

@param headers — (Optional) A record of headers to include in the response.

@param init — (Optional) The response initialization object.

@returns — A Response object or a Promise that resolves to a Response object.

html: string |

(parameter) html: string | Promise<string>

Promise,          

interface Promise<T> Represents the completion of an asynchronous operation

arg?:

(parameter) arg: StatusCode | ResponseInit | undefined

StatusCode |

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

ResponseInit,          

interface ResponseInit

headers?:

(parameter) headers: HeaderRecord | undefined

HeaderRecord          

type HeaderRecord = Record<"Content-Type", BaseMime> | Record<ResponseHeader, string | string[]> | Record<string, string | string[]>

): Response |

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response> => {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

this.#preparedHeaders ??= {} this.#preparedHeaders['content-type'] = 'text/html; charset=UTF-8' if (typeof html === 'object') {          

(parameter) html: string | Promise<string>

return resolveCallback

(alias) resolveCallback(str: string | HtmlEscapedString | Promise<string>, phase: (typeof HtmlEscapedCallbackPhase)[keyof typeof HtmlEscapedCallbackPhase], preserveCallbacks: boolean, context: object, buffer?: [string]): Promise<string> import resolveCallback

(html,

(parameter) html: Promise<string>

HtmlEscapedCallbackPhase

(alias) const HtmlEscapedCallbackPhase: { readonly Stringify: 1; readonly BeforeStream: 2; readonly Stream: 3; } import HtmlEscapedCallbackPhase

@module — HTML utility.

.Stringify, false, {})

(property) Stringify: 1

.then(

(method) Promise<string>.then<Response, Response>(onfulfilled?: ((value: string) => Response | PromiseLike<Response>) | null | undefined, onrejected?: ((reason: any) => Response | PromiseLike<...>) | null | undefined): Promise<...> Attaches callbacks for the resolution and/or rejection of the Promise.

@param onfulfilled — The callback to execute when the Promise is resolved.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of which ever callback is executed.

(html) => {          

(parameter) html: string

return typeof arg === 'number'          

(parameter) arg: StatusCode | ResponseInit | undefined

? this.newResponse

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.newResponse: NewResponse (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

(html,

(parameter) html: string

arg,

(parameter) arg: StatusCode

headers)          

(parameter) headers: HeaderRecord | undefined

: this.newResponse

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.newResponse: NewResponse (data: Data | null, init?: ResponseInit) => Response (+1 overload)

(html,

(parameter) html: string

arg)          

(parameter) arg: ResponseInit | undefined

}) } return typeof arg === 'number'          

(parameter) arg: StatusCode | ResponseInit | undefined

? this.newResponse

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.newResponse: NewResponse (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

(html as string,

(parameter) html: string

arg,

(parameter) arg: StatusCode

headers)          

(parameter) headers: HeaderRecord | undefined

: this.newResponse

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.newResponse: NewResponse (data: Data | null, init?: ResponseInit) => Response (+1 overload)

(html as string,

(parameter) html: string

arg)          

(parameter) arg: ResponseInit | undefined

} /** * `.redirect()` can Redirect, default status code is 302. * * @see {@link https://hono.dev/docs/api/context#redirect} * * @example * ```ts * app.get('/redirect', (c) => { * return c.redirect('/') * }) * app.get('/redirect-permanently', (c) => { * return c.redirect('/', 301) * }) * ``` */ redirect =

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.redirect: <T extends RedirectStatusCode = 302>(location: string, status?: T) => Response & TypedResponse<undefined, T, "redirect"> .redirect() can Redirect, default status code is 302.

@see — https://hono.dev/docs/api/context#redirect

@example
ts app.get('/redirect', (c) => { return c.redirect('/') }) app.get('/redirect-permanently', (c) => { return c.redirect('/', 301) })

<T extends

(type parameter) T in <T extends RedirectStatusCode = 302>(location: string, status?: T): Response & TypedResponse<undefined, T, "redirect">

RedirectStatusCode = 302>(          

(alias) type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308 import RedirectStatusCode

location: string,          

(parameter) location: string

status?:

(parameter) status: T | undefined

T          

(type parameter) T in <T extends RedirectStatusCode = 302>(location: string, status?: T): Response & TypedResponse<undefined, T, "redirect">

): Response &

interface Response This Fetch API interface represents the response to a request.

MDN Reference

TypedResponse

(alias) type TypedResponse<T = unknown, U extends StatusCode = StatusCode, F extends ResponseFormat = T extends string ? "text" : T extends JSONValue ? "json" : string> = { _data: T; _status: U; _format: F; } import TypedResponse

T, 'redirect'> => {          

(type parameter) T in <T extends RedirectStatusCode = 302>(location: string, status?: T): Response & TypedResponse<undefined, T, "redirect">

this.#headers ??= new Headers()          

var Headers: new (init?: HeadersInit) => Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

this.#headers.set('Location',

(method) Headers.set(name: string, value: string): void MDN Reference

location)          

(parameter) location: string

return this.newResponse(null,

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.newResponse: NewResponse (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

status ?? 302) as any          

(parameter) status: RedirectStatusCode | undefined

} /** * `.notFound()` can return the Not Found Response. * * @see {@link https://hono.dev/docs/api/context#notfound} * * @example * ```ts * app.get('/notfound', (c) => { * return c.notFound() * }) * ``` */ notFound = ():

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.notFound: () => Response | Promise<Response> .notFound() can return the Not Found Response.

@see — https://hono.dev/docs/api/context#notfound

@example
ts app.get('/notfound', (c) => { return c.notFound() })

Response |

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response> => {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

this.#notFoundHandler ??= () => new Response()          

var Response: new (body?: BodyInit | null, init?: globalThis.ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

return this.#notFoundHandler(this) } }
src/helper/accepts/accepts.test.ts
            
                import { Hono } from '../..'
                import type { Accept, acceptsConfig, acceptsOptions } from './accepts'
                import { accepts, defaultMatch, parseAccept } from './accepts'
                
                describe('parseAccept', () => {
                  test('should parse accept header', () => {
                    const acceptHeader =          

const acceptHeader: "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8;level=1;foo=bar"

'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8;level=1;foo=bar' const accepts =

const accepts: Accept[]

parseAccept

(alias) parseAccept(acceptHeader: string): Accept[] import parseAccept

(acceptHeader)          

const acceptHeader: "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8;level=1;foo=bar"

expect(accepts).toEqual([          

const accepts: Accept[]

{ type: 'text/html',

(property) type: string

params: {},

(property) params: {}

q: 1 },          

(property) q: number

{ type: 'application/xhtml+xml',

(property) type: string

params: {},

(property) params: {}

q: 1 },          

(property) q: number

{ type: 'application/xml',

(property) type: string

params: {

(property) params: { q: string; }

q: '0.9' },

(property) q: string

q: 0.9 },          

(property) q: number

{ type: 'image/webp',

(property) type: string

params: {},

(property) params: {}

q: 1 },          

(property) q: number

{ type: '*/*',

(property) type: string

params: {

(property) params: { q: string; level: string; foo: string; }

q: '0.8',

(property) q: string

level: '1',

(property) level: string

foo: 'bar' },

(property) foo: string

q: 0.8 },          

(property) q: number

]) }) }) describe('defaultMatch', () => { test('should return default support', () => { const accepts:

const accepts: Accept[]

Accept[] = [          

(alias) interface Accept import Accept

{ type: 'text/html',

(property) Accept.type: string

params: {},

(property) Accept.params: Record<string, string>

q: 1 },          

(property) Accept.q: number

{ type: 'application/xhtml+xml',

(property) Accept.type: string

params: {},

(property) Accept.params: Record<string, string>

q: 1 },          

(property) Accept.q: number

{ type: 'application/xml',

(property) Accept.type: string

params: {

(property) Accept.params: Record<string, string>

q: '0.9' },

(property) q: string

q: 0.9 },          

(property) Accept.q: number

{ type: 'image/webp',

(property) Accept.type: string

params: {},

(property) Accept.params: Record<string, string>

q: 1 },          

(property) Accept.q: number

{ type: '*/*',

(property) Accept.type: string

params: {

(property) Accept.params: Record<string, string>

q: '0.8' },

(property) q: string

q: 0.8 },          

(property) Accept.q: number

] const config:

const config: acceptsConfig

acceptsConfig = {          

(alias) interface acceptsConfig import acceptsConfig

header: 'Accept',          

(property) acceptsConfig.header: AcceptHeader

supports: ['text/html'],          

(property) acceptsConfig.supports: string[]

default: 'text/html',          

(property) acceptsConfig.default: string

} const result =

const result: string

defaultMatch

(alias) defaultMatch(accepts: Accept[], config: acceptsConfig): string import defaultMatch

(accepts,

const accepts: Accept[]

config)          

const config: acceptsConfig

expect(result).toBe('text/html')          

const result: string

}) }) describe('accepts', () => { test('should return matched support', () => { const c = {          

const c: any

req: {          

(property) req: { header: () => string; }

header: () => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',          

(property) header: () => string

}, // eslint-disable-next-line @typescript-eslint/no-explicit-any } as any const options:

const options: acceptsConfig

acceptsConfig = {          

(alias) interface acceptsConfig import acceptsConfig

header: 'Accept',          

(property) acceptsConfig.header: AcceptHeader

supports: ['application/xml', 'text/html'],          

(property) acceptsConfig.supports: string[]

default: 'application/json',          

(property) acceptsConfig.default: string

} const result =

const result: string

accepts

(alias) accepts(c: Context, options: acceptsOptions): string import accepts Match the accept header with the given options.

@example
ts app.get('/users', (c) => { const lang = accepts(c, { header: 'Accept-Language', supports: ['en', 'zh'], default: 'en', }) })

(c,

const c: any

options)          

const options: acceptsConfig

expect(result).toBe('text/html')          

const result: string

}) test('should return default support if no matched support', () => { const c = {          

const c: any

req: {          

(property) req: { header: () => string; }

header: () => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',          

(property) header: () => string

}, // eslint-disable-next-line @typescript-eslint/no-explicit-any } as any const options:

const options: acceptsConfig

acceptsConfig = {          

(alias) interface acceptsConfig import acceptsConfig

header: 'Accept',          

(property) acceptsConfig.header: AcceptHeader

supports: ['application/json'],          

(property) acceptsConfig.supports: string[]

default: 'text/html',          

(property) acceptsConfig.default: string

} const result =

const result: string

accepts

(alias) accepts(c: Context, options: acceptsOptions): string import accepts Match the accept header with the given options.

@example
ts app.get('/users', (c) => { const lang = accepts(c, { header: 'Accept-Language', supports: ['en', 'zh'], default: 'en', }) })

(c,

const c: any

options)          

const options: acceptsConfig

expect(result).toBe('text/html')          

const result: string

}) test('should return default support if no accept header', () => { const c = {          

const c: any

req: {          

(property) req: { header: () => undefined; }

header: () => undefined,          

(property) header: () => undefined

}, // eslint-disable-next-line @typescript-eslint/no-explicit-any } as any const options:

const options: acceptsConfig

acceptsConfig = {          

(alias) interface acceptsConfig import acceptsConfig

header: 'Accept',          

(property) acceptsConfig.header: AcceptHeader

supports: ['application/json'],          

(property) acceptsConfig.supports: string[]

default: 'text/html',          

(property) acceptsConfig.default: string

} const result =

const result: string

accepts

(alias) accepts(c: Context, options: acceptsOptions): string import accepts Match the accept header with the given options.

@example
ts app.get('/users', (c) => { const lang = accepts(c, { header: 'Accept-Language', supports: ['en', 'zh'], default: 'en', }) })

(c,

const c: any

options)          

const options: acceptsConfig

expect(result).toBe('text/html')          

const result: string

}) test('should return matched support with custom match function', () => { const c = {          

const c: any

req: {          

(property) req: { header: () => string; }

header: () => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',          

(property) header: () => string

}, // eslint-disable-next-line @typescript-eslint/no-explicit-any } as any // this match function will return the least q value const match =

const match: (accepts: Accept[], config: acceptsConfig) => string

(accepts:

(parameter) accepts: Accept[]

Accept[],

(alias) interface Accept import Accept

config:

(parameter) config: acceptsConfig

acceptsConfig) => {          

(alias) interface acceptsConfig import acceptsConfig

const { supports,

const supports: string[]

default:

(property) acceptsConfig.default: string

defaultSupport } =

const defaultSupport: string

config          

(parameter) config: acceptsConfig

const accept =

const accept: Accept | undefined

accepts          

(parameter) accepts: Accept[]

.sort(

(method) Array<Accept>.sort(compareFn?: ((a: Accept, b: Accept) => number) | undefined): Accept[] Sorts an array in place. This method mutates the array and returns a reference to the same array.

@param compareFn
Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. ts [11,2,22,1].sort((a, b) => a - b)

(a,

(parameter) a: Accept

b) =>

(parameter) b: Accept

a

(parameter) a: Accept

.q -

(property) Accept.q: number

b

(parameter) b: Accept

.q)          

(property) Accept.q: number

.find(

(method) Array<Accept>.find(predicate: (value: Accept, index: number, obj: Accept[]) => unknown, thisArg?: any): Accept | undefined (+1 overload) Returns the value of the first element in the array where predicate is true, and undefined otherwise.

@param predicate
find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

@param thisArg
If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

(accept) =>

(parameter) accept: Accept

supports

const supports: string[]

.includes

(method) Array<string>.includes(searchElement: string, fromIndex?: number): boolean Determines whether an array includes a certain element, returning true or false as appropriate.

@param searchElement — The element to search for.

@param fromIndex — The position in this array at which to begin searching for searchElement.

(accept

(parameter) accept: Accept

.type))          

(property) Accept.type: string

return accept ?

const accept: Accept | undefined

accept

const accept: Accept

.type :

(property) Accept.type: string

defaultSupport          

const defaultSupport: string

} const options:

const options: acceptsOptions

acceptsOptions = {          

(alias) interface acceptsOptions import acceptsOptions

header: 'Accept',          

(property) acceptsConfig.header: AcceptHeader

supports: ['application/xml', 'text/html'],          

(property) acceptsConfig.supports: string[]

default: 'application/json',          

(property) acceptsConfig.default: string

match,          

(property) acceptsOptions.match?: ((accepts: Accept[], config: acceptsConfig) => string) | undefined

} const result =

const result: string

accepts

(alias) accepts(c: Context, options: acceptsOptions): string import accepts Match the accept header with the given options.

@example
ts app.get('/users', (c) => { const lang = accepts(c, { header: 'Accept-Language', supports: ['en', 'zh'], default: 'en', }) })

(c,

const c: any

options)          

const options: acceptsOptions

expect(result).toBe('application/xml')          

const result: string

}) }) describe('Usage', () => { test('decide compression by Accept-Encoding header', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/compressed', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/compressed", "/compressed", HandlerResponse<any>, BlankInput, BlankEnv>(path: "/compressed", handler: H<BlankEnv, "/compressed", BlankInput, HandlerResponse<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/compressed", BlankInput>

const encoding =

const encoding: string

accepts

(alias) accepts(c: Context, options: acceptsOptions): string import accepts Match the accept header with the given options.

@example
ts app.get('/users', (c) => { const lang = accepts(c, { header: 'Accept-Language', supports: ['en', 'zh'], default: 'en', }) })

(c, {          

(parameter) c: Context<BlankEnv, "/compressed", BlankInput>

header: 'Accept-Encoding',          

(property) acceptsConfig.header: AcceptHeader

supports: ['gzip', 'deflate'],          

(property) acceptsConfig.supports: string[]

default: 'identity',          

(property) acceptsConfig.default: string

}) const COMPRESS_DATA = 'COMPRESS_DATA'          

const COMPRESS_DATA: "COMPRESS_DATA"

const readable = new

const readable: ReadableStream<any>

ReadableStream({          

var ReadableStream: new <any>(underlyingSource: UnderlyingDefaultSource<any>, strategy?: QueuingStrategy<any> | undefined) => ReadableStream<any> (+2 overloads)

start

(property) UnderlyingDefaultSource<any>.start?: ((controller: ReadableStreamDefaultController<any>) => any) | undefined

(controller) {          

(parameter) controller: ReadableStreamDefaultController<any>

controller

(parameter) controller: ReadableStreamDefaultController<any>

.enqueue(new

(method) ReadableStreamDefaultController<any>.enqueue(chunk?: any): void MDN Reference

TextEncoder()

var TextEncoder: new () => TextEncoder TextEncoder takes a stream of code points as input and emits a stream of bytes. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays.

MDN Reference

.encode

(method) TextEncoder.encode(input?: string): Uint8Array Returns the result of running UTF-8's encoder.

MDN Reference

(COMPRESS_DATA))          

const COMPRESS_DATA: "COMPRESS_DATA"

controller

(parameter) controller: ReadableStreamDefaultController<any>

.close()          

(method) ReadableStreamDefaultController<any>.close(): void MDN Reference

}, }) if (encoding === 'gzip') {          

const encoding: string

c

(parameter) c: Context<BlankEnv, "/compressed", BlankInput>

.header('Content-Encoding', 'gzip')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: ResponseHeader, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

return c

(parameter) c: Context<BlankEnv, "/compressed", BlankInput>

.body

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.body: BodyRespond (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

(readable

const readable: ReadableStream<any>

.pipeThrough(new

(method) ReadableStream<any>.pipeThrough<any>(transform: ReadableWritablePair<any, any>, options?: StreamPipeOptions): ReadableStream<any> MDN Reference

CompressionStream('gzip')))          

var CompressionStream: new (format: CompressionFormat) => CompressionStream MDN Reference

} if (encoding === 'deflate') {          

const encoding: string

c

(parameter) c: Context<BlankEnv, "/compressed", BlankInput>

.header('Content-Encoding', 'deflate')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: ResponseHeader, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

return c

(parameter) c: Context<BlankEnv, "/compressed", BlankInput>

.body

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.body: BodyRespond (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

(readable

const readable: ReadableStream<any>

.pipeThrough(new

(method) ReadableStream<any>.pipeThrough<any>(transform: ReadableWritablePair<any, any>, options?: StreamPipeOptions): ReadableStream<any> MDN Reference

CompressionStream('deflate')))          

var CompressionStream: new (format: CompressionFormat) => CompressionStream MDN Reference

} c

(parameter) c: Context<BlankEnv, "/compressed", BlankInput>

.body

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.body: BodyRespond (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

(COMPRESS_DATA)          

const COMPRESS_DATA: "COMPRESS_DATA"

}) const req1 = await

const req1: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/compressed', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: { 'Accept-Encoding': 'deflate' } })          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

const req2 = await

const req2: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/compressed', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: { 'Accept-Encoding': 'gzip' } })          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

const req3 = await

const req3: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/compressed', {          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: { 'Accept-Encoding': 'gzip;q=0.5,deflate' },          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

}) const req4 = await

const req4: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/compressed', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: { 'Accept-Encoding': 'br' } })          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

expect(req1

const req1: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Encoding')).toBe('deflate')          

(method) Headers.get(name: string): string | null MDN Reference

expect(req2

const req2: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Encoding')).toBe('gzip')          

(method) Headers.get(name: string): string | null MDN Reference

expect(req3

const req3: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Encoding')).toBe('deflate')          

(method) Headers.get(name: string): string | null MDN Reference

expect(req4

const req4: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Encoding')).toBeNull()          

(method) Headers.get(name: string): string | null MDN Reference

}) test('decide language by Accept-Language header', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const SUPPORTED_LANGS = ['en', 'ja', 'zh']          

const SUPPORTED_LANGS: string[]

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/*', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/*", "/*", Promise<Response>, BlankInput, BlankEnv>(path: "/*", handler: H<BlankEnv, "/*", BlankInput, Promise<Response>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/*", BlankInput>

const lang =

const lang: string

accepts

(alias) accepts(c: Context, options: acceptsOptions): string import accepts Match the accept header with the given options.

@example
ts app.get('/users', (c) => { const lang = accepts(c, { header: 'Accept-Language', supports: ['en', 'zh'], default: 'en', }) })

(c, {          

(parameter) c: Context<BlankEnv, "/*", BlankInput>

header: 'Accept-Language',          

(property) acceptsConfig.header: AcceptHeader

supports:

(property) acceptsConfig.supports: string[]

SUPPORTED_LANGS,          

const SUPPORTED_LANGS: string[]

default: 'en',          

(property) acceptsConfig.default: string

}) const isLangedPath =

const isLangedPath: boolean

SUPPORTED_LANGS

const SUPPORTED_LANGS: string[]

.some(

(method) Array<string>.some(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean Determines whether the specified callback function returns true for any element of an array.

@param predicate
A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

@param thisArg
An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

(l) =>

(parameter) l: string

c

(parameter) c: Context<BlankEnv, "/*", BlankInput>

.req

(property) Context<BlankEnv, "/*", BlankInput>.req: HonoRequest<"/*", unknown> .req is the instance of HonoRequest.

.path

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.path: string .path can get the pathname of the request.

@see — https://hono.dev/docs/api/request#path

@example
ts app.get('/about/me', (c) => { const pathname = c.req.path // `/about/me` })

.startsWith(`/$

(method) String.startsWith(searchString: string, position?: number): boolean Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false.

{l}`))          

(parameter) l: string

if (isLangedPath) {          

const isLangedPath: boolean

return c

(parameter) c: Context<BlankEnv, "/*", BlankInput>

.body(`lang: $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.body: BodyRespond (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

{lang}`)          

const lang: string

} return c

(parameter) c: Context<BlankEnv, "/*", BlankInput>

.redirect(`/$

(property) Context<BlankEnv, "/*", BlankInput>.redirect: <302>(location: string, status?: 302 | undefined) => Response & TypedResponse<undefined, 302, "redirect"> .redirect() can Redirect, default status code is 302.

@see — https://hono.dev/docs/api/context#redirect

@example
ts app.get('/redirect', (c) => { return c.redirect('/') }) app.get('/redirect-permanently', (c) => { return c.redirect('/', 301) })

{lang}$

const lang: string

{c

(parameter) c: Context<BlankEnv, "/*", BlankInput>

.req

(property) Context<BlankEnv, "/*", BlankInput>.req: HonoRequest<"/*", unknown> .req is the instance of HonoRequest.

.path}`)          

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.path: string .path can get the pathname of the request.

@see — https://hono.dev/docs/api/request#path

@example
ts app.get('/about/me', (c) => { const pathname = c.req.path // `/about/me` })

}) const req1 = await

const req1: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/foo', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: { 'Accept-Language': 'en=0.8,ja' } })          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

const req2 = await

const req2: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/en/foo', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: { 'Accept-Language': 'en' } })          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

expect(req1

const req1: Response

.status).toBe(302)          

(property) Response.status: number MDN Reference

expect(req1

const req1: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Location')).toBe('/ja/foo')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await req2

const req2: Response

.text()).toBe('lang: en')          

(method) Body.text(): Promise<string> MDN Reference

}) })
src/helper/accepts/accepts.ts
            
                import type { Context } from '../../context'
                
                export type AcceptHeader =          

type AcceptHeader = "Accept" | "Accept-Charset" | "Accept-Encoding" | "Accept-Language" | "Accept-Patch" | "Accept-Post" | "Accept-Ranges"

| 'Accept' | 'Accept-Charset' | 'Accept-Encoding' | 'Accept-Language' | 'Accept-Patch' | 'Accept-Post' | 'Accept-Ranges' export interface Accept {          

interface Accept

type: string          

(property) Accept.type: string

params:

(property) Accept.params: Record<string, string>

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

q: number          

(property) Accept.q: number

} export interface acceptsConfig {          

interface acceptsConfig

header:

(property) acceptsConfig.header: AcceptHeader

AcceptHeader          

type AcceptHeader = "Accept" | "Accept-Charset" | "Accept-Encoding" | "Accept-Language" | "Accept-Patch" | "Accept-Post" | "Accept-Ranges"

supports: string[]          

(property) acceptsConfig.supports: string[]

default: string          

(property) acceptsConfig.default: string

} export interface acceptsOptions extends

interface acceptsOptions

acceptsConfig {          

interface acceptsConfig

match?:

(property) acceptsOptions.match?: ((accepts: Accept[], config: acceptsConfig) => string) | undefined

(accepts:

(parameter) accepts: Accept[]

Accept[],

interface Accept

config:

(parameter) config: acceptsConfig

acceptsConfig) => string          

interface acceptsConfig

} export const parseAccept =

const parseAccept: (acceptHeader: string) => Accept[]

(acceptHeader: string):

(parameter) acceptHeader: string

Accept[] => {          

interface Accept

// Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 const accepts =

const accepts: string[]

acceptHeader

(parameter) acceptHeader: string

.split(',') // ['text/html', 'application/xhtml+xml', 'application/xml;q=0.9', 'image/webp', '*/*;q=0.8']          

(method) String.split(separator: string | RegExp, limit?: number): string[] (+1 overload) Split a string into substrings using the specified separator and return them as an array.

@param separator — A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.

@param limit — A value used to limit the number of elements returned in the array.

return accepts

const accepts: string[]

.map(

(method) Array<string>.map<{ type: string; params: { [key: string]: string; }; q: number; }>(callbackfn: (value: string, index: number, array: string[]) => { type: string; params: { [key: string]: string; }; q: number; }, thisArg?: any): { type: string; params: { [key: string]: string; }; q: number; }[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(accept) => {          

(parameter) accept: string

const parts =

const parts: string[]

accept

(parameter) accept: string

.trim()

(method) String.trim(): string Removes the leading and trailing white space and line terminator characters from a string.

.split(';') // ['text/html', 'q=0.9', 'image/webp']          

(method) String.split(separator: string | RegExp, limit?: number): string[] (+1 overload) Split a string into substrings using the specified separator and return them as an array.

@param separator — A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.

@param limit — A value used to limit the number of elements returned in the array.

const type =

const type: string

parts[0] // text/html          

const parts: string[]

const params =

const params: string[]

parts

const parts: string[]

.slice(1) // ['q=0.9', 'image/webp']          

(method) Array<string>.slice(start?: number, end?: number): string[] Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array.

@param start
The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.

@param end
The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the array.

const q =

const q: string | undefined

params

const params: string[]

.find(

(method) Array<string>.find(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined (+1 overload) Returns the value of the first element in the array where predicate is true, and undefined otherwise.

@param predicate
find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

@param thisArg
If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

(param) =>

(parameter) param: string

param

(parameter) param: string

.startsWith('q='))          

(method) String.startsWith(searchString: string, position?: number): boolean Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false.

const paramsObject =

const paramsObject: { [key: string]: string; }

params

const params: string[]

.reduce(

(method) Array<string>.reduce<{ [key: string]: string; }>(callbackfn: (previousValue: { [key: string]: string; }, currentValue: string, currentIndex: number, array: string[]) => { [key: string]: string; }, initialValue: { [key: string]: string; }): { [key: string]: string; } (+2 overloads) Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

@param callbackfn — A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

@param initialValue — If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

(acc,

(parameter) acc: { [key: string]: string; }

param) => {          

(parameter) param: string

const keyValue =

const keyValue: string[]

param

(parameter) param: string

.split('=')          

(method) String.split(separator: string | RegExp, limit?: number): string[] (+1 overload) Split a string into substrings using the specified separator and return them as an array.

@param separator — A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.

@param limit — A value used to limit the number of elements returned in the array.

const key =

const key: string

keyValue[0]

const keyValue: string[]

.trim()          

(method) String.trim(): string Removes the leading and trailing white space and line terminator characters from a string.

const value =

const value: string

keyValue[1]

const keyValue: string[]

.trim()          

(method) String.trim(): string Removes the leading and trailing white space and line terminator characters from a string.

acc

(parameter) acc: { [key: string]: string; }

[key] =

const key: string

value          

const value: string

return acc          

(parameter) acc: { [key: string]: string; }

}, {} as { [key: string]: string })          

(parameter) key: string

return { type:

(property) type: string

type,          

const type: string

params:

(property) params: { [key: string]: string; }

paramsObject,          

const paramsObject: { [key: string]: string; }

q:

(property) q: number

q ?

const q: string | undefined

parseFloat

function parseFloat(string: string): number Converts a string to a floating-point number.

@param string — A string that contains a floating-point number.

(q

const q: string

.split('=')[1]) : 1,          

(method) String.split(separator: string | RegExp, limit?: number): string[] (+1 overload) Split a string into substrings using the specified separator and return them as an array.

@param separator — A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.

@param limit — A value used to limit the number of elements returned in the array.

} }) } export const defaultMatch =

const defaultMatch: (accepts: Accept[], config: acceptsConfig) => string

(accepts:

(parameter) accepts: Accept[]

Accept[],

interface Accept

config:

(parameter) config: acceptsConfig

acceptsConfig): string => {          

interface acceptsConfig

const { supports,

const supports: string[]

default:

(property) acceptsConfig.default: string

defaultSupport } =

const defaultSupport: string

config          

(parameter) config: acceptsConfig

const accept =

const accept: Accept | undefined

accepts

(parameter) accepts: Accept[]

.sort(

(method) Array<Accept>.sort(compareFn?: ((a: Accept, b: Accept) => number) | undefined): Accept[] Sorts an array in place. This method mutates the array and returns a reference to the same array.

@param compareFn
Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. ts [11,2,22,1].sort((a, b) => a - b)

(a,

(parameter) a: Accept

b) =>

(parameter) b: Accept

b

(parameter) b: Accept

.q -

(property) Accept.q: number

a

(parameter) a: Accept

.q)

(property) Accept.q: number

.find(

(method) Array<Accept>.find(predicate: (value: Accept, index: number, obj: Accept[]) => unknown, thisArg?: any): Accept | undefined (+1 overload) Returns the value of the first element in the array where predicate is true, and undefined otherwise.

@param predicate
find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

@param thisArg
If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

(accept) =>

(parameter) accept: Accept

supports

const supports: string[]

.includes

(method) Array<string>.includes(searchElement: string, fromIndex?: number): boolean Determines whether an array includes a certain element, returning true or false as appropriate.

@param searchElement — The element to search for.

@param fromIndex — The position in this array at which to begin searching for searchElement.

(accept

(parameter) accept: Accept

.type))          

(property) Accept.type: string

return accept ?

const accept: Accept | undefined

accept

const accept: Accept

.type :

(property) Accept.type: string

defaultSupport          

const defaultSupport: string

} /** * Match the accept header with the given options. * @example * ```ts * app.get('/users', (c) => { * const lang = accepts(c, { * header: 'Accept-Language', * supports: ['en', 'zh'], * default: 'en', * }) * }) * ``` */ export const accepts =

const accepts: (c: Context, options: acceptsOptions) => string Match the accept header with the given options.

@example
ts app.get('/users', (c) => { const lang = accepts(c, { header: 'Accept-Language', supports: ['en', 'zh'], default: 'en', }) })

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

options:

(parameter) options: acceptsOptions

acceptsOptions): string => {          

interface acceptsOptions

const acceptHeader =

const acceptHeader: string | undefined

c

(parameter) c: Context<any, any, {}>

.req

(property) Context<any, any, {}>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.header

(method) HonoRequest<any, unknown>.header(name: string): string | undefined (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

(options

(parameter) options: acceptsOptions

.header)          

(property) acceptsConfig.header: AcceptHeader

if (!acceptHeader) {          

const acceptHeader: string | undefined

return options

(parameter) options: acceptsOptions

.default          

(property) acceptsConfig.default: string

} const accepts =

const accepts: Accept[]

parseAccept

const parseAccept: (acceptHeader: string) => Accept[]

(acceptHeader)          

const acceptHeader: string

const match =

const match: (accepts: Accept[], config: acceptsConfig) => string

options

(parameter) options: acceptsOptions

.match ||

(property) acceptsOptions.match?: ((accepts: Accept[], config: acceptsConfig) => string) | undefined

defaultMatch          

const defaultMatch: (accepts: Accept[], config: acceptsConfig) => string

return match

const match: (accepts: Accept[], config: acceptsConfig) => string

(accepts,

const accepts: Accept[]

options)          

(parameter) options: acceptsOptions

}
src/helper/accepts/index.ts
            
                /**
                 * @module
                 * Accepts Helper for Hono.
                 */
                
                export { accepts } from './accepts'          

(alias) const accepts: (c: Context, options: acceptsOptions) => string export accepts Match the accept header with the given options.

@example
ts app.get('/users', (c) => { const lang = accepts(c, { header: 'Accept-Language', supports: ['en', 'zh'], default: 'en', }) })

src/helper/adapter/index.test.ts
            
                import { getRuntimeKey } from '.'
                
                describe('getRuntimeKey', () => {
                  it('Should return the current runtime key', () => {
                    // Now, using the `bun run test` command.
                    // But `vitest` depending Node.js will run this test so the RuntimeKey will be `node`.
                    expect(getRuntimeKey()).toBe('node')          

(alias) getRuntimeKey(): Runtime import getRuntimeKey

}) })
src/helper/adapter/index.ts
            
                /**
                 * @module
                 * Adapter Helper for Hono.
                 */
                
                import type { Context } from '../../context'
                
                export type Runtime = 'node' | 'deno' | 'bun' | 'workerd' | 'fastly' | 'edge-light' | 'other'          

type Runtime = "node" | "deno" | "bun" | "workerd" | "fastly" | "edge-light" | "other"

export const env =

const env: <T extends Record<string, unknown>, C extends Context = Context<{}, any, {}>>(c: C, runtime?: Runtime) => T & C["env"]

<T extends

(type parameter) T in <T extends Record<string, unknown>, C extends Context = Context<{}, any, {}>>(c: C, runtime?: Runtime): T & C["env"]

Record,

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

C extends

(type parameter) C in <T extends Record<string, unknown>, C extends Context = Context<{}, any, {}>>(c: C, runtime?: Runtime): T & C["env"]

Context =

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

Context<{}>>(          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

c:

(parameter) c: C extends Context = Context<{}, any, {}>

C,          

(type parameter) C in <T extends Record<string, unknown>, C extends Context = Context<{}, any, {}>>(c: C, runtime?: Runtime): T & C["env"]

runtime?:

(parameter) runtime: Runtime | undefined

Runtime          

type Runtime = "node" | "deno" | "bun" | "workerd" | "fastly" | "edge-light" | "other"

): T &

(type parameter) T in <T extends Record<string, unknown>, C extends Context = Context<{}, any, {}>>(c: C, runtime?: Runtime): T & C["env"]

C['env'] => {          

(type parameter) C in <T extends Record<string, unknown>, C extends Context = Context<{}, any, {}>>(c: C, runtime?: Runtime): T & C["env"]

// eslint-disable-next-line @typescript-eslint/no-explicit-any const global = globalThis as any          

const global: any

const globalEnv =

const globalEnv: T extends Record<string, unknown>

global?.process?.env as

const global: any

T          

(type parameter) T in <T extends Record<string, unknown>, C extends Context = Context<{}, any, {}>>(c: C, runtime?: Runtime): T & C["env"]

runtime ??=

(parameter) runtime: Runtime | undefined

getRuntimeKey()          

const getRuntimeKey: () => Runtime

const runtimeEnvHandlers:

const runtimeEnvHandlers: Record<string, () => T>

Record

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

T> = {          

(type parameter) T in <T extends Record<string, unknown>, C extends Context = Context<{}, any, {}>>(c: C, runtime?: Runtime): T & C["env"]

bun: () =>

(property) bun: () => T

globalEnv,          

const globalEnv: T extends Record<string, unknown>

node: () =>

(property) node: () => T

globalEnv,          

const globalEnv: T extends Record<string, unknown>

'edge-light': () => globalEnv,          

const globalEnv: T extends Record<string, unknown>

deno: () => {          

(property) deno: () => T

// eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore return Deno.env.toObject() as

namespace Deno

T          

(type parameter) T in <T extends Record<string, unknown>, C extends Context = Context<{}, any, {}>>(c: C, runtime?: Runtime): T & C["env"]

}, workerd: () =>

(property) workerd: () => any

c

(parameter) c: C extends Context = Context<{}, any, {}>

.env,          

(property) Context<any, any, {}>.env: any .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

// On Fastly Compute, you can use the ConfigStore to manage user-defined data. fastly: () => ({} as

(property) fastly: () => T

T),          

(type parameter) T in <T extends Record<string, unknown>, C extends Context = Context<{}, any, {}>>(c: C, runtime?: Runtime): T & C["env"]

other: () => ({} as

(property) other: () => T

T),          

(type parameter) T in <T extends Record<string, unknown>, C extends Context = Context<{}, any, {}>>(c: C, runtime?: Runtime): T & C["env"]

} return runtimeEnvHandlers

const runtimeEnvHandlers: Record<string, () => T>

[runtime]()          

(parameter) runtime: Runtime

} export const knownUserAgents:

const knownUserAgents: Partial<Record<Runtime, string>>

Partial

type Partial<T> = { [P in keyof T]?: T[P] | undefined; } Make all properties in T optional

<Record

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

<Runtime, string>> = {          

type Runtime = "node" | "deno" | "bun" | "workerd" | "fastly" | "edge-light" | "other"

deno: 'Deno',          

(property) deno?: string | undefined

bun: 'Bun',          

(property) bun?: string | undefined

workerd: 'Cloudflare-Workers',          

(property) workerd?: string | undefined

node: 'Node.js',          

(property) node?: string | undefined

} export const getRuntimeKey = ():

const getRuntimeKey: () => Runtime

Runtime => {          

type Runtime = "node" | "deno" | "bun" | "workerd" | "fastly" | "edge-light" | "other"

// eslint-disable-next-line @typescript-eslint/no-explicit-any const global = globalThis as any          

const global: any

// check if the current runtime supports navigator.userAgent const userAgentSupported =          

const userAgentSupported: boolean

typeof navigator !== 'undefined' && typeof

var navigator: Navigator MDN Reference

navigator

var navigator: Navigator MDN Reference

.userAgent === 'string'          

(property) NavigatorID.userAgent: string MDN Reference

// if supported, check the user agent if (userAgentSupported) {          

const userAgentSupported: boolean

for (const [runtimeKey,

const runtimeKey: string

userAgent] of

const userAgent: string

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<string>(o: { [s: string]: string; } | ArrayLike<string>): [string, string][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(knownUserAgents)) {          

const knownUserAgents: Partial<Record<Runtime, string>>

if (checkUserAgentEquals

const checkUserAgentEquals: (platform: string) => boolean

(userAgent)) {          

const userAgent: string

return runtimeKey as

const runtimeKey: string

Runtime          

type Runtime = "node" | "deno" | "bun" | "workerd" | "fastly" | "edge-light" | "other"

} } } // check if running on Edge Runtime if (typeof global?.EdgeRuntime === 'string') {          

const global: any

return 'edge-light' } // check if running on Fastly if (global?.fastly !== undefined) {          

const global: any

return 'fastly' } // userAgent isn't supported before Node v21.1.0; so fallback to the old way if (global?.process?.release?.name === 'node') {          

const global: any

return 'node' } // couldn't detect the runtime return 'other' } export const checkUserAgentEquals =

const checkUserAgentEquals: (platform: string) => boolean

(platform: string): boolean => {          

(parameter) platform: string

const userAgent =

const userAgent: string

navigator

var navigator: Navigator MDN Reference

.userAgent          

(property) NavigatorID.userAgent: string MDN Reference

return userAgent

const userAgent: string

.startsWith

(method) String.startsWith(searchString: string, position?: number): boolean Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false.

(platform)          

(parameter) platform: string

}
src/helper/conninfo/index.ts
            
                /**
                 * @module
                 * ConnInfo Helper for Hono.
                 */
                
                export type { AddressType,

(alias) type AddressType = "IPv6" | "IPv4" | undefined export AddressType

NetAddrInfo,

(alias) type NetAddrInfo = { transport?: "tcp" | "udp"; port?: number; address?: string; addressType?: AddressType; } | ({ transport?: "tcp" | "udp"; port?: number; address?: string; addressType?: AddressType; } & { ...; }) export NetAddrInfo

ConnInfo,

(alias) interface ConnInfo export ConnInfo HTTP Connection information

GetConnInfo } from './types'          

(alias) type GetConnInfo = (c: Context) => ConnInfo export GetConnInfo Helper type

src/helper/conninfo/types.ts
            
                import type { Context } from '../../context'
                
                export type AddressType = 'IPv6' | 'IPv4' | undefined          

type AddressType = "IPv6" | "IPv4" | undefined

export type NetAddrInfo = {          

type NetAddrInfo = { transport?: "tcp" | "udp"; port?: number; address?: string; addressType?: AddressType; } | ({ transport?: "tcp" | "udp"; port?: number; address?: string; addressType?: AddressType; } & { ...; })

/** * Transport protocol type */ transport?: 'tcp' | 'udp'          

(property) transport?: "tcp" | "udp" | undefined Transport protocol type

/** * Transport port number */ port?: number          

(property) port?: number | undefined Transport port number

address?: string          

(property) address?: string | undefined

addressType?:

(property) addressType?: AddressType

AddressType          

type AddressType = "IPv6" | "IPv4" | undefined

} & ( | { /** * Host name such as IP Addr */ address: string          

(property) address: string Host name such as IP Addr

/** * Host name type */ addressType:

(property) addressType: AddressType Host name type

AddressType          

type AddressType = "IPv6" | "IPv4" | undefined

} | {} ) /** * HTTP Connection information */ export interface ConnInfo {          

interface ConnInfo HTTP Connection information

/** * Remote information */ remote:

(property) ConnInfo.remote: NetAddrInfo Remote information

NetAddrInfo          

type NetAddrInfo = { transport?: "tcp" | "udp"; port?: number; address?: string; addressType?: AddressType; } | ({ transport?: "tcp" | "udp"; port?: number; address?: string; addressType?: AddressType; } & { ...; })

} /** * Helper type */ export type GetConnInfo =

type GetConnInfo = (c: Context) => ConnInfo Helper type

(c:

(parameter) c: Context<any, any, {}>

Context) =>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

ConnInfo          

interface ConnInfo HTTP Connection information

src/helper/cookie/index.test.ts
            
                import { Hono } from '../../hono'
                import { deleteCookie, getCookie, getSignedCookie, setCookie, setSignedCookie } from '.'
                
                describe('Cookie Middleware', () => {
                  describe('Parse cookie', () => {
                    const apps:

const apps: Record<string, Hono<BlankEnv, BlankSchema, "/">>

Record

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

Hono> = {}          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

apps['get by name'] = (() => {          

const apps: Record<string, Hono<BlankEnv, BlankSchema, "/">>

const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/cookie',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/cookie", "/cookie", Response, BlankInput, BlankEnv>(path: "/cookie", handler: H<BlankEnv, "/cookie", BlankInput, Response>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/cookie", BlankInput>

const yummyCookie =

const yummyCookie: string | undefined

getCookie

(alias) getCookie(c: Context, key: string): string | undefined (+2 overloads) import getCookie

(c, 'yummy_cookie')          

(parameter) c: Context<BlankEnv, "/cookie", BlankInput>

const tastyCookie =

const tastyCookie: string | undefined

getCookie

(alias) getCookie(c: Context, key: string): string | undefined (+2 overloads) import getCookie

(c, 'tasty_cookie')          

(parameter) c: Context<BlankEnv, "/cookie", BlankInput>

const res = new

const res: Response

Response('Good cookie')          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

if (yummyCookie &&

const yummyCookie: string | undefined

tastyCookie) {          

const tastyCookie: string | undefined

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.set('Yummy-Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

yummyCookie)          

const yummyCookie: string

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.set('Tasty-Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

tastyCookie)          

const tastyCookie: string

} return res          

const res: Response

}) return app          

const app: Hono<BlankEnv, BlankSchema, "/">

})() apps['get all as an object'] = (() => {          

const apps: Record<string, Hono<BlankEnv, BlankSchema, "/">>

const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/cookie',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/cookie", "/cookie", Response, BlankInput, BlankEnv>(path: "/cookie", handler: H<BlankEnv, "/cookie", BlankInput, Response>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/cookie", BlankInput>

const { yummy_cookie: yummyCookie, tasty_cookie:

const yummyCookie: string

tastyCookie } =

const tastyCookie: string

getCookie

(alias) getCookie(c: Context): Cookie (+2 overloads) import getCookie

(c)          

(parameter) c: Context<BlankEnv, "/cookie", BlankInput>

const res = new

const res: Response

Response('Good cookie')          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.set('Yummy-Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

yummyCookie)          

const yummyCookie: string

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.set('Tasty-Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

tastyCookie)          

const tastyCookie: string

return res          

const res: Response

}) return app          

const app: Hono<BlankEnv, BlankSchema, "/">

})() describe.each(Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.keys

(method) ObjectConstructor.keys(o: {}): string[] (+1 overload) Returns the names of the enumerable string properties and methods of an object.

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(apps))('%s',

const apps: Record<string, Hono<BlankEnv, BlankSchema, "/">>

(name) => {          

(parameter) name: any

const app =

const app: Hono<BlankEnv, BlankSchema, "/">

apps

const apps: Record<string, Hono<BlankEnv, BlankSchema, "/">>

[name]          

(parameter) name: any

it('Parse cookie with getCookie()', async () => { const req = new

const req: Request

Request('http://localhost/cookie')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const cookieString = 'yummy_cookie=choco; tasty_cookie = strawberry'          

const cookieString: "yummy_cookie=choco; tasty_cookie = strawberry"

req

const req: Request

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.set('Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

cookieString)          

const cookieString: "yummy_cookie=choco; tasty_cookie = strawberry"

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Yummy-Cookie')).toBe('choco')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Tasty-Cookie')).toBe('strawberry')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/cookie-signed-get-all', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/cookie-signed-get-all", "/cookie-signed-get-all", Promise<Response>, BlankInput, BlankEnv>(path: "/cookie-signed-get-all", handler: H<BlankEnv, "/cookie-signed-get-all", BlankInput, Promise<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/cookie-signed-get-all", BlankInput>

const secret = 'secret lucky charm'          

const secret: "secret lucky charm"

const { fortune_cookie: fortuneCookie, fruit_cookie:

const fortuneCookie: string | false

fruitCookie } = await

const fruitCookie: string | false

getSignedCookie(          

(alias) getSignedCookie(c: Context, secret: string): Promise<SignedCookie> (+2 overloads) import getSignedCookie

c,          

(parameter) c: Context<BlankEnv, "/cookie-signed-get-all", BlankInput>

secret          

const secret: "secret lucky charm"

) const res = new

const res: Response

Response('Signed fortune cookie')          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

if (typeof fortuneCookie !== 'undefined' && typeof

const fortuneCookie: string | false

fruitCookie !== 'undefined') {          

const fruitCookie: string | false

// just examples for tests sake res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.set('Fortune-Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

fortuneCookie || 'INVALID')          

const fortuneCookie: string | false

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.set('Fruit-Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

fruitCookie || 'INVALID')          

const fruitCookie: string | false

} return res          

const res: Response

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/cookie-signed-get-one', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/cookie-signed-get-one", "/cookie-signed-get-one", Promise<Response>, BlankInput, BlankEnv>(path: "/cookie-signed-get-one", handler: H<BlankEnv, "/cookie-signed-get-one", BlankInput, Promise<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/cookie-signed-get-one", BlankInput>

const secret = 'secret lucky charm'          

const secret: "secret lucky charm"

const fortuneCookie = await

const fortuneCookie: string | false | undefined

getSignedCookie

(alias) getSignedCookie(c: Context, secret: string | BufferSource, key: string): Promise<string | undefined | false> (+2 overloads) import getSignedCookie

(c,

(parameter) c: Context<BlankEnv, "/cookie-signed-get-one", BlankInput>

secret, 'fortune_cookie')          

const secret: "secret lucky charm"

const res = new

const res: Response

Response('Signed fortune cookie')          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

if (typeof fortuneCookie !== 'undefined') {          

const fortuneCookie: string | false | undefined

// just an example for tests sake res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.set('Fortune-Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

fortuneCookie || 'INVALID')          

const fortuneCookie: string | false

} return res          

const res: Response

}) it('Get signed cookies', async () => { const req = new

const req: Request

Request('http://localhost/cookie-signed-get-all')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const cookieString =          

const cookieString: "fortune_cookie=lots-of-money.UO6vMygDM6NCDU4LdvBnzdVb2Xcdj+h+ZTnmS8X7iH8%3D; fruit_cookie=mango.lRwgtW9ooM9%2Fd9ZZA%2FInNRG64CbQsfWGXQyFLPM9520%3D"

'fortune_cookie=lots-of-money.UO6vMygDM6NCDU4LdvBnzdVb2Xcdj+h+ZTnmS8X7iH8%3D; fruit_cookie=mango.lRwgtW9ooM9%2Fd9ZZA%2FInNRG64CbQsfWGXQyFLPM9520%3D' req

const req: Request

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.set('Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

cookieString)          

const cookieString: "fortune_cookie=lots-of-money.UO6vMygDM6NCDU4LdvBnzdVb2Xcdj+h+ZTnmS8X7iH8%3D; fruit_cookie=mango.lRwgtW9ooM9%2Fd9ZZA%2FInNRG64CbQsfWGXQyFLPM9520%3D"

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Fortune-Cookie')).toBe('lots-of-money')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Fruit-Cookie')).toBe('mango')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Get signed cookies invalid signature', async () => { const req = new

const req: Request

Request('http://localhost/cookie-signed-get-all')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

// fruit_cookie has invalid signature const cookieString =          

const cookieString: "fortune_cookie=lots-of-money.UO6vMygDM6NCDU4LdvBnzdVb2Xcdj+h+ZTnmS8X7iH8%3D; fruit_cookie=mango.LAa7RX43t2vCrLNcKmNG65H41OkyV02sraRPuY5RuVg%3D"

'fortune_cookie=lots-of-money.UO6vMygDM6NCDU4LdvBnzdVb2Xcdj+h+ZTnmS8X7iH8%3D; fruit_cookie=mango.LAa7RX43t2vCrLNcKmNG65H41OkyV02sraRPuY5RuVg%3D' req

const req: Request

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.set('Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

cookieString)          

const cookieString: "fortune_cookie=lots-of-money.UO6vMygDM6NCDU4LdvBnzdVb2Xcdj+h+ZTnmS8X7iH8%3D; fruit_cookie=mango.LAa7RX43t2vCrLNcKmNG65H41OkyV02sraRPuY5RuVg%3D"

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Fortune-Cookie')).toBe('lots-of-money')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Fruit-Cookie')).toBe('INVALID')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Get signed cookie', async () => { const req = new

const req: Request

Request('http://localhost/cookie-signed-get-one')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const cookieString =          

const cookieString: "fortune_cookie=lots-of-money.UO6vMygDM6NCDU4LdvBnzdVb2Xcdj+h+ZTnmS8X7iH8%3D; fruit_cookie=mango.lRwgtW9ooM9%2Fd9ZZA%2FInNRG64CbQsfWGXQyFLPM9520%3D"

'fortune_cookie=lots-of-money.UO6vMygDM6NCDU4LdvBnzdVb2Xcdj+h+ZTnmS8X7iH8%3D; fruit_cookie=mango.lRwgtW9ooM9%2Fd9ZZA%2FInNRG64CbQsfWGXQyFLPM9520%3D' req

const req: Request

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.set('Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

cookieString)          

const cookieString: "fortune_cookie=lots-of-money.UO6vMygDM6NCDU4LdvBnzdVb2Xcdj+h+ZTnmS8X7iH8%3D; fruit_cookie=mango.lRwgtW9ooM9%2Fd9ZZA%2FInNRG64CbQsfWGXQyFLPM9520%3D"

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Fortune-Cookie')).toBe('lots-of-money')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Get signed cookie witn invalid signature', async () => { const req = new

const req: Request

Request('http://localhost/cookie-signed-get-one')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

// fortune_cookie has invalid signature const cookieString =          

const cookieString: "fortune_cookie=lots-of-money.LAa7RX43t2vCrLNcKmNG65H41OkyV02sraRPuY5RuVg=; fruit_cookie=mango.lRwgtW9ooM9%2Fd9ZZA%2FInNRG64CbQsfWGXQyFLPM9520%3D"

'fortune_cookie=lots-of-money.LAa7RX43t2vCrLNcKmNG65H41OkyV02sraRPuY5RuVg=; fruit_cookie=mango.lRwgtW9ooM9%2Fd9ZZA%2FInNRG64CbQsfWGXQyFLPM9520%3D' req

const req: Request

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.set('Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

cookieString)          

const cookieString: "fortune_cookie=lots-of-money.LAa7RX43t2vCrLNcKmNG65H41OkyV02sraRPuY5RuVg=; fruit_cookie=mango.lRwgtW9ooM9%2Fd9ZZA%2FInNRG64CbQsfWGXQyFLPM9520%3D"

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Fortune-Cookie')).toBe('INVALID')          

(method) Headers.get(name: string): string | null MDN Reference

}) describe('get null if the value is undefined', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/cookie',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/cookie", "/cookie", Response, BlankInput, BlankEnv>(path: "/cookie", handler: H<BlankEnv, "/cookie", BlankInput, Response>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/cookie", BlankInput>

const yummyCookie =

const yummyCookie: string | undefined

getCookie

(alias) getCookie(c: Context, key: string): string | undefined (+2 overloads) import getCookie

(c, 'yummy_cookie')          

(parameter) c: Context<BlankEnv, "/cookie", BlankInput>

const res = new

const res: Response

Response('Good cookie')          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

if (yummyCookie) {          

const yummyCookie: string | undefined

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.set('Yummy-Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

yummyCookie)          

const yummyCookie: string

} return res          

const res: Response

}) it('Should be null', async () => { const req = new

const req: Request

Request('http://localhost/cookie')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const cookieString = 'yummy_cookie='          

const cookieString: "yummy_cookie="

req

const req: Request

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.set('Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

cookieString)          

const cookieString: "yummy_cookie="

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Yummy-Cookie')).toBe(null)          

(method) Headers.get(name: string): string | null MDN Reference

}) }) }) describe('Set cookie', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/set-cookie',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/set-cookie", "/set-cookie", Response & TypedResponse<"Give cookie", StatusCode, "text">, BlankInput, BlankEnv>(path: "/set-cookie", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/set-cookie", BlankInput>

setCookie

(alias) setCookie(c: Context, name: string, value: string, opt?: CookieOptions): void import setCookie

(c, 'delicious_cookie', 'macha')          

(parameter) c: Context<BlankEnv, "/set-cookie", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/set-cookie", BlankInput>

.text('Give cookie')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Give cookie", StatusCode>(text: "Give cookie", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Set cookie with setCookie()', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/set-cookie')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const header =

const header: string | null

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

expect(header).toBe('delicious_cookie=macha; Path=/')          

const header: string | null

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/a/set-cookie-path',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/a/set-cookie-path", "/a/set-cookie-path", Response & TypedResponse<"Give cookie", StatusCode, "text">, BlankInput, BlankEnv>(path: "/a/set-cookie-path", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/a/set-cookie-path", BlankInput>

setCookie

(alias) setCookie(c: Context, name: string, value: string, opt?: CookieOptions): void import setCookie

(c, 'delicious_cookie', 'macha', {

(parameter) c: Context<BlankEnv, "/a/set-cookie-path", BlankInput>

path: '/a' })          

(property) path?: string | undefined

return c

(parameter) c: Context<BlankEnv, "/a/set-cookie-path", BlankInput>

.text('Give cookie')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Give cookie", StatusCode>(text: "Give cookie", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Set cookie with setCookie() and path option', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/a/set-cookie-path')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const header =

const header: string | null

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

expect(header).toBe('delicious_cookie=macha; Path=/a')          

const header: string | null

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/set-signed-cookie', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/set-signed-cookie", "/set-signed-cookie", Promise<Response & TypedResponse<"Give signed cookie", StatusCode, "text">>, BlankInput, BlankEnv>(path: "/set-signed-cookie", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/set-signed-cookie", BlankInput>

const secret = 'secret chocolate chips'          

const secret: "secret chocolate chips"

await setSignedCookie

(alias) setSignedCookie(c: Context, name: string, value: string, secret: string | BufferSource, opt?: CookieOptions): Promise<void> import setSignedCookie

(c, 'delicious_cookie', 'macha',

(parameter) c: Context<BlankEnv, "/set-signed-cookie", BlankInput>

secret)          

const secret: "secret chocolate chips"

return c

(parameter) c: Context<BlankEnv, "/set-signed-cookie", BlankInput>

.text('Give signed cookie')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Give signed cookie", StatusCode>(text: "Give signed cookie", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Set signed cookie with setSignedCookie()', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/set-signed-cookie')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const header =

const header: string | null

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

expect(header).toBe(          

const header: string | null

'delicious_cookie=macha.diubJPY8O7hI1pLa42QSfkPiyDWQ0I4DnlACH%2FN2HaA%3D; Path=/' ) }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/a/set-signed-cookie-path', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/a/set-signed-cookie-path", "/a/set-signed-cookie-path", Promise<Response & TypedResponse<"Give signed cookie", StatusCode, "text">>, BlankInput, BlankEnv>(path: "/a/set-signed-cookie-path", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/a/set-signed-cookie-path", BlankInput>

const secret = 'secret chocolate chips'          

const secret: "secret chocolate chips"

await setSignedCookie

(alias) setSignedCookie(c: Context, name: string, value: string, secret: string | BufferSource, opt?: CookieOptions): Promise<void> import setSignedCookie

(c, 'delicious_cookie', 'macha',

(parameter) c: Context<BlankEnv, "/a/set-signed-cookie-path", BlankInput>

secret, {

const secret: "secret chocolate chips"

path: '/a' })          

(property) path?: string | undefined

return c

(parameter) c: Context<BlankEnv, "/a/set-signed-cookie-path", BlankInput>

.text('Give signed cookie')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Give signed cookie", StatusCode>(text: "Give signed cookie", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Set signed cookie with setSignedCookie() and path option', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/a/set-signed-cookie-path')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const header =

const header: string | null

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

expect(header).toBe(          

const header: string | null

'delicious_cookie=macha.diubJPY8O7hI1pLa42QSfkPiyDWQ0I4DnlACH%2FN2HaA%3D; Path=/a' ) }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/get-secure-prefix-cookie', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/get-secure-prefix-cookie", "/get-secure-prefix-cookie", Promise<Response>, BlankInput, BlankEnv>(path: "/get-secure-prefix-cookie", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/get-secure-prefix-cookie", BlankInput>

const cookie =

const cookie: string | undefined

getCookie

(alias) getCookie(c: Context, key: string, prefixOptions: CookiePrefixOptions): string | undefined (+2 overloads) import getCookie

(c, 'delicious_cookie', 'secure')          

(parameter) c: Context<BlankEnv, "/get-secure-prefix-cookie", BlankInput>

if (cookie) {          

const cookie: string | undefined

return c

(parameter) c: Context<BlankEnv, "/get-secure-prefix-cookie", BlankInput>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(cookie)          

const cookie: string

} else { return c

(parameter) c: Context<BlankEnv, "/get-secure-prefix-cookie", BlankInput>

.notFound()          

(property) Context<BlankEnv, "/get-secure-prefix-cookie", BlankInput>.notFound: () => Response | Promise<Response> .notFound() can return the Not Found Response.

@see — https://hono.dev/docs/api/context#notfound

@example
ts app.get('/notfound', (c) => { return c.notFound() })

} }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/get-host-prefix-cookie', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/get-host-prefix-cookie", "/get-host-prefix-cookie", Promise<Response>, BlankInput, BlankEnv>(path: "/get-host-prefix-cookie", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/get-host-prefix-cookie", BlankInput>

const cookie =

const cookie: string | undefined

getCookie

(alias) getCookie(c: Context, key: string, prefixOptions: CookiePrefixOptions): string | undefined (+2 overloads) import getCookie

(c, 'delicious_cookie', 'host')          

(parameter) c: Context<BlankEnv, "/get-host-prefix-cookie", BlankInput>

if (cookie) {          

const cookie: string | undefined

return c

(parameter) c: Context<BlankEnv, "/get-host-prefix-cookie", BlankInput>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(cookie)          

const cookie: string

} else { return c

(parameter) c: Context<BlankEnv, "/get-host-prefix-cookie", BlankInput>

.notFound()          

(property) Context<BlankEnv, "/get-host-prefix-cookie", BlankInput>.notFound: () => Response | Promise<Response> .notFound() can return the Not Found Response.

@see — https://hono.dev/docs/api/context#notfound

@example
ts app.get('/notfound', (c) => { return c.notFound() })

} }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/set-secure-prefix-cookie',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/set-secure-prefix-cookie", "/set-secure-prefix-cookie", Response & TypedResponse<"Set secure prefix cookie", StatusCode, "text">, BlankInput, BlankEnv>(path: "/set-secure-prefix-cookie", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/set-secure-prefix-cookie", BlankInput>

setCookie

(alias) setCookie(c: Context, name: string, value: string, opt?: CookieOptions): void import setCookie

(c, 'delicious_cookie', 'macha', {          

(parameter) c: Context<BlankEnv, "/set-secure-prefix-cookie", BlankInput>

prefix: 'secure',          

(property) prefix?: CookiePrefixOptions | undefined

secure: false, // this will be ignore          

(property) secure?: boolean | undefined

}) return c

(parameter) c: Context<BlankEnv, "/set-secure-prefix-cookie", BlankInput>

.text('Set secure prefix cookie')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Set secure prefix cookie", StatusCode>(text: "Set secure prefix cookie", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Set cookie with secure prefix', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/set-secure-prefix-cookie')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const header =

const header: string | null

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

expect(header).toBe('__Secure-delicious_cookie=macha; Path=/; Secure')          

const header: string | null

}) it('Get cookie with secure prefix', async () => { const setCookie = await

const setCookie: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/set-secure-prefix-cookie')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

const header =

const header: string | null

setCookie

const setCookie: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

if (!header) {          

const header: string | null

assert.fail('invalid header') } const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/get-secure-prefix-cookie', {          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

Cookie:

(property) Cookie: string | null

header,          

const header: string | null

}, }) const response = await

const response: string

res

const res: Response

.text()          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(response).toBe('macha')          

const response: string

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/set-host-prefix-cookie',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/set-host-prefix-cookie", "/set-host-prefix-cookie", Response & TypedResponse<"Set host prefix cookie", StatusCode, "text">, BlankInput, BlankEnv>(path: "/set-host-prefix-cookie", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/set-host-prefix-cookie", BlankInput>

setCookie

(alias) setCookie(c: Context, name: string, value: string, opt?: CookieOptions): void import setCookie

(c, 'delicious_cookie', 'macha', {          

(parameter) c: Context<BlankEnv, "/set-host-prefix-cookie", BlankInput>

prefix: 'host',          

(property) prefix?: CookiePrefixOptions | undefined

path: '/foo', // this will be ignored          

(property) path?: string | undefined

domain: 'example.com', // this will be ignored          

(property) domain?: string | undefined

secure: false, // this will be ignored          

(property) secure?: boolean | undefined

}) return c

(parameter) c: Context<BlankEnv, "/set-host-prefix-cookie", BlankInput>

.text('Set host prefix cookie')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Set host prefix cookie", StatusCode>(text: "Set host prefix cookie", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Set cookie with host prefix', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/set-host-prefix-cookie')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const header =

const header: string | null

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

expect(header).toBe('__Host-delicious_cookie=macha; Path=/; Secure')          

const header: string | null

}) it('Get cookie with host prefix', async () => { const setCookie = await

const setCookie: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/set-host-prefix-cookie')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

const header =

const header: string | null

setCookie

const setCookie: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

if (!header) {          

const header: string | null

assert.fail('invalid header') } const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/get-host-prefix-cookie', {          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

Cookie:

(property) Cookie: string | null

header,          

const header: string | null

}, }) const response = await

const response: string

res

const res: Response

.text()          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(response).toBe('macha')          

const response: string

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/set-signed-secure-prefix-cookie', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/set-signed-secure-prefix-cookie", "/set-signed-secure-prefix-cookie", Promise<Response & TypedResponse<"Set secure prefix cookie", StatusCode, "text">>, BlankInput, BlankEnv>(path: "/set-signed-secure-prefix-cookie", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/set-signed-secure-prefix-cookie", BlankInput>

await setSignedCookie

(alias) setSignedCookie(c: Context, name: string, value: string, secret: string | BufferSource, opt?: CookieOptions): Promise<void> import setSignedCookie

(c, 'delicious_cookie', 'macha', 'secret choco chips', {          

(parameter) c: Context<BlankEnv, "/set-signed-secure-prefix-cookie", BlankInput>

prefix: 'secure',          

(property) prefix?: CookiePrefixOptions | undefined

}) return c

(parameter) c: Context<BlankEnv, "/set-signed-secure-prefix-cookie", BlankInput>

.text('Set secure prefix cookie')          

(property) Context<BlankEnv, "/set-signed-secure-prefix-cookie", BlankInput>.text: TextRespond <"Set secure prefix cookie", StatusCode>(text: "Set secure prefix cookie", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Set signed cookie with secure prefix', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/set-signed-secure-prefix-cookie')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const header =

const header: string | null

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

expect(header).toBe(          

const header: string | null

'__Secure-delicious_cookie=macha.i225faTyCrJUY8TvpTuJHI20HBWbQ89B4GV7lT4E%2FB0%3D; Path=/; Secure' ) }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/set-signed-host-prefix-cookie', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/set-signed-host-prefix-cookie", "/set-signed-host-prefix-cookie", Promise<Response & TypedResponse<"Set host prefix cookie", StatusCode, "text">>, BlankInput, BlankEnv>(path: "/set-signed-host-prefix-cookie", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/set-signed-host-prefix-cookie", BlankInput>

await setSignedCookie

(alias) setSignedCookie(c: Context, name: string, value: string, secret: string | BufferSource, opt?: CookieOptions): Promise<void> import setSignedCookie

(c, 'delicious_cookie', 'macha', 'secret choco chips', {          

(parameter) c: Context<BlankEnv, "/set-signed-host-prefix-cookie", BlankInput>

prefix: 'host',          

(property) prefix?: CookiePrefixOptions | undefined

domain: 'example.com', // this will be ignored          

(property) domain?: string | undefined

path: 'example.com', // thi will be ignored          

(property) path?: string | undefined

secure: false, // this will be ignored          

(property) secure?: boolean | undefined

}) return c

(parameter) c: Context<BlankEnv, "/set-signed-host-prefix-cookie", BlankInput>

.text('Set host prefix cookie')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Set host prefix cookie", StatusCode>(text: "Set host prefix cookie", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Set signed cookie with host prefix', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/set-signed-host-prefix-cookie')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const header =

const header: string | null

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

expect(header).toBe(          

const header: string | null

'__Host-delicious_cookie=macha.i225faTyCrJUY8TvpTuJHI20HBWbQ89B4GV7lT4E%2FB0%3D; Path=/; Secure' ) }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/set-cookie-complex',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/set-cookie-complex", "/set-cookie-complex", Response & TypedResponse<"Give cookie", StatusCode, "text">, BlankInput, BlankEnv>(path: "/set-cookie-complex", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/set-cookie-complex", BlankInput>

setCookie

(alias) setCookie(c: Context, name: string, value: string, opt?: CookieOptions): void import setCookie

(c, 'great_cookie', 'banana', {          

(parameter) c: Context<BlankEnv, "/set-cookie-complex", BlankInput>

path: '/',          

(property) path?: string | undefined

secure: true,          

(property) secure: true

domain: 'example.com',          

(property) domain?: string | undefined

httpOnly: true,          

(property) httpOnly?: boolean | undefined

maxAge: 1000,          

(property) maxAge?: number | undefined

expires: new

(property) expires?: Date | undefined

Date

var Date: DateConstructor new (value: number | string | Date) => Date (+4 overloads)

(Date

var Date: DateConstructor Enables basic storage and retrieval of dates and times.

.UTC(2000, 11, 24, 10, 30, 59, 900)),          

(method) DateConstructor.UTC(year: number, monthIndex?: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number (+1 overload) Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.

@param year — The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.

@param monthIndex — The month as a number between 0 and 11 (January to December).

@param date — The date as a number between 1 and 31.

@param hours — Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.

@param minutes — Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.

@param seconds — Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.

@param ms — A number from 0 to 999 that specifies the milliseconds.

sameSite: 'Strict',          

(property) sameSite?: "Strict" | "Lax" | "None" | "strict" | "lax" | "none" | undefined

}) return c

(parameter) c: Context<BlankEnv, "/set-cookie-complex", BlankInput>

.text('Give cookie')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Give cookie", StatusCode>(text: "Give cookie", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Complex pattern', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/set-cookie-complex')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const header =

const header: string | null

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

expect(header).toBe(          

const header: string | null

'great_cookie=banana; Max-Age=1000; Domain=example.com; Path=/; Expires=Sun, 24 Dec 2000 10:30:59 GMT; HttpOnly; Secure; SameSite=Strict' ) }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/set-signed-cookie-complex', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/set-signed-cookie-complex", "/set-signed-cookie-complex", Promise<Response & TypedResponse<"Give signed cookie", StatusCode, "text">>, BlankInput, BlankEnv>(path: "/set-signed-cookie-complex", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/set-signed-cookie-complex", BlankInput>

const secret = 'secret chocolate chips'          

const secret: "secret chocolate chips"

await setSignedCookie

(alias) setSignedCookie(c: Context, name: string, value: string, secret: string | BufferSource, opt?: CookieOptions): Promise<void> import setSignedCookie

(c, 'great_cookie', 'banana',

(parameter) c: Context<BlankEnv, "/set-signed-cookie-complex", BlankInput>

secret, {          

const secret: "secret chocolate chips"

path: '/',          

(property) path?: string | undefined

secure: true,          

(property) secure: true

domain: 'example.com',          

(property) domain?: string | undefined

httpOnly: true,          

(property) httpOnly?: boolean | undefined

maxAge: 1000,          

(property) maxAge?: number | undefined

expires: new

(property) expires?: Date | undefined

Date

var Date: DateConstructor new (value: number | string | Date) => Date (+4 overloads)

(Date

var Date: DateConstructor Enables basic storage and retrieval of dates and times.

.UTC(2000, 11, 24, 10, 30, 59, 900)),          

(method) DateConstructor.UTC(year: number, monthIndex?: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number (+1 overload) Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.

@param year — The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.

@param monthIndex — The month as a number between 0 and 11 (January to December).

@param date — The date as a number between 1 and 31.

@param hours — Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.

@param minutes — Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.

@param seconds — Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.

@param ms — A number from 0 to 999 that specifies the milliseconds.

sameSite: 'Strict',          

(property) sameSite?: "Strict" | "Lax" | "None" | "strict" | "lax" | "none" | undefined

}) return c

(parameter) c: Context<BlankEnv, "/set-signed-cookie-complex", BlankInput>

.text('Give signed cookie')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Give signed cookie", StatusCode>(text: "Give signed cookie", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Complex pattern (signed)', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/set-signed-cookie-complex')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const header =

const header: string | null

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

expect(header).toBe(          

const header: string | null

'great_cookie=banana.hSo6gB7YT2db0WBiEAakEmh7dtwEL0DSp76G23WvHuQ%3D; Max-Age=1000; Domain=example.com; Path=/; Expires=Sun, 24 Dec 2000 10:30:59 GMT; HttpOnly; Secure; SameSite=Strict' ) }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/set-cookie-multiple',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/set-cookie-multiple", "/set-cookie-multiple", Response & TypedResponse<"Give cookie", StatusCode, "text">, BlankInput, BlankEnv>(path: "/set-cookie-multiple", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/set-cookie-multiple", BlankInput>

setCookie

(alias) setCookie(c: Context, name: string, value: string, opt?: CookieOptions): void import setCookie

(c, 'delicious_cookie', 'macha')          

(parameter) c: Context<BlankEnv, "/set-cookie-multiple", BlankInput>

setCookie

(alias) setCookie(c: Context, name: string, value: string, opt?: CookieOptions): void import setCookie

(c, 'delicious_cookie', 'choco')          

(parameter) c: Context<BlankEnv, "/set-cookie-multiple", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/set-cookie-multiple", BlankInput>

.text('Give cookie')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Give cookie", StatusCode>(text: "Give cookie", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Multiple values', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/set-cookie-multiple')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const header =

const header: string | null

res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

expect(header).toBe('delicious_cookie=macha; Path=/, delicious_cookie=choco; Path=/')          

const header: string | null

}) }) describe('Delete cookie', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/delete-cookie',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/delete-cookie", "/delete-cookie", Response & TypedResponse<"Give cookie", StatusCode, "text">, BlankInput, BlankEnv>(path: "/delete-cookie", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/delete-cookie", BlankInput>

deleteCookie

(alias) deleteCookie(c: Context, name: string, opt?: CookieOptions): string | undefined import deleteCookie

(c, 'delicious_cookie')          

(parameter) c: Context<BlankEnv, "/delete-cookie", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/delete-cookie", BlankInput>

.text('Give cookie')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Give cookie", StatusCode>(text: "Give cookie", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Delete cookie', async () => { const res2 = await

const res2: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/delete-cookie')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res2

const res2: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const header2 =

const header2: string | null

res2

const res2: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

expect(header2).toBe('delicious_cookie=; Max-Age=0; Path=/')          

const header2: string | null

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/delete-cookie-multiple',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/delete-cookie-multiple", "/delete-cookie-multiple", Response & TypedResponse<"Give cookie", StatusCode, "text">, BlankInput, BlankEnv>(path: "/delete-cookie-multiple", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/delete-cookie-multiple", BlankInput>

deleteCookie

(alias) deleteCookie(c: Context, name: string, opt?: CookieOptions): string | undefined import deleteCookie

(c, 'delicious_cookie')          

(parameter) c: Context<BlankEnv, "/delete-cookie-multiple", BlankInput>

deleteCookie

(alias) deleteCookie(c: Context, name: string, opt?: CookieOptions): string | undefined import deleteCookie

(c, 'delicious_cookie2')          

(parameter) c: Context<BlankEnv, "/delete-cookie-multiple", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/delete-cookie-multiple", BlankInput>

.text('Give cookie')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Give cookie", StatusCode>(text: "Give cookie", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Delete multiple cookies', async () => { const res2 = await

const res2: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/delete-cookie-multiple')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res2

const res2: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const header2 =

const header2: string | null

res2

const res2: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

expect(header2).toBe(          

const header2: string | null

'delicious_cookie=; Max-Age=0; Path=/, delicious_cookie2=; Max-Age=0; Path=/' ) }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/delete-cookie-with-options',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/delete-cookie-with-options", "/delete-cookie-with-options", Response & TypedResponse<"Give cookie", StatusCode, "text">, BlankInput, BlankEnv>(path: "/delete-cookie-with-options", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/delete-cookie-with-options", BlankInput>

deleteCookie

(alias) deleteCookie(c: Context, name: string, opt?: CookieOptions): string | undefined import deleteCookie

(c, 'delicious_cookie', {          

(parameter) c: Context<BlankEnv, "/delete-cookie-with-options", BlankInput>

path: '/',          

(property) path?: string | undefined

secure: true,          

(property) secure: true

domain: 'example.com',          

(property) domain?: string | undefined

}) return c

(parameter) c: Context<BlankEnv, "/delete-cookie-with-options", BlankInput>

.text('Give cookie')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Give cookie", StatusCode>(text: "Give cookie", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Delete cookie with options', async () => { const res2 = await

const res2: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/delete-cookie-with-options')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res2

const res2: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const header2 =

const header2: string | null

res2

const res2: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Set-Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

expect(header2).toBe('delicious_cookie=; Max-Age=0; Domain=example.com; Path=/; Secure')          

const header2: string | null

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/delete-cookie-with-deleted-value',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/delete-cookie-with-deleted-value", "/delete-cookie-with-deleted-value", Response & TypedResponse<string, StatusCode, "text">, BlankInput, BlankEnv>(path: "/delete-cookie-with-deleted-value", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/delete-cookie-with-deleted-value", BlankInput>

const deleted =

const deleted: string | undefined

deleteCookie

(alias) deleteCookie(c: Context, name: string, opt?: CookieOptions): string | undefined import deleteCookie

(c, 'delicious_cookie')          

(parameter) c: Context<BlankEnv, "/delete-cookie-with-deleted-value", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/delete-cookie-with-deleted-value", BlankInput>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(deleted || '')          

const deleted: string | undefined

}) it('Get deleted value', async () => { const cookieString = 'delicious_cookie=choco'          

const cookieString: "delicious_cookie=choco"

const req = new

const req: Request

Request('http://localhost/delete-cookie-with-deleted-value')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

req

const req: Request

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.set('Cookie',

(method) Headers.set(name: string, value: string): void MDN Reference

cookieString)          

const cookieString: "delicious_cookie=choco"

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('choco')          

(method) Body.text(): Promise<string> MDN Reference

}) }) })
src/helper/cookie/index.ts
            
                /**
                 * @module
                 * Cookie Helper for Hono.
                 */
                
                import type { Context } from '../../context'
                import { parse, parseSigned, serialize, serializeSigned } from '../../utils/cookie'
                import type { Cookie, CookieOptions, CookiePrefixOptions, SignedCookie } from '../../utils/cookie'
                
                interface GetCookie {          

interface GetCookie

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

key: string): string | undefined          

(parameter) key: string

(c:

(parameter) c: Context<any, any, {}>

Context):

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

Cookie          

(alias) type Cookie = { [x: string]: string; } import Cookie

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

key: string,

(parameter) key: string

prefixOptions:

(parameter) prefixOptions: CookiePrefixOptions

CookiePrefixOptions): string | undefined          

(alias) type CookiePrefixOptions = "host" | "secure" import CookiePrefixOptions

} interface GetSignedCookie {          

interface GetSignedCookie

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

secret: string |

(parameter) secret: string | BufferSource

BufferSource,

type BufferSource = ArrayBufferView | ArrayBuffer

key: string):

(parameter) key: string

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

secret: string):

(parameter) secret: string

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<SignedCookie>          

(alias) type SignedCookie = { [x: string]: string | false; } import SignedCookie

( c:

(parameter) c: Context<any, any, {}>

Context,          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

secret: string |

(parameter) secret: string | BufferSource

BufferSource,          

type BufferSource = ArrayBufferView | ArrayBuffer

key: string,          

(parameter) key: string

prefixOptions:

(parameter) prefixOptions: CookiePrefixOptions

CookiePrefixOptions          

(alias) type CookiePrefixOptions = "host" | "secure" import CookiePrefixOptions

): Promise          

interface Promise<T> Represents the completion of an asynchronous operation

} export const getCookie:

const getCookie: GetCookie

GetCookie =

interface GetCookie

(c,

(parameter) c: Context<any, any, {}>

key?,

(parameter) key: unknown

prefix?:

(parameter) prefix: CookiePrefixOptions | undefined

CookiePrefixOptions) => {          

(alias) type CookiePrefixOptions = "host" | "secure" import CookiePrefixOptions

const cookie =

const cookie: string | null

c

(parameter) c: Context<any, any, {}>

.req

(property) Context<any, any, {}>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.raw

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.get('Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

if (typeof key === 'string') {          

(parameter) key: unknown

if (!cookie) {          

const cookie: string | null

return undefined } let finalKey =

let finalKey: string

key          

(parameter) key: string

if (prefix === 'secure') {          

(parameter) prefix: CookiePrefixOptions | undefined

finalKey = '__Secure-' +

let finalKey: string

key          

(parameter) key: string

} else if (prefix === 'host') {          

(parameter) prefix: "host" | undefined

finalKey = '__Host-' +

let finalKey: string

key          

(parameter) key: string

} const obj =

const obj: Cookie

parse

(alias) parse(cookie: string, name?: string): Cookie import parse

(cookie,

const cookie: string

finalKey)          

let finalKey: string

return obj

const obj: Cookie

[finalKey]          

let finalKey: string

} if (!cookie) {          

const cookie: string | null

return {} } const obj =

const obj: Cookie

parse

(alias) parse(cookie: string, name?: string): Cookie import parse

(cookie)          

const cookie: string

// eslint-disable-next-line @typescript-eslint/no-explicit-any return obj as any          

const obj: Cookie

} export const getSignedCookie:

const getSignedCookie: GetSignedCookie

GetSignedCookie = async (          

interface GetSignedCookie

c,          

(parameter) c: Context<any, any, {}>

secret,          

(parameter) secret: string | BufferSource

key?,          

(parameter) key: unknown

prefix?:

(parameter) prefix: CookiePrefixOptions | undefined

CookiePrefixOptions          

(alias) type CookiePrefixOptions = "host" | "secure" import CookiePrefixOptions

) => { const cookie =

const cookie: string | null

c

(parameter) c: Context<any, any, {}>

.req

(property) Context<any, any, {}>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.raw

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.get('Cookie')          

(method) Headers.get(name: string): string | null MDN Reference

if (typeof key === 'string') {          

(parameter) key: unknown

if (!cookie) {          

const cookie: string | null

return undefined } let finalKey =

let finalKey: string

key          

(parameter) key: string

if (prefix === 'secure') {          

(parameter) prefix: CookiePrefixOptions | undefined

finalKey = '__Secure-' +

let finalKey: string

key          

(parameter) key: string

} else if (prefix === 'host') {          

(parameter) prefix: "host" | undefined

finalKey = '__Host-' +

let finalKey: string

key          

(parameter) key: string

} const obj = await

const obj: SignedCookie

parseSigned

(alias) parseSigned(cookie: string, secret: string | BufferSource, name?: string): Promise<SignedCookie> import parseSigned

(cookie,

const cookie: string

secret,

(parameter) secret: string | BufferSource

finalKey)          

let finalKey: string

return obj

const obj: SignedCookie

[finalKey]          

let finalKey: string

} if (!cookie) {          

const cookie: string | null

return {} } const obj = await

const obj: SignedCookie

parseSigned

(alias) parseSigned(cookie: string, secret: string | BufferSource, name?: string): Promise<SignedCookie> import parseSigned

(cookie,

const cookie: string

secret)          

(parameter) secret: string | BufferSource

// eslint-disable-next-line @typescript-eslint/no-explicit-any return obj as any          

const obj: SignedCookie

} export const setCookie =

const setCookie: (c: Context, name: string, value: string, opt?: CookieOptions) => void

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

name: string,

(parameter) name: string

value: string,

(parameter) value: string

opt?:

(parameter) opt: CookieOptions | undefined

CookieOptions): void => {          

(alias) type CookieOptions = { domain?: string; expires?: Date; httpOnly?: boolean; maxAge?: number; path?: string; secure?: boolean; signingSecret?: string; sameSite?: "Strict" | "Lax" | "None" | "strict" | "lax" | "none"; partitioned?: boolean; prefix?: CookiePrefixOptions; } & PartitionCookieConstraint import CookieOptions

// Cookie names prefixed with __Secure- can be used only if they are set with the secure attribute. // Cookie names prefixed with __Host- can be used only if they are set with the secure attribute, must have a path of / (meaning any path at the host) // and must not have a Domain attribute. // Read more at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#cookie_prefixes' let cookie          

let cookie: any

if (opt?

(parameter) opt: CookieOptions | undefined

.prefix === 'secure') {          

(property) prefix?: CookiePrefixOptions | undefined

cookie =

let cookie: any

serialize('__Secure-' +

(alias) serialize<string>(name: string, value: string, opt?: CookieOptions | undefined): string import serialize

name,

(parameter) name: string

value, {

(parameter) value: string

path: '/', ..

(property) path?: string | undefined

.opt,

(parameter) opt: CookieOptions

secure: true })          

(property) secure: true

} else if (opt?

(parameter) opt: CookieOptions | undefined

.prefix === 'host') {          

(property) prefix?: "host" | undefined

cookie =

let cookie: any

serialize('__Host-' +

(alias) serialize<string>(name: string, value: string, opt?: CookieOptions | undefined): string import serialize

name,

(parameter) name: string

value, {          

(parameter) value: string

...opt,          

(parameter) opt: CookieOptions

path: '/',          

(property) path?: string | undefined

secure: true,          

(property) secure: true

domain: undefined,          

(property) domain?: string | undefined

}) } else { cookie =

let cookie: any

serialize

(alias) serialize<string>(name: string, value: string, opt?: CookieOptions | undefined): string import serialize

(name,

(parameter) name: string

value, {

(parameter) value: string

path: '/', ..

(property) path?: string | undefined

.opt })          

(parameter) opt: CookieOptions | undefined

} c

(parameter) c: Context<any, any, {}>

.header('set-cookie',

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

cookie, {

let cookie: string

append: true })          

(property) SetHeadersOptions.append?: boolean | undefined

} export const setSignedCookie = async (          

const setSignedCookie: (c: Context, name: string, value: string, secret: string | BufferSource, opt?: CookieOptions) => Promise<void>

c:

(parameter) c: Context<any, any, {}>

Context,          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

name: string,          

(parameter) name: string

value: string,          

(parameter) value: string

secret: string |

(parameter) secret: string | BufferSource

BufferSource,          

type BufferSource = ArrayBufferView | ArrayBuffer

opt?:

(parameter) opt: CookieOptions | undefined

CookieOptions          

(alias) type CookieOptions = { domain?: string; expires?: Date; httpOnly?: boolean; maxAge?: number; path?: string; secure?: boolean; signingSecret?: string; sameSite?: "Strict" | "Lax" | "None" | "strict" | "lax" | "none"; partitioned?: boolean; prefix?: CookiePrefixOptions; } & PartitionCookieConstraint import CookieOptions

): Promise => {          

interface Promise<T> Represents the completion of an asynchronous operation

let cookie          

let cookie: any

if (opt?

(parameter) opt: CookieOptions | undefined

.prefix === 'secure') {          

(property) prefix?: CookiePrefixOptions | undefined

cookie = await

let cookie: any

serializeSigned('__Secure-' +

(alias) serializeSigned(name: string, value: string, secret: string | BufferSource, opt?: CookieOptions): Promise<string> import serializeSigned

name,

(parameter) name: string

value,

(parameter) value: string

secret, {          

(parameter) secret: string | BufferSource

path: '/',          

(property) path?: string | undefined

...opt,          

(parameter) opt: CookieOptions

secure: true,          

(property) secure: true

}) } else if (opt?

(parameter) opt: CookieOptions | undefined

.prefix === 'host') {          

(property) prefix?: "host" | undefined

cookie = await

let cookie: any

serializeSigned('__Host-' +

(alias) serializeSigned(name: string, value: string, secret: string | BufferSource, opt?: CookieOptions): Promise<string> import serializeSigned

name,

(parameter) name: string

value,

(parameter) value: string

secret, {          

(parameter) secret: string | BufferSource

...opt,          

(parameter) opt: CookieOptions

path: '/',          

(property) path?: string | undefined

secure: true,          

(property) secure: true

domain: undefined,          

(property) domain?: string | undefined

}) } else { cookie = await

let cookie: any

serializeSigned

(alias) serializeSigned(name: string, value: string, secret: string | BufferSource, opt?: CookieOptions): Promise<string> import serializeSigned

(name,

(parameter) name: string

value,

(parameter) value: string

secret, {

(parameter) secret: string | BufferSource

path: '/', ..

(property) path?: string | undefined

.opt })          

(parameter) opt: CookieOptions | undefined

} c

(parameter) c: Context<any, any, {}>

.header('set-cookie',

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

cookie, {

let cookie: string

append: true })          

(property) SetHeadersOptions.append?: boolean | undefined

} export const deleteCookie =

const deleteCookie: (c: Context, name: string, opt?: CookieOptions) => string | undefined

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

name: string,

(parameter) name: string

opt?:

(parameter) opt: CookieOptions | undefined

CookieOptions): string | undefined => {          

(alias) type CookieOptions = { domain?: string; expires?: Date; httpOnly?: boolean; maxAge?: number; path?: string; secure?: boolean; signingSecret?: string; sameSite?: "Strict" | "Lax" | "None" | "strict" | "lax" | "none"; partitioned?: boolean; prefix?: CookiePrefixOptions; } & PartitionCookieConstraint import CookieOptions

const deletedCookie =

const deletedCookie: string | undefined

getCookie

const getCookie: GetCookie (c: Context, key: string) => string | undefined (+2 overloads)

(c,

(parameter) c: Context<any, any, {}>

name)          

(parameter) name: string

setCookie

const setCookie: (c: Context, name: string, value: string, opt?: CookieOptions) => void

(c,

(parameter) c: Context<any, any, {}>

name, '', { ..

(parameter) name: string

.opt,

(parameter) opt: CookieOptions | undefined

maxAge: 0 })          

(property) maxAge?: number | undefined

return deletedCookie          

const deletedCookie: string | undefined

}
src/helper/css/common.ts
            
                // provide utility functions for css helper both on server and client
                export const PSEUDO_GLOBAL_SELECTOR = ':-hono-global'          

const PSEUDO_GLOBAL_SELECTOR: ":-hono-global"

export const isPseudoGlobalSelectorRe = new

const isPseudoGlobalSelectorRe: RegExp

RegExp(`^$

var RegExp: RegExpConstructor new (pattern: RegExp | string, flags?: string) => RegExp (+2 overloads)

{PSEUDO_GLOBAL_SELECTOR}{(.*)}$`)          

const PSEUDO_GLOBAL_SELECTOR: ":-hono-global"

export const DEFAULT_STYLE_ID = 'hono-css'          

const DEFAULT_STYLE_ID: "hono-css"

export const SELECTOR: unique symbol =

const SELECTOR: typeof SELECTOR

Symbol()          

var Symbol: SymbolConstructor (description?: string | number) => symbol Returns a new unique Symbol value.

@param description — Description of the new Symbol object.

export const CLASS_NAME: unique symbol =

const CLASS_NAME: typeof CLASS_NAME

Symbol()          

var Symbol: SymbolConstructor (description?: string | number) => symbol Returns a new unique Symbol value.

@param description — Description of the new Symbol object.

export const STYLE_STRING: unique symbol =

const STYLE_STRING: typeof STYLE_STRING

Symbol()          

var Symbol: SymbolConstructor (description?: string | number) => symbol Returns a new unique Symbol value.

@param description — Description of the new Symbol object.

export const SELECTORS: unique symbol =

const SELECTORS: typeof SELECTORS

Symbol()          

var Symbol: SymbolConstructor (description?: string | number) => symbol Returns a new unique Symbol value.

@param description — Description of the new Symbol object.

export const EXTERNAL_CLASS_NAMES: unique symbol =

const EXTERNAL_CLASS_NAMES: typeof EXTERNAL_CLASS_NAMES

Symbol()          

var Symbol: SymbolConstructor (description?: string | number) => symbol Returns a new unique Symbol value.

@param description — Description of the new Symbol object.

const CSS_ESCAPED: unique symbol =

const CSS_ESCAPED: typeof CSS_ESCAPED

Symbol()          

var Symbol: SymbolConstructor (description?: string | number) => symbol Returns a new unique Symbol value.

@param description — Description of the new Symbol object.

export interface CssClassName {          

interface CssClassName

[SELECTOR]: string          

const SELECTOR: typeof SELECTOR

[CLASS_NAME]: string          

const CLASS_NAME: typeof CLASS_NAME

[STYLE_STRING]: string          

const STYLE_STRING: typeof STYLE_STRING

[SELECTORS]:

const SELECTORS: typeof SELECTORS

CssClassName[]          

interface CssClassName

[EXTERNAL_CLASS_NAMES]: string[]          

const EXTERNAL_CLASS_NAMES: typeof EXTERNAL_CLASS_NAMES

} export const IS_CSS_ESCAPED =

const IS_CSS_ESCAPED: typeof IS_CSS_ESCAPED

Symbol()          

var Symbol: SymbolConstructor (description?: string | number) => symbol Returns a new unique Symbol value.

@param description — Description of the new Symbol object.

interface CssEscapedString {          

interface CssEscapedString

[CSS_ESCAPED]: string          

const CSS_ESCAPED: typeof CSS_ESCAPED

} /** * @experimental * `rawCssString` is an experimental feature. * The API might be changed. */ export const rawCssString =

const rawCssString: (value: string) => CssEscapedString

@experimental
rawCssString is an experimental feature. The API might be changed.

(value: string):

(parameter) value: string

CssEscapedString => {          

interface CssEscapedString

return { [CSS_ESCAPED]:

const CSS_ESCAPED: typeof CSS_ESCAPED

value,          

(parameter) value: string

} } /** * Used the goober'code as a reference: * https://github.com/cristianbote/goober/blob/master/src/core/to-hash.js * MIT License, Copyright (c) 2019 Cristian Bote */ const toHash =

const toHash: (str: string) => string Used the goober'code as a reference: https://github.com/cristianbote/goober/blob/master/src/core/to-hash.js MIT License, Copyright (c) 2019 Cristian Bote

(str: string): string => {          

(parameter) str: string

let i = 0,          

let i: number

out = 11          

let out: number

while (i <

let i: number

str

(parameter) str: string

.length) {          

(property) String.length: number Returns the length of a String object.

out = (101 *

let out: number

out +

let out: number

str

(parameter) str: string

.charCodeAt

(method) String.charCodeAt(index: number): number Returns the Unicode value of the character at the specified location.

@param index — The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.

(i++)) >>> 0          

let i: number

} return 'css-' + out          

let out: number

} const cssStringReStr: string = [          

const cssStringReStr: string

'"(?:(?:\\\\[\\s\\S]|[^"\\\\])*)"', // double quoted string // eslint-disable-next-line quotes "'(?:(?:\\\\[\\s\\S]|[^'\\\\])*)'", // single quoted string ].join('|')          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

const minifyCssRe:

const minifyCssRe: RegExp

RegExp = new

interface RegExp

RegExp(          

var RegExp: RegExpConstructor new (pattern: RegExp | string, flags?: string) => RegExp (+2 overloads)

[ '(' + cssStringReStr + ')', // $1: quoted string          

const cssStringReStr: string

'(?:' + [ '^\\s+', // head whitespace '\\/\\*.*?\\*\\/\\s*', // multi-line comment '\\/\\/.*\\n\\s*', // single-line comment '\\s+$', // tail whitespace ].join('|') +          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

')', '\\s*;\\s*(}|$)\\s*', // $2: trailing semicolon '\\s*([{};:,])\\s*', // $3: whitespace around { } : , ; '(\\s)\\s+', // $4: 2+ spaces ].join('|'),          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

'g' ) export const minify =

const minify: (css: string) => string

(css: string): string => {          

(parameter) css: string

return css

(parameter) css: string

.replace

(method) String.replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string (+3 overloads) Replaces text in a string, using an object that supports replacement within a string.

@param searchValue — A object can search for and replace matches within a string.

@param replacer — A function that returns the replacement text.

(minifyCssRe,

const minifyCssRe: RegExp

(_,

(parameter) _: string

$1,

(parameter) $1: any

$2,

(parameter) $2: any

$3,

(parameter) $3: any

$4) =>

(parameter) $4: any

$1 ||

(parameter) $1: any

$2 ||

(parameter) $2: any

$3 ||

(parameter) $3: any

$4 || '')          

(parameter) $4: any

} type CssVariableBasicType =          

type CssVariableBasicType = string | number | boolean | CssEscapedString | CssClassName | null | undefined

| CssClassName          

interface CssClassName

| CssEscapedString          

interface CssEscapedString

| string | number | boolean | null | undefined type CssVariableAsyncType =

type CssVariableAsyncType = Promise<CssVariableBasicType>

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<CssVariableBasicType>          

type CssVariableBasicType = string | number | boolean | CssEscapedString | CssClassName | null | undefined

type CssVariableArrayType =

type CssVariableArrayType = (CssVariableBasicType | CssVariableAsyncType)[]

(CssVariableBasicType |

type CssVariableBasicType = string | number | boolean | CssEscapedString | CssClassName | null | undefined

CssVariableAsyncType)[]          

type CssVariableAsyncType = Promise<CssVariableBasicType>

export type CssVariableType =

type CssVariableType = CssVariableBasicType | CssVariableAsyncType | CssVariableArrayType

CssVariableBasicType |

type CssVariableBasicType = string | number | boolean | CssEscapedString | CssClassName | null | undefined

CssVariableAsyncType |

type CssVariableAsyncType = Promise<CssVariableBasicType>

CssVariableArrayType          

type CssVariableArrayType = (CssVariableBasicType | CssVariableAsyncType)[]

export const buildStyleString = (          

const buildStyleString: (strings: TemplateStringsArray, values: CssVariableType[]) => [string, string, CssClassName[], string[]]

strings:

(parameter) strings: TemplateStringsArray

TemplateStringsArray,          

interface TemplateStringsArray

values:

(parameter) values: CssVariableType[]

CssVariableType[]          

type CssVariableType = CssVariableBasicType | CssVariableAsyncType | CssVariableArrayType

): [string, string, CssClassName[], string[]] => {          

interface CssClassName

const selectors:

const selectors: CssClassName[]

CssClassName[] = []          

interface CssClassName

const externalClassNames: string[] = []          

const externalClassNames: string[]

const label =

const label: string

strings[0]

(parameter) strings: TemplateStringsArray

.match(/^\s*\/\*(.*?)\*\//)?.[1] || ''          

(method) String.match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null (+1 overload) Matches a string or an object that supports being matched against, and returns an array containing the results of that search, or null if no matches are found.

@param matcher — An object that supports being matched against.

let styleString = ''          

let styleString: string

for (let i = 0,

let i: number

len =

let len: number

strings

(parameter) strings: TemplateStringsArray

.length;

(property) ReadonlyArray<string>.length: number Gets the length of the array. This is a number one higher than the highest element defined in an array.

i <

let i: number

len;

let len: number

i++) {          

let i: number

styleString +=

let styleString: string

strings

(parameter) strings: TemplateStringsArray

[i]          

let i: number

let vArray =

let vArray: CssVariableType

values

(parameter) values: CssVariableType[]

[i]          

let i: number

if (typeof vArray === 'boolean' ||

let vArray: CssVariableType

vArray === null ||

let vArray: string | number | CssEscapedString | CssClassName | CssVariableAsyncType | CssVariableArrayType | null | undefined

vArray === undefined) {          

let vArray: string | number | CssEscapedString | CssClassName | CssVariableAsyncType | CssVariableArrayType | undefined

continue } if (!Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(vArray)) {          

let vArray: string | number | CssEscapedString | CssClassName | CssVariableAsyncType | CssVariableArrayType

vArray =

let vArray: CssVariableType

[vArray]          

let vArray: string | number | CssEscapedString | CssClassName | CssVariableAsyncType

} for (let j = 0,

let j: number

len =

let len: number

vArray

let vArray: CssVariableArrayType

.length;

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

j <

let j: number

len;

let len: number

j++) {          

let j: number

let value =

let value: CssVariableBasicType | CssVariableAsyncType

vArray

let vArray: CssVariableArrayType

[j]          

let j: number

if (typeof value === 'boolean' ||

let value: CssVariableBasicType | CssVariableAsyncType

value === null ||

let value: string | number | CssEscapedString | CssClassName | CssVariableAsyncType | null | undefined

value === undefined) {          

let value: string | number | CssEscapedString | CssClassName | CssVariableAsyncType | undefined

continue } if (typeof value === 'string') {          

let value: string | number | CssEscapedString | CssClassName | CssVariableAsyncType

if (/([\\"'\/])/.test

(method) RegExp.test(string: string): boolean Returns a Boolean value that indicates whether or not a pattern exists in a searched string.

@param string — String on which to perform the search.

(value)) {          

let value: string

styleString +=

let styleString: string

value

let value: string

.replace(/([\\"']|(?<=<)\/)/g, '\\$1')          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

} else { styleString +=

let styleString: string

value          

let value: string

} } else if (typeof value === 'number') {          

let value: number | CssEscapedString | CssClassName | CssVariableAsyncType

styleString +=

let styleString: string

value          

let value: number

} else if ((value as

let value: CssEscapedString | CssClassName | CssVariableAsyncType

CssEscapedString)

interface CssEscapedString

[CSS_ESCAPED]) {          

const CSS_ESCAPED: typeof CSS_ESCAPED

styleString +=

let styleString: string

(value as

let value: CssEscapedString | CssClassName | CssVariableAsyncType

CssEscapedString)

interface CssEscapedString

[CSS_ESCAPED]          

const CSS_ESCAPED: typeof CSS_ESCAPED

} else if ((value as

let value: CssEscapedString | CssClassName | CssVariableAsyncType

CssClassName)

interface CssClassName

[CLASS_NAME]

const CLASS_NAME: typeof CLASS_NAME

.startsWith('@keyframes ')) {          

(method) String.startsWith(searchString: string, position?: number): boolean Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false.

selectors

const selectors: CssClassName[]

.push

(method) Array<CssClassName>.push(...items: CssClassName[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(value as

let value: CssEscapedString | CssClassName | CssVariableAsyncType

CssClassName)          

interface CssClassName

styleString += ` ${

let styleString: string

(value as

let value: CssEscapedString | CssClassName | CssVariableAsyncType

CssClassName)

interface CssClassName

[CLASS_NAME]

const CLASS_NAME: typeof CLASS_NAME

.substring(11)} `          

(method) String.substring(start: number, end?: number): string Returns the substring at the specified location within a String object.

@param start — The zero-based index number indicating the beginning of the substring.

@param end
Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. If end is omitted, the characters from start through the end of the original string are returned.

} else { if (strings

(parameter) strings: TemplateStringsArray

[i + 1]?

let i: number

.match(/^\s*{/)) {          

(method) String.match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null (+1 overload) Matches a string or an object that supports being matched against, and returns an array containing the results of that search, or null if no matches are found.

@param matcher — An object that supports being matched against.

// assume this value is a class name selectors

const selectors: CssClassName[]

.push

(method) Array<CssClassName>.push(...items: CssClassName[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(value as

let value: CssEscapedString | CssClassName | CssVariableAsyncType

CssClassName)          

interface CssClassName

value = `.${

let value: CssVariableBasicType | CssVariableAsyncType

(value as

let value: CssEscapedString | CssClassName | CssVariableAsyncType

CssClassName)

interface CssClassName

[CLASS_NAME]}`          

const CLASS_NAME: typeof CLASS_NAME

} else { selectors

const selectors: CssClassName[]

.push(...

(method) Array<CssClassName>.push(...items: CssClassName[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(value as

let value: CssEscapedString | CssClassName | CssVariableAsyncType

CssClassName)

interface CssClassName

[SELECTORS])          

const SELECTORS: typeof SELECTORS

externalClassNames

const externalClassNames: string[]

.push(...

(method) Array<string>.push(...items: string[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(value as

let value: CssEscapedString | CssClassName | CssVariableAsyncType

CssClassName)

interface CssClassName

[EXTERNAL_CLASS_NAMES])          

const EXTERNAL_CLASS_NAMES: typeof EXTERNAL_CLASS_NAMES

value =

let value: CssVariableBasicType | CssVariableAsyncType

(value as

let value: CssEscapedString | CssClassName | CssVariableAsyncType

CssClassName)

interface CssClassName

[STYLE_STRING]          

const STYLE_STRING: typeof STYLE_STRING

const valueLen =

const valueLen: number

value

let value: string

.length          

(property) String.length: number Returns the length of a String object.

if (valueLen > 0) {          

const valueLen: number

const lastChar =

const lastChar: string

value

let value: string

[valueLen - 1]          

const valueLen: number

if (lastChar !== ';' &&

const lastChar: string

lastChar !== '}') {          

const lastChar: string

value += ';'          

let value: string

} } } styleString += `$

let styleString: string

{value || ''}`          

let value: string

} } } return [label,

const label: string

minify

const minify: (css: string) => string

(styleString),

let styleString: string

selectors,

const selectors: CssClassName[]

externalClassNames]          

const externalClassNames: string[]

} export const cssCommon = (          

const cssCommon: (strings: TemplateStringsArray, values: CssVariableType[]) => CssClassName

strings:

(parameter) strings: TemplateStringsArray

TemplateStringsArray,          

interface TemplateStringsArray

values:

(parameter) values: CssVariableType[]

CssVariableType[]          

type CssVariableType = CssVariableBasicType | CssVariableAsyncType | CssVariableArrayType

): CssClassName => {          

interface CssClassName

let [label,

let label: string

thisStyleString,

let thisStyleString: string

selectors,

let selectors: CssClassName[]

externalClassNames] =

let externalClassNames: string[]

buildStyleString

const buildStyleString: (strings: TemplateStringsArray, values: CssVariableType[]) => [string, string, CssClassName[], string[]]

(strings,

(parameter) strings: TemplateStringsArray

values)          

(parameter) values: CssVariableType[]

const isPseudoGlobal =

const isPseudoGlobal: RegExpExecArray | null

isPseudoGlobalSelectorRe

const isPseudoGlobalSelectorRe: RegExp

.exec

(method) RegExp.exec(string: string): RegExpExecArray | null Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search.

@param string — The String object or string literal on which to perform the search.

(thisStyleString)          

let thisStyleString: string

if (isPseudoGlobal) {          

const isPseudoGlobal: RegExpExecArray | null

thisStyleString =

let thisStyleString: string

isPseudoGlobal[1]          

const isPseudoGlobal: RegExpExecArray

} const selector =

const selector: string

(isPseudoGlobal ?

const isPseudoGlobal: RegExpExecArray | null

PSEUDO_GLOBAL_SELECTOR : '') +

const PSEUDO_GLOBAL_SELECTOR: ":-hono-global"

toHash

const toHash: (str: string) => string Used the goober'code as a reference: https://github.com/cristianbote/goober/blob/master/src/core/to-hash.js MIT License, Copyright (c) 2019 Cristian Bote

(label +

let label: string

thisStyleString)          

let thisStyleString: string

const className = (          

const className: string

isPseudoGlobal ?

const isPseudoGlobal: RegExpExecArray | null

selectors

let selectors: CssClassName[]

.map(

(method) Array<CssClassName>.map<string>(callbackfn: (value: CssClassName, index: number, array: CssClassName[]) => string, thisArg?: any): string[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(s) =>

(parameter) s: CssClassName

s

(parameter) s: CssClassName

[CLASS_NAME]) :

const CLASS_NAME: typeof CLASS_NAME

[selector, ..

const selector: string

.externalClassNames]          

let externalClassNames: string[]

).join(' ')          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

return { [SELECTOR]:

const SELECTOR: typeof SELECTOR

selector,          

const selector: string

[CLASS_NAME]:

const CLASS_NAME: typeof CLASS_NAME

className,          

const className: string

[STYLE_STRING]:

const STYLE_STRING: typeof STYLE_STRING

thisStyleString,          

let thisStyleString: string

[SELECTORS]:

const SELECTORS: typeof SELECTORS

selectors,          

let selectors: CssClassName[]

[EXTERNAL_CLASS_NAMES]:

const EXTERNAL_CLASS_NAMES: typeof EXTERNAL_CLASS_NAMES

externalClassNames,          

let externalClassNames: string[]

} } export const cxCommon = (          

const cxCommon: (args: (string | boolean | null | undefined | CssClassName)[]) => (string | boolean | null | undefined | CssClassName)[]

args: (string | boolean | null | undefined |

(parameter) args: (string | boolean | CssClassName | null | undefined)[]

CssClassName)[]          

interface CssClassName

): (string | boolean | null | undefined | CssClassName)[] => {          

interface CssClassName

for (let i = 0,

let i: number

len =

let len: number

args

(parameter) args: (string | boolean | CssClassName | null | undefined)[]

.length;

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

i <

let i: number

len;

let len: number

i++) {          

let i: number

const arg =

const arg: string | boolean | CssClassName | null | undefined

args

(parameter) args: (string | boolean | CssClassName | null | undefined)[]

[i]          

let i: number

if (typeof arg === 'string') {          

const arg: string | boolean | CssClassName | null | undefined

args

(parameter) args: (string | boolean | CssClassName | null | undefined)[]

[i] = {          

let i: number

[SELECTOR]: '',          

const SELECTOR: typeof SELECTOR

[CLASS_NAME]: '',          

const CLASS_NAME: typeof CLASS_NAME

[STYLE_STRING]: '',          

const STYLE_STRING: typeof STYLE_STRING

[SELECTORS]: [],          

const SELECTORS: typeof SELECTORS

[EXTERNAL_CLASS_NAMES]:

const EXTERNAL_CLASS_NAMES: typeof EXTERNAL_CLASS_NAMES

[arg],          

const arg: string

} } } return args          

(parameter) args: (string | boolean | CssClassName | null | undefined)[]

} export const keyframesCommon = (          

const keyframesCommon: (strings: TemplateStringsArray, ...values: CssVariableType[]) => CssClassName

strings:

(parameter) strings: TemplateStringsArray

TemplateStringsArray,          

interface TemplateStringsArray

...values:

(parameter) values: CssVariableType[]

CssVariableType[]          

type CssVariableType = CssVariableBasicType | CssVariableAsyncType | CssVariableArrayType

): CssClassName => {          

interface CssClassName

const [label,

const label: string

styleString] =

const styleString: string

buildStyleString

const buildStyleString: (strings: TemplateStringsArray, values: CssVariableType[]) => [string, string, CssClassName[], string[]]

(strings,

(parameter) strings: TemplateStringsArray

values)          

(parameter) values: CssVariableType[]

return { [SELECTOR]: '',          

const SELECTOR: typeof SELECTOR

[CLASS_NAME]: `@keyframes $

const CLASS_NAME: typeof CLASS_NAME

{toHash

const toHash: (str: string) => string Used the goober'code as a reference: https://github.com/cristianbote/goober/blob/master/src/core/to-hash.js MIT License, Copyright (c) 2019 Cristian Bote

(label +

const label: string

styleString)}`,          

const styleString: string

[STYLE_STRING]:

const STYLE_STRING: typeof STYLE_STRING

styleString,          

const styleString: string

[SELECTORS]: [],          

const SELECTORS: typeof SELECTORS

[EXTERNAL_CLASS_NAMES]: [],          

const EXTERNAL_CLASS_NAMES: typeof EXTERNAL_CLASS_NAMES

} } type ViewTransitionType = {          

type ViewTransitionType = { (strings: TemplateStringsArray, values: CssVariableType[]): CssClassName; (content: CssClassName): CssClassName; (): CssClassName; }

(strings:

(parameter) strings: TemplateStringsArray

TemplateStringsArray,

interface TemplateStringsArray

values:

(parameter) values: CssVariableType[]

CssVariableType[]):

type CssVariableType = CssVariableBasicType | CssVariableAsyncType | CssVariableArrayType

CssClassName          

interface CssClassName

(content:

(parameter) content: CssClassName

CssClassName):

interface CssClassName

CssClassName          

interface CssClassName

(): CssClassName          

interface CssClassName

} let viewTransitionNameIndex = 0          

let viewTransitionNameIndex: number

export const viewTransitionCommon:

const viewTransitionCommon: ViewTransitionType

ViewTransitionType = ((          

type ViewTransitionType = { (strings: TemplateStringsArray, values: CssVariableType[]): CssClassName; (content: CssClassName): CssClassName; (): CssClassName; }

strings:

(parameter) strings: TemplateStringsArray | CssClassName | undefined

TemplateStringsArray |

interface TemplateStringsArray

CssClassName | undefined,          

interface CssClassName

values:

(parameter) values: CssVariableType[]

CssVariableType[]          

type CssVariableType = CssVariableBasicType | CssVariableAsyncType | CssVariableArrayType

): CssClassName => {          

interface CssClassName

if (!strings) {          

(parameter) strings: TemplateStringsArray | CssClassName | undefined

// eslint-disable-next-line @typescript-eslint/no-explicit-any strings = [`/* h-v-t $

(parameter) strings: TemplateStringsArray | CssClassName | undefined

{viewTransitionNameIndex++} */`] as any          

let viewTransitionNameIndex: number

} const content =

const content: CssClassName

Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(strings)          

(parameter) strings: TemplateStringsArray | CssClassName | undefined

? cssCommon

const cssCommon: (strings: TemplateStringsArray, values: CssVariableType[]) => CssClassName

(strings as

(parameter) strings: (TemplateStringsArray & any[]) | (CssClassName & any[])

TemplateStringsArray,

interface TemplateStringsArray

values)          

(parameter) values: CssVariableType[]

: (strings as

(parameter) strings: TemplateStringsArray | CssClassName | undefined

CssClassName)          

interface CssClassName

const transitionName =

const transitionName: string

content

const content: CssClassName

[CLASS_NAME]          

const CLASS_NAME: typeof CLASS_NAME

// eslint-disable-next-line @typescript-eslint/no-explicit-any const res =

const res: CssClassName

cssCommon(['view-transition-name:', ''] as any,

const cssCommon: (strings: TemplateStringsArray, values: CssVariableType[]) => CssClassName

[transitionName])          

const transitionName: string

content

const content: CssClassName

[CLASS_NAME] =

const CLASS_NAME: typeof CLASS_NAME

PSEUDO_GLOBAL_SELECTOR +

const PSEUDO_GLOBAL_SELECTOR: ":-hono-global"

content

const content: CssClassName

[CLASS_NAME]          

const CLASS_NAME: typeof CLASS_NAME

content

const content: CssClassName

[STYLE_STRING] =

const STYLE_STRING: typeof STYLE_STRING

content

const content: CssClassName

[STYLE_STRING]

const STYLE_STRING: typeof STYLE_STRING

.replace(          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

/(?<=::view-transition(?:[a-z-]*)\()(?=\))/g, transitionName          

const transitionName: string

) res

const res: CssClassName

[CLASS_NAME] =

const CLASS_NAME: typeof CLASS_NAME

res

const res: CssClassName

[SELECTOR] =

const SELECTOR: typeof SELECTOR

transitionName          

const transitionName: string

res

const res: CssClassName

[SELECTORS] = [..

const SELECTORS: typeof SELECTORS

.content

const content: CssClassName

[SELECTORS],

const SELECTORS: typeof SELECTORS

content]          

const content: CssClassName

return res          

const res: CssClassName

}) as ViewTransitionType          

type ViewTransitionType = { (strings: TemplateStringsArray, values: CssVariableType[]): CssClassName; (content: CssClassName): CssClassName; (): CssClassName; }

src/helper/css/index.ts
            
                /**
                 * @module
                 * css Helper for Hono.
                 */
                
                import { raw } from '../../helper/html'
                import { DOM_RENDERER } from '../../jsx/constants'
                import { createCssJsxDomObjects } from '../../jsx/dom/css'
                import type { HtmlEscapedCallback, HtmlEscapedString } from '../../utils/html'
                import type { CssClassName as CssClassNameCommon, CssVariableType } from './common'
                import {
                  CLASS_NAME,
                  DEFAULT_STYLE_ID,
                  PSEUDO_GLOBAL_SELECTOR,
                  SELECTOR,
                  SELECTORS,
                  STYLE_STRING,
                  cssCommon,
                  cxCommon,
                  keyframesCommon,
                  viewTransitionCommon,
                } from './common'
                export { rawCssString } from './common'          

(alias) const rawCssString: (value: string) => CssEscapedString export rawCssString

@experimental
rawCssString is an experimental feature. The API might be changed.

type CssClassName =

type CssClassName = string & HtmlEscaped & CssClassNameCommon

HtmlEscapedString &

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

CssClassNameCommon          

(alias) interface CssClassNameCommon import CssClassNameCommon

type usedClassNameData = [          

type usedClassNameData = [Record<string, string>, Record<string, true>]

Record, // class name to add          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

Record // class name already added          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

] interface CssType {          

interface CssType

(strings:

(parameter) strings: TemplateStringsArray

TemplateStringsArray, ..

interface TemplateStringsArray

.values:

(parameter) values: CssVariableType[]

CssVariableType[]):

(alias) type CssVariableType = CssVariableBasicType | CssVariableAsyncType | CssVariableArrayType import CssVariableType

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

} interface CxType {          

interface CxType

( ...args:

(parameter) args: (string | boolean | Promise<string> | CssClassName | null | undefined)[]

(CssClassName |

type CssClassName = string & HtmlEscaped & CssClassNameCommon

Promise | string | boolean | null | undefined)[]          

interface Promise<T> Represents the completion of an asynchronous operation

): Promise          

interface Promise<T> Represents the completion of an asynchronous operation

} interface KeyframesType {          

interface KeyframesType

(strings:

(parameter) strings: TemplateStringsArray

TemplateStringsArray, ..

interface TemplateStringsArray

.values:

(parameter) values: CssVariableType[]

CssVariableType[]):

(alias) type CssVariableType = CssVariableBasicType | CssVariableAsyncType | CssVariableArrayType import CssVariableType

CssClassNameCommon          

(alias) interface CssClassNameCommon import CssClassNameCommon

} interface ViewTransitionType {          

interface ViewTransitionType

(strings:

(parameter) strings: TemplateStringsArray

TemplateStringsArray, ..

interface TemplateStringsArray

.values:

(parameter) values: CssVariableType[]

CssVariableType[]):

(alias) type CssVariableType = CssVariableBasicType | CssVariableAsyncType | CssVariableArrayType import CssVariableType

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

(content:

(parameter) content: Promise<string>

Promise):

interface Promise<T> Represents the completion of an asynchronous operation

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

(): Promise          

interface Promise<T> Represents the completion of an asynchronous operation

} interface StyleType {          

interface StyleType

(args?: {

(parameter) args: { children?: Promise<string>; } | undefined

children?:

(property) children?: Promise<string> | undefined

Promise }):

interface Promise<T> Represents the completion of an asynchronous operation

HtmlEscapedString          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

} /** * @experimental * `createCssContext` is an experimental feature. * The API might be changed. */ export const createCssContext = ({

const createCssContext: ({ id }: { id: Readonly<string>; }) => DefaultContextType

@experimental
createCssContext is an experimental feature. The API might be changed.

id }: {

(parameter) id: string

id:

(property) id: string

Readonly }):

type Readonly<T> = { readonly [P in keyof T]: T[P]; } Make all properties in T readonly

DefaultContextType => {          

interface DefaultContextType

const [cssJsxDomObject,

const cssJsxDomObject: { toString(this: CssClassNameCommon): string; }

StyleRenderToDom] =

const StyleRenderToDom: FC<PropsWithChildren<void>>

createCssJsxDomObjects({

(alias) createCssJsxDomObjects(args: { id: Readonly<string>; }): readonly [{ toString(this: CssClassNameCommon): string; }, FC<PropsWithChildren<void>>] import createCssJsxDomObjects

id })          

(property) id: string

const contextMap:

const contextMap: WeakMap<object, usedClassNameData>

WeakMap

interface WeakMap<K extends WeakKey, V>

usedClassNameData> = new

type usedClassNameData = [Record<string, string>, Record<string, true>]

WeakMap()          

var WeakMap: WeakMapConstructor new <object, usedClassNameData>(entries?: readonly (readonly [object, usedClassNameData])[] | null | undefined) => WeakMap<object, usedClassNameData> (+1 overload)

const replaceStyleRe = new

const replaceStyleRe: RegExp

RegExp(`()`)          

(parameter) id: string

const newCssClassNameObject =

const newCssClassNameObject: (cssClassName: CssClassNameCommon) => Promise<string>

(cssClassName:

(parameter) cssClassName: CssClassNameCommon

CssClassNameCommon):

(alias) interface CssClassNameCommon import CssClassNameCommon

Promise => {          

interface Promise<T> Represents the completion of an asynchronous operation

const appendStyle:

const appendStyle: HtmlEscapedCallback

HtmlEscapedCallback = ({

(alias) type HtmlEscapedCallback = (opts: HtmlEscapedCallbackOpts) => Promise<string> | undefined import HtmlEscapedCallback

buffer,

(parameter) buffer: [string] | undefined

context }):

(parameter) context: object

Promise | undefined => {          

interface Promise<T> Represents the completion of an asynchronous operation

const [toAdd,

const toAdd: Record<string, string>

added] =

const added: Record<string, true>

contextMap

const contextMap: WeakMap<object, usedClassNameData>

.get

(method) WeakMap<object, usedClassNameData>.get(key: object): usedClassNameData | undefined

@returns — a specified element.

(context) as

(parameter) context: object

usedClassNameData          

type usedClassNameData = [Record<string, string>, Record<string, true>]

const names =

const names: string[]

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.keys

(method) ObjectConstructor.keys(o: {}): string[] (+1 overload) Returns the names of the enumerable string properties and methods of an object.

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(toAdd)          

const toAdd: Record<string, string>

if (!names

const names: string[]

.length) {          

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

return } let stylesStr = ''          

let stylesStr: string

names

const names: string[]

.forEach(

(method) Array<string>.forEach(callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(className) => {          

(parameter) className: string

added

const added: Record<string, true>

[className] = true          

(parameter) className: string

stylesStr +=

let stylesStr: string

className

(parameter) className: string

.startsWith

(method) String.startsWith(searchString: string, position?: number): boolean Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false.

(PSEUDO_GLOBAL_SELECTOR)          

(alias) const PSEUDO_GLOBAL_SELECTOR: ":-hono-global" import PSEUDO_GLOBAL_SELECTOR

? toAdd

const toAdd: Record<string, string>

[className]          

(parameter) className: string

: `${className[0] === '@' ? '' : '.'}$

(parameter) className: string

{className}{$

(parameter) className: string

{toAdd

const toAdd: Record<string, string>

[className]}}`          

(parameter) className: string

}) contextMap

const contextMap: WeakMap<object, usedClassNameData>

.set

(method) WeakMap<object, usedClassNameData>.set(key: object, value: usedClassNameData): WeakMap<object, usedClassNameData> Adds a new element with a specified key and value.

@param key — Must be an object or symbol.

(context, [{},

(parameter) context: object

added])          

const added: Record<string, true>

if (buffer &&

(parameter) buffer: [string] | undefined

replaceStyleRe

const replaceStyleRe: RegExp

.test

(method) RegExp.test(string: string): boolean Returns a Boolean value that indicates whether or not a pattern exists in a searched string.

@param string — String on which to perform the search.

(buffer[0])) {          

(parameter) buffer: [string]

buffer[0] =

(parameter) buffer: [string]

buffer[0]

(parameter) buffer: [string]

.replace

(method) String.replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string (+3 overloads) Replaces text in a string, using an object that supports replacement within a string.

@param searchValue — A object can search for and replace matches within a string.

@param replacer — A function that returns the replacement text.

(replaceStyleRe,

const replaceStyleRe: RegExp

(_,

(parameter) _: string

pre,

(parameter) pre: any

post) => `$

(parameter) post: any

{pre}$

(parameter) pre: any

{stylesStr}$

let stylesStr: string

{post}`)          

(parameter) post: any

return } const appendStyleScript = `` if (buffer) {          

(parameter) buffer: [string] | undefined

buffer[0] = `$

(parameter) buffer: [string]

{appendStyleScript}$

const appendStyleScript: string

{buffer[0]}`          

(parameter) buffer: [string]

return } return Promise

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

.resolve

(method) PromiseConstructor.resolve<string>(value: string): Promise<string> (+2 overloads) Creates a new resolved promise for the provided value.

@param value — A promise.

@returns — A promise whose internal state matches the provided promise.

(appendStyleScript)          

const appendStyleScript: string

} const addClassNameToContext:

const addClassNameToContext: HtmlEscapedCallback

HtmlEscapedCallback = ({

(alias) type HtmlEscapedCallback = (opts: HtmlEscapedCallbackOpts) => Promise<string> | undefined import HtmlEscapedCallback

context }) => {          

(parameter) context: object

if (!contextMap

const contextMap: WeakMap<object, usedClassNameData>

.get

(method) WeakMap<object, usedClassNameData>.get(key: object): usedClassNameData | undefined

@returns — a specified element.

(context)) {          

(parameter) context: object

contextMap

const contextMap: WeakMap<object, usedClassNameData>

.set

(method) WeakMap<object, usedClassNameData>.set(key: object, value: usedClassNameData): WeakMap<object, usedClassNameData> Adds a new element with a specified key and value.

@param key — Must be an object or symbol.

(context, [{}, {}])          

(parameter) context: object

} const [toAdd,

const toAdd: Record<string, string>

added] =

const added: Record<string, true>

contextMap

const contextMap: WeakMap<object, usedClassNameData>

.get

(method) WeakMap<object, usedClassNameData>.get(key: object): usedClassNameData | undefined

@returns — a specified element.

(context) as

(parameter) context: object

usedClassNameData          

type usedClassNameData = [Record<string, string>, Record<string, true>]

let allAdded = true          

let allAdded: boolean

if (!added

const added: Record<string, true>

[cssClassName

(parameter) cssClassName: CssClassNameCommon

[SELECTOR]]) {          

(alias) const SELECTOR: typeof SELECTOR import SELECTOR

allAdded = false          

let allAdded: boolean

toAdd

const toAdd: Record<string, string>

[cssClassName

(parameter) cssClassName: CssClassNameCommon

[SELECTOR]] =

(alias) const SELECTOR: typeof SELECTOR import SELECTOR

cssClassName

(parameter) cssClassName: CssClassNameCommon

[STYLE_STRING]          

(alias) const STYLE_STRING: typeof STYLE_STRING import STYLE_STRING

} cssClassName

(parameter) cssClassName: CssClassNameCommon

[SELECTORS]

(alias) const SELECTORS: typeof SELECTORS import SELECTORS

.forEach(          

(method) Array<CssClassName>.forEach(callbackfn: (value: CssClassNameCommon, index: number, array: CssClassNameCommon[]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

({ [CLASS_NAME]:

(alias) const CLASS_NAME: typeof CLASS_NAME import CLASS_NAME

className,

(parameter) className: string

[STYLE_STRING]:

(alias) const STYLE_STRING: typeof STYLE_STRING import STYLE_STRING

styleString }) => {          

(parameter) styleString: string

if (!added

const added: Record<string, true>

[className]) {          

(parameter) className: string

allAdded = false          

let allAdded: boolean

toAdd

const toAdd: Record<string, string>

[className] =

(parameter) className: string

styleString          

(parameter) styleString: string

} } ) if (allAdded) {          

let allAdded: boolean

return } return Promise

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

.resolve

(method) PromiseConstructor.resolve<HtmlEscapedString>(value: HtmlEscapedString): Promise<HtmlEscapedString> (+2 overloads) Creates a new resolved promise for the provided value.

@param value — A promise.

@returns — A promise whose internal state matches the provided promise.

(raw('',

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

[appendStyle]))          

const appendStyle: HtmlEscapedCallback

} const className = new

const className: CssClassName

String

var String: StringConstructor new (value?: any) => String Allows manipulation and formatting of text strings and determination and location of substrings within strings.

(cssClassName

(parameter) cssClassName: CssClassNameCommon

[CLASS_NAME]) as

(alias) const CLASS_NAME: typeof CLASS_NAME import CLASS_NAME

CssClassName          

type CssClassName = string & HtmlEscaped & CssClassNameCommon

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.assign

(method) ObjectConstructor.assign<CssClassName, CssClassNameCommon>(target: CssClassName, source: CssClassNameCommon): string & HtmlEscaped & CssClassNameCommon (+3 overloads) Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object.

@param target — The target object to copy to.

@param source — The source object from which to copy properties.

(className,

const className: CssClassName

cssClassName)          

(parameter) cssClassName: CssClassNameCommon

;(className as

const className: CssClassName

HtmlEscapedString)

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

.isEscaped = true          

(property) isEscaped: true

;(className as

const className: CssClassName

HtmlEscapedString)

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

.callbacks =

(property) callbacks?: HtmlEscapedCallback[] | undefined

[addClassNameToContext]          

const addClassNameToContext: HtmlEscapedCallback

const promise =

const promise: Promise<CssClassName>

Promise

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

.resolve

(method) PromiseConstructor.resolve<CssClassName>(value: CssClassName): Promise<CssClassName> (+2 overloads) Creates a new resolved promise for the provided value.

@param value — A promise.

@returns — A promise whose internal state matches the provided promise.

(className)          

const className: CssClassName

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.assign

(method) ObjectConstructor.assign<Promise<CssClassName>, CssClassNameCommon>(target: Promise<CssClassName>, source: CssClassNameCommon): Promise<...> & CssClassNameCommon (+3 overloads) Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object.

@param target — The target object to copy to.

@param source — The source object from which to copy properties.

(promise,

const promise: Promise<CssClassName>

cssClassName)          

(parameter) cssClassName: CssClassNameCommon

promise

const promise: Promise<CssClassName>

.toString =

(method) Object.toString(): string Returns a string representation of an object.

cssJsxDomObject

const cssJsxDomObject: { toString(this: CssClassNameCommon): string; }

.toString          

(method) toString(this: CssClassNameCommon): string

return promise          

const promise: Promise<CssClassName>

} const css:

const css: CssType

CssType =

interface CssType

(strings, ..

(parameter) strings: TemplateStringsArray

.values) => {          

(parameter) values: CssVariableType[]

return newCssClassNameObject

const newCssClassNameObject: (cssClassName: CssClassNameCommon) => Promise<string>

(cssCommon

(alias) cssCommon(strings: TemplateStringsArray, values: CssVariableType[]): CssClassNameCommon import cssCommon

(strings,

(parameter) strings: TemplateStringsArray

values))          

(parameter) values: CssVariableType[]

} const cx:

const cx: CxType

CxType = (..

interface CxType

.args) => {          

(parameter) args: (string | boolean | Promise<string> | CssClassName | null | undefined)[]

// eslint-disable-next-line @typescript-eslint/no-explicit-any args =

(parameter) args: (string | boolean | Promise<string> | CssClassName | null | undefined)[]

cxCommon

(alias) cxCommon(args: (string | boolean | null | undefined | CssClassNameCommon)[]): (string | boolean | null | undefined | CssClassNameCommon)[] import cxCommon

(args as any) as any          

(parameter) args: (string | boolean | Promise<string> | CssClassName | null | undefined)[]

// eslint-disable-next-line @typescript-eslint/no-explicit-any return css

const css: CssType (strings: TemplateStringsArray, ...values: CssVariableType[]) => Promise<string>

(Array

var Array: ArrayConstructor (arrayLength?: number) => any[] (+2 overloads)

(args

(parameter) args: (string | boolean | Promise<string> | CssClassName | null | undefined)[]

.length)

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

.fill('') as any, ..

(method) Array<any>.fill(value: any, start?: number, end?: number): any[] Changes all array elements from start to end index to a static value and returns the modified array

@param value — value to fill array section with

@param start
index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.

@param end
index to stop filling the array at. If end is negative, it is treated as length+end.

.args)          

(parameter) args: (string | boolean | Promise<string> | CssClassName | null | undefined)[]

} const keyframes =

const keyframes: (strings: TemplateStringsArray, ...values: CssVariableType[]) => CssClassNameCommon

keyframesCommon          

(alias) const keyframesCommon: (strings: TemplateStringsArray, ...values: CssVariableType[]) => CssClassNameCommon import keyframesCommon

const viewTransition:

const viewTransition: ViewTransitionType

ViewTransitionType = ((          

interface ViewTransitionType

strings:

(parameter) strings: Promise<string> | TemplateStringsArray | undefined

TemplateStringsArray |

interface TemplateStringsArray

Promise | undefined,          

interface Promise<T> Represents the completion of an asynchronous operation

...values:

(parameter) values: CssVariableType[]

CssVariableType[]          

(alias) type CssVariableType = CssVariableBasicType | CssVariableAsyncType | CssVariableArrayType import CssVariableType

) => { // eslint-disable-next-line @typescript-eslint/no-explicit-any return newCssClassNameObject

const newCssClassNameObject: (cssClassName: CssClassNameCommon) => Promise<string>

(viewTransitionCommon

(alias) viewTransitionCommon(strings: TemplateStringsArray, values: CssVariableType[]): CssClassNameCommon (+2 overloads) import viewTransitionCommon

(strings as any,

(parameter) strings: Promise<string> | TemplateStringsArray | undefined

values))          

(parameter) values: CssVariableType[]

}) as ViewTransitionType          

interface ViewTransitionType

const Style:

const Style: StyleType

StyleType = ({

interface StyleType

children } = {}) =>          

(parameter) children: Promise<string> | undefined

children          

(parameter) children: Promise<string> | undefined

? raw(``)          

(alias) const STYLE_STRING: typeof STYLE_STRING import STYLE_STRING

: raw(``)          

(parameter) id: string

// eslint-disable-next-line @typescript-eslint/no-explicit-any ;(Style as any)

const Style: StyleType

[DOM_RENDERER] =

(alias) const DOM_RENDERER: typeof DOM_RENDERER import DOM_RENDERER

StyleRenderToDom          

const StyleRenderToDom: FC<PropsWithChildren<void>>

return { css,          

(property) DefaultContextType.css: CssType

cx,          

(property) DefaultContextType.cx: CxType

keyframes,          

(property) DefaultContextType.keyframes: KeyframesType

viewTransition:

(property) DefaultContextType.viewTransition: ViewTransitionType

viewTransition as

const viewTransition: ViewTransitionType

ViewTransitionType,          

interface ViewTransitionType

Style,          

(property) DefaultContextType.Style: StyleType

} } interface DefaultContextType {          

interface DefaultContextType

css:

(property) DefaultContextType.css: CssType

CssType          

interface CssType

cx:

(property) DefaultContextType.cx: CxType

CxType          

interface CxType

keyframes:

(property) DefaultContextType.keyframes: KeyframesType

KeyframesType          

interface KeyframesType

viewTransition:

(property) DefaultContextType.viewTransition: ViewTransitionType

ViewTransitionType          

interface ViewTransitionType

Style:

(property) DefaultContextType.Style: StyleType

StyleType          

interface StyleType

} const defaultContext:

const defaultContext: DefaultContextType

DefaultContextType =

interface DefaultContextType

createCssContext({          

const createCssContext: ({ id }: { id: Readonly<string>; }) => DefaultContextType

@experimental
createCssContext is an experimental feature. The API might be changed.

id:

(property) id: string

DEFAULT_STYLE_ID,          

(alias) const DEFAULT_STYLE_ID: "hono-css" import DEFAULT_STYLE_ID

}) /** * @experimental * `css` is an experimental feature. * The API might be changed. */ export const css =

const css: CssType

@experimental
css is an experimental feature. The API might be changed.

defaultContext

const defaultContext: DefaultContextType

.css          

(property) DefaultContextType.css: CssType

/** * @experimental * `cx` is an experimental feature. * The API might be changed. */ export const cx =

const cx: CxType

@experimental
cx is an experimental feature. The API might be changed.

defaultContext

const defaultContext: DefaultContextType

.cx          

(property) DefaultContextType.cx: CxType

/** * @experimental * `keyframes` is an experimental feature. * The API might be changed. */ export const keyframes =

const keyframes: KeyframesType

@experimental
keyframes is an experimental feature. The API might be changed.

defaultContext

const defaultContext: DefaultContextType

.keyframes          

(property) DefaultContextType.keyframes: KeyframesType

/** * @experimental * `viewTransition` is an experimental feature. * The API might be changed. */ export const viewTransition =

const viewTransition: ViewTransitionType

@experimental
viewTransition is an experimental feature. The API might be changed.

defaultContext

const defaultContext: DefaultContextType

.viewTransition          

(property) DefaultContextType.viewTransition: ViewTransitionType

/** * @experimental * `Style` is an experimental feature. * The API might be changed. */ export const Style =

const Style: StyleType

@experimental
Style is an experimental feature. The API might be changed.

defaultContext

const defaultContext: DefaultContextType

.Style          

(property) DefaultContextType.Style: StyleType

src/helper/dev/index.test.ts
            
                import { Hono } from '../../hono'
                import { RegExpRouter } from '../../router/reg-exp-router'
                import type { Handler, MiddlewareHandler } from '../../types'
                import { getRouterName, inspectRoutes, showRoutes } from '.'
                
                const namedMiddleware:

const namedMiddleware: MiddlewareHandler

MiddlewareHandler =

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

(_,

(parameter) _: Context<any, string, {}>

next) =>

(parameter) next: Next

next()          

(parameter) next: () => Promise<void>

const namedHandler:

const namedHandler: Handler

Handler =

(alias) type Handler<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = (c: Context<E, P, I>, next: Next) => R import Handler

(c) =>

(parameter) c: Context<any, any, BlankInput>

c

(parameter) c: Context<any, any, BlankInput>

.text('hi')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hi", StatusCode>(text: "hi", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"hi", StatusCode, "text"> (+1 overload)

const app = new

const app: Hono<{}, { "*": {}; } & { "/": { $get: { input: {}; output: "hi"; outputFormat: "text"; status: StatusCode; }; }; } & { "/named": { $get: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; } & ... 5 more ... & { ...; }, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.use('*',

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "*", {}>

next) =>

(parameter) next: Next

next())          

(parameter) next: () => Promise<void>

.get(          

(property) Hono<{}, { "*": {}; }, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"hi", StatusCode, "text">, BlankInput, BlankInput, {}, {}>(path: "/", handlers_0: H<{}, "/", BlankInput, any>, handlers_1: H<...>) => Hono<...> (+22 overloads)

'/', (_,

(parameter) _: Context<{}, "/", BlankInput>

next) =>

(parameter) next: Next

next(),          

(parameter) next: () => Promise<void>

(c) =>

(parameter) c: Context<{}, "/", BlankInput>

c

(parameter) c: Context<{}, "/", BlankInput>

.text('hi')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hi", StatusCode>(text: "hi", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"hi", StatusCode, "text"> (+1 overload)

) .get('/named',

(property) Hono<{}, { "*": {}; } & { "/": { $get: { input: {}; output: "hi"; outputFormat: "text"; status: StatusCode; }; }; }, "/">.get: HandlerInterface <"/named", any, any, {}, BlankInput, any, any>(path: "/named", handlers_0: H<any, any, {}, any>, handlers_1: H<any, any, BlankInput, any>) => Hono<{}, { ...; } & { ...; } & { ...; }, "/"> (+22 overloads)

namedMiddleware,

const namedMiddleware: MiddlewareHandler

namedHandler)          

const namedHandler: Handler

.post('/',

(property) Hono<{}, { "*": {}; } & { "/": { $get: { input: {}; output: "hi"; outputFormat: "text"; status: StatusCode; }; }; } & { "/named": { $get: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; }, "/">.post: HandlerInterface <"/", "/", Response & TypedResponse<"hi", StatusCode, "text">, BlankInput, {}>(path: "/", handler: H<{}, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<{}, "/", BlankInput>

c

(parameter) c: Context<{}, "/", BlankInput>

.text('hi'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hi", StatusCode>(text: "hi", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"hi", StatusCode, "text"> (+1 overload)

.put('/',

(property) Hono<{}, { "*": {}; } & { "/": { $get: { input: {}; output: "hi"; outputFormat: "text"; status: StatusCode; }; }; } & { "/named": { $get: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; } & { ...; }, "/">.put: HandlerInterface <"/", "/", Response & TypedResponse<"hi", StatusCode, "text">, BlankInput, {}>(path: "/", handler: H<{}, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<{}, "/", BlankInput>

c

(parameter) c: Context<{}, "/", BlankInput>

.text('hi'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hi", StatusCode>(text: "hi", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"hi", StatusCode, "text"> (+1 overload)

.patch('/',

(property) Hono<{}, { "*": {}; } & { "/": { $get: { input: {}; output: "hi"; outputFormat: "text"; status: StatusCode; }; }; } & { "/named": { $get: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; } & { ...; } & { ...; }, "/">.patch: HandlerInterface <"/", "/", Response & TypedResponse<"hi", StatusCode, "text">, BlankInput, {}>(path: "/", handler: H<{}, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<{}, "/", BlankInput>

c

(parameter) c: Context<{}, "/", BlankInput>

.text('hi'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hi", StatusCode>(text: "hi", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"hi", StatusCode, "text"> (+1 overload)

.delete('/',

(property) Hono<{}, { "*": {}; } & { "/": { $get: { input: {}; output: "hi"; outputFormat: "text"; status: StatusCode; }; }; } & { "/named": { $get: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; } & { ...; } & { ...; } & { ...; }, "/">.delete: HandlerInterface <"/", "/", Response & TypedResponse<"hi", StatusCode, "text">, BlankInput, {}>(path: "/", handler: H<{}, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<{}, "/", BlankInput>

c

(parameter) c: Context<{}, "/", BlankInput>

.text('hi'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hi", StatusCode>(text: "hi", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"hi", StatusCode, "text"> (+1 overload)

.options('/',

(property) Hono<{}, { "*": {}; } & { "/": { $get: { input: {}; output: "hi"; outputFormat: "text"; status: StatusCode; }; }; } & { "/named": { $get: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; } & { ...; } & { ...; } & { ...; } & { ...; }, "/">.options: HandlerInterface <"/", "/", Response & TypedResponse<"hi", StatusCode, "text">, BlankInput, {}>(path: "/", handler: H<{}, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<{}, "/", BlankInput>

c

(parameter) c: Context<{}, "/", BlankInput>

.text('hi'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hi", StatusCode>(text: "hi", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"hi", StatusCode, "text"> (+1 overload)

.get('/static', () => new

(property) Hono<{}, { "*": {}; } & { "/": { $get: { input: {}; output: "hi"; outputFormat: "text"; status: StatusCode; }; }; } & { "/named": { $get: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; } & ... 4 more ... & { ...; }, "/">.get: HandlerInterface <"/static", "/static", Response, BlankInput, {}>(path: "/static", handler: H<{}, "/static", BlankInput, Response>) => Hono<{}, { "*": {}; } & ... 7 more ... & { ...; }, "/"> (+22 overloads)

Response('hi'))          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

describe('inspectRoutes()', () => { it('should return correct data', async () => { expect(inspectRoutes

(alias) inspectRoutes<{}>(hono: Hono<{}, BlankSchema, "/">): RouteData[] import inspectRoutes

(app)).toEqual([          

const app: Hono<{}, { "*": {}; } & { "/": { $get: { input: {}; output: "hi"; outputFormat: "text"; status: StatusCode; }; }; } & { "/named": { $get: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; } & ... 5 more ... & { ...; }, "/">

{ path: '/*',

(property) path: string

method: 'ALL',

(property) method: string

name: '[middleware]',

(property) name: string

isMiddleware: true },          

(property) isMiddleware: boolean

{ path: '/',

(property) path: string

method: 'GET',

(property) method: string

name: '[middleware]',

(property) name: string

isMiddleware: true },          

(property) isMiddleware: boolean

{ path: '/',

(property) path: string

method: 'GET',

(property) method: string

name: '[handler]',

(property) name: string

isMiddleware: false },          

(property) isMiddleware: boolean

{ path: '/named',

(property) path: string

method: 'GET',

(property) method: string

name: 'namedMiddleware',

(property) name: string

isMiddleware: true },          

(property) isMiddleware: boolean

{ path: '/named',

(property) path: string

method: 'GET',

(property) method: string

name: 'namedHandler',

(property) name: string

isMiddleware: false },          

(property) isMiddleware: boolean

{ path: '/',

(property) path: string

method: 'POST',

(property) method: string

name: '[handler]',

(property) name: string

isMiddleware: false },          

(property) isMiddleware: boolean

{ path: '/',

(property) path: string

method: 'PUT',

(property) method: string

name: '[handler]',

(property) name: string

isMiddleware: false },          

(property) isMiddleware: boolean

{ path: '/',

(property) path: string

method: 'PATCH',

(property) method: string

name: '[handler]',

(property) name: string

isMiddleware: false },          

(property) isMiddleware: boolean

{ path: '/',

(property) path: string

method: 'DELETE',

(property) method: string

name: '[handler]',

(property) name: string

isMiddleware: false },          

(property) isMiddleware: boolean

{ path: '/',

(property) path: string

method: 'OPTIONS',

(property) method: string

name: '[handler]',

(property) name: string

isMiddleware: false },          

(property) isMiddleware: boolean

{ path: '/static',

(property) path: string

method: 'GET',

(property) method: string

name: '[handler]',

(property) name: string

isMiddleware: false },          

(property) isMiddleware: boolean

]) }) it('should return [handler] also for sub app', async () => { const subApp = new

const subApp: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

subApp

const subApp: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", JSONRespondReturn<0, StatusCode>, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json(0))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <0, StatusCode>(object: 0, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<0, StatusCode> (+1 overload)

subApp

const subApp: Hono<BlankEnv, BlankSchema, "/">

.onError(

(property) Hono<BlankEnv, BlankSchema, "/">.onError: (handler: ErrorHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .onError() handles an error and returns a customized Response.

@see — https://hono.dev/docs/api/hono#error-handling

@param handler — request Handler for error

@returns — changed Hono instance

@example
ts app.onError((err, c) => { console.error(`${err}`) return c.text('Custom Error Message', 500) })

(_,

(parameter) _: Error | HTTPResponseError

c) =>

(parameter) c: Context<BlankEnv, any, {}>

c

(parameter) c: Context<BlankEnv, any, {}>

.json(0))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <0, StatusCode>(object: 0, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<0, StatusCode> (+1 overload)

const mainApp = new

const mainApp: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

mainApp

const mainApp: Hono<BlankEnv, BlankSchema, "/">

.route('/',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/", BlankEnv, BlankSchema, "/">(path: "/", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

subApp)          

const subApp: Hono<BlankEnv, BlankSchema, "/">

expect(inspectRoutes

(alias) inspectRoutes<BlankEnv>(hono: Hono<BlankEnv, BlankSchema, "/">): RouteData[] import inspectRoutes

(mainApp)).toEqual([          

const mainApp: Hono<BlankEnv, BlankSchema, "/">

{ isMiddleware: false,          

(property) isMiddleware: boolean

method: 'GET',          

(property) method: string

name: '[handler]',          

(property) name: string

path: '/',          

(property) path: string

}, ]) }) }) describe('showRoutes()', () => { let logs: string[] = []          

let logs: string[]

let originalLog: typeof

let originalLog: (...data: any[]) => void

console

var console: Console

.log          

(method) Console.log(...data: any[]): void MDN Reference

beforeAll(() => { originalLog =

let originalLog: (...data: any[]) => void

console

var console: Console

.log          

(method) Console.log(...data: any[]): void MDN Reference

console

var console: Console

.log = (..

(method) Console.log(...data: any[]): void MDN Reference

.args) =>

(parameter) args: any[]

logs

let logs: string[]

.push(..

(method) Array<string>.push(...items: string[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

.args)          

(parameter) args: any[]

}) afterAll(() => { console

var console: Console

.log =

(method) Console.log(...data: any[]): void MDN Reference

originalLog          

let originalLog: (...data: any[]) => void

}) beforeEach(() => { logs = []          

let logs: string[]

}) it('should render simple output', async () => { showRoutes

(alias) showRoutes<{}>(hono: Hono<{}, BlankSchema, "/">, opts?: ShowRoutesOptions): void import showRoutes

(app)          

const app: Hono<{}, { "*": {}; } & { "/": { $get: { input: {}; output: "hi"; outputFormat: "text"; status: StatusCode; }; }; } & { "/named": { $get: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; } & ... 5 more ... & { ...; }, "/">

expect(logs).toEqual([          

let logs: string[]

'\x1b[32mGET\x1b[0m /', '\x1b[32mGET\x1b[0m /named', '\x1b[32mPOST\x1b[0m /', '\x1b[32mPUT\x1b[0m /', '\x1b[32mPATCH\x1b[0m /', '\x1b[32mDELETE\x1b[0m /', '\x1b[32mOPTIONS\x1b[0m /', '\x1b[32mGET\x1b[0m /static', ]) }) it('should render output includes handlers and middlewares', async () => { showRoutes

(alias) showRoutes<{}>(hono: Hono<{}, BlankSchema, "/">, opts?: ShowRoutesOptions): void import showRoutes

(app, {

const app: Hono<{}, { "*": {}; } & { "/": { $get: { input: {}; output: "hi"; outputFormat: "text"; status: StatusCode; }; }; } & { "/named": { $get: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; } & ... 5 more ... & { ...; }, "/">

verbose: true })          

(property) ShowRoutesOptions.verbose?: boolean | undefined

expect(logs).toEqual([          

let logs: string[]

'\x1b[32mALL\x1b[0m /*', ' [middleware]', '\x1b[32mGET\x1b[0m /', ' [middleware]', ' [handler]', '\x1b[32mGET\x1b[0m /named', ' namedMiddleware', ' namedHandler', '\x1b[32mPOST\x1b[0m /', ' [handler]', '\x1b[32mPUT\x1b[0m /', ' [handler]', '\x1b[32mPATCH\x1b[0m /', ' [handler]', '\x1b[32mDELETE\x1b[0m /', ' [handler]', '\x1b[32mOPTIONS\x1b[0m /', ' [handler]', '\x1b[32mGET\x1b[0m /static', ' [handler]', ]) }) it('should render not colorized output', async () => { showRoutes

(alias) showRoutes<{}>(hono: Hono<{}, BlankSchema, "/">, opts?: ShowRoutesOptions): void import showRoutes

(app, {

const app: Hono<{}, { "*": {}; } & { "/": { $get: { input: {}; output: "hi"; outputFormat: "text"; status: StatusCode; }; }; } & { "/named": { $get: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; } & ... 5 more ... & { ...; }, "/">

colorize: false })          

(property) ShowRoutesOptions.colorize?: boolean | undefined

expect(logs).toEqual([          

let logs: string[]

'GET /', 'GET /named', 'POST /', 'PUT /', 'PATCH /', 'DELETE /', 'OPTIONS /', 'GET /static', ]) }) }) describe('showRoutes() in NO_COLOR', () => { let logs: string[] = []          

let logs: string[]

let originalLog: typeof

let originalLog: (...data: any[]) => void

console

var console: Console

.log          

(method) Console.log(...data: any[]): void MDN Reference

beforeAll(() => { vi.stubEnv('NO_COLOR', '1') originalLog =

let originalLog: (...data: any[]) => void

console

var console: Console

.log          

(method) Console.log(...data: any[]): void MDN Reference

console

var console: Console

.log = (..

(method) Console.log(...data: any[]): void MDN Reference

.args) =>

(parameter) args: any[]

logs

let logs: string[]

.push(..

(method) Array<string>.push(...items: string[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

.args)          

(parameter) args: any[]

}) afterAll(() => { vi.unstubAllEnvs() console

var console: Console

.log =

(method) Console.log(...data: any[]): void MDN Reference

originalLog          

let originalLog: (...data: any[]) => void

}) beforeEach(() => { logs = []          

let logs: string[]

}) it('should render not colorized output', async () => { showRoutes

(alias) showRoutes<{}>(hono: Hono<{}, BlankSchema, "/">, opts?: ShowRoutesOptions): void import showRoutes

(app)          

const app: Hono<{}, { "*": {}; } & { "/": { $get: { input: {}; output: "hi"; outputFormat: "text"; status: StatusCode; }; }; } & { "/named": { $get: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; } & ... 5 more ... & { ...; }, "/">

expect(logs).toEqual([          

let logs: string[]

'GET /', 'GET /named', 'POST /', 'PUT /', 'PATCH /', 'DELETE /', 'OPTIONS /', 'GET /static', ]) }) it('should render colorized output if colorize: true', async () => { showRoutes

(alias) showRoutes<{}>(hono: Hono<{}, BlankSchema, "/">, opts?: ShowRoutesOptions): void import showRoutes

(app, {

const app: Hono<{}, { "*": {}; } & { "/": { $get: { input: {}; output: "hi"; outputFormat: "text"; status: StatusCode; }; }; } & { "/named": { $get: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; } & ... 5 more ... & { ...; }, "/">

colorize: true })          

(property) ShowRoutesOptions.colorize?: boolean | undefined

expect(logs).toEqual([          

let logs: string[]

'\x1b[32mGET\x1b[0m /', '\x1b[32mGET\x1b[0m /named', '\x1b[32mPOST\x1b[0m /', '\x1b[32mPUT\x1b[0m /', '\x1b[32mPATCH\x1b[0m /', '\x1b[32mDELETE\x1b[0m /', '\x1b[32mOPTIONS\x1b[0m /', '\x1b[32mGET\x1b[0m /static', ]) }) }) describe('getRouterName()', () => { it('Should return the correct router name', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono({          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

router: new

(property) router?: Router<[H, RouterRoute]> | undefined router option specifices which router to use.

@see — https://hono.dev/docs/api/hono#router-option

@example
ts const app = new Hono({ router: new RegExpRouter() })

RegExpRouter(),          

(alias) new RegExpRouter<[H, RouterRoute]>(): RegExpRouter<[H, RouterRoute]> import RegExpRouter

}) expect(getRouterName

(alias) getRouterName<BlankEnv>(app: Hono<BlankEnv, BlankSchema, "/">): string import getRouterName

(app)).toBe('RegExpRouter')          

const app: Hono<BlankEnv, BlankSchema, "/">

}) })
src/helper/dev/index.ts
            
                /**
                 * @module
                 * Dev Helper for Hono.
                 */
                
                import type { Hono } from '../../hono'
                import type { Env, RouterRoute } from '../../types'
                import { getColorEnabled } from '../../utils/color'
                import { findTargetHandler, isMiddleware } from '../../utils/handler'
                
                interface ShowRoutesOptions {          

interface ShowRoutesOptions

verbose?: boolean          

(property) ShowRoutesOptions.verbose?: boolean | undefined

colorize?: boolean          

(property) ShowRoutesOptions.colorize?: boolean | undefined

} interface RouteData {          

interface RouteData

path: string          

(property) RouteData.path: string

method: string          

(property) RouteData.method: string

name: string          

(property) RouteData.name: string

isMiddleware: boolean          

(property) RouteData.isMiddleware: boolean

} const handlerName =

const handlerName: (handler: Function) => string

(handler:

(parameter) handler: Function

Function): string => {          

interface Function Creates a new function.

return handler

(parameter) handler: Function

.name ||

(property) Function.name: string Returns the name of the function. Function names are read-only and can not be changed.

(isMiddleware

(alias) isMiddleware(handler: Function): boolean import isMiddleware

(handler) ? '[middleware]' : '[handler]')          

(parameter) handler: Function

} export const inspectRoutes =

const inspectRoutes: <E extends Env>(hono: Hono<E>) => RouteData[]

<E extends

(type parameter) E in <E extends Env>(hono: Hono<E>): RouteData[]

Env>

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

(hono:

(parameter) hono: Hono<E, BlankSchema, "/">

Hono

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

<E>):

(type parameter) E in <E extends Env>(hono: Hono<E>): RouteData[]

RouteData[] => {          

interface RouteData

return hono

(parameter) hono: Hono<E, BlankSchema, "/">

.routes

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.routes: RouterRoute[]

.map(({

(method) Array<RouterRoute>.map<{ path: string; method: string; name: string; isMiddleware: boolean; }>(callbackfn: (value: RouterRoute, index: number, array: RouterRoute[]) => { path: string; method: string; name: string; isMiddleware: boolean; }, thisArg?: any): { path: string; method: string; name: string; isMiddleware: boolean; }[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

path,

(parameter) path: string

method,

(parameter) method: string

handler }:

(parameter) handler: H<any, any, BlankInput, any>

RouterRoute) => {          

(alias) interface RouterRoute import RouterRoute

const targetHandler =

const targetHandler: Function

findTargetHandler

(alias) findTargetHandler(handler: Function): Function import findTargetHandler

(handler)          

(parameter) handler: H<any, any, BlankInput, any>

return { path,          

(property) path: string

method,          

(property) method: string

name:

(property) name: string

handlerName

const handlerName: (handler: Function) => string

(targetHandler),          

const targetHandler: Function

isMiddleware:

(property) isMiddleware: boolean

isMiddleware

(alias) isMiddleware(handler: Function): boolean import isMiddleware

(targetHandler),          

const targetHandler: Function

} }) } export const showRoutes =

const showRoutes: <E extends Env>(hono: Hono<E>, opts?: ShowRoutesOptions) => void

<E extends

(type parameter) E in <E extends Env>(hono: Hono<E>, opts?: ShowRoutesOptions): void

Env>

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

(hono:

(parameter) hono: Hono<E, BlankSchema, "/">

Hono

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

<E>,

(type parameter) E in <E extends Env>(hono: Hono<E>, opts?: ShowRoutesOptions): void

opts?:

(parameter) opts: ShowRoutesOptions | undefined

ShowRoutesOptions): void => {          

interface ShowRoutesOptions

const colorEnabled =

const colorEnabled: boolean

opts?

(parameter) opts: ShowRoutesOptions | undefined

.colorize ??

(property) ShowRoutesOptions.colorize?: boolean | undefined

getColorEnabled()          

(alias) getColorEnabled(): boolean import getColorEnabled Get whether color change on terminal is enabled or disabled. If NO_COLOR environment variable is set, this function returns false.

@see — https://no-color.org/

@returns

const routeData:

const routeData: Record<string, RouteData[]>

Record

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

RouteData[]> = {}          

interface RouteData

let maxMethodLength = 0          

let maxMethodLength: number

let maxPathLength = 0          

let maxPathLength: number

inspectRoutes

const inspectRoutes: <E>(hono: Hono<E, BlankSchema, "/">) => RouteData[]

(hono)          

(parameter) hono: Hono<E, BlankSchema, "/">

.filter(({

(method) Array<RouteData>.filter(predicate: (value: RouteData, index: number, array: RouteData[]) => unknown, thisArg?: any): RouteData[] (+1 overload) Returns the elements of an array that meet the condition specified in a callback function.

@param predicate — A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

isMiddleware }) =>

(parameter) isMiddleware: boolean

opts?

(parameter) opts: ShowRoutesOptions | undefined

.verbose ||

(property) ShowRoutesOptions.verbose?: boolean | undefined

!isMiddleware)          

(parameter) isMiddleware: boolean

.map(

(method) Array<RouteData>.map<{ method: string; path: string; routes: RouteData[]; } | undefined>(callbackfn: (value: RouteData, index: number, array: RouteData[]) => { method: string; path: string; routes: RouteData[]; } | undefined, thisArg?: any): ({ method: string; path: string; routes: RouteData[]; } | undefined)[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(route) => {          

(parameter) route: RouteData

const key = `$

const key: string

{route

(parameter) route: RouteData

.method}-$

(property) RouteData.method: string

{route

(parameter) route: RouteData

.path}`          

(property) RouteData.path: string

;(routeData

const routeData: Record<string, RouteData[]>

[key] ||= [])

const key: string

.push

(method) Array<RouteData>.push(...items: RouteData[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(route)          

(parameter) route: RouteData

if (routeData

const routeData: Record<string, RouteData[]>

[key]

const key: string

.length > 1) {          

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

return } maxMethodLength =

let maxMethodLength: number

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.max

(method) Math.max(...values: number[]): number Returns the larger of a set of supplied numeric expressions.

@param values — Numeric expressions to be evaluated.

(maxMethodLength,

let maxMethodLength: number

route

(parameter) route: RouteData

.method

(property) RouteData.method: string

.length)          

(property) String.length: number Returns the length of a String object.

maxPathLength =

let maxPathLength: number

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.max

(method) Math.max(...values: number[]): number Returns the larger of a set of supplied numeric expressions.

@param values — Numeric expressions to be evaluated.

(maxPathLength,

let maxPathLength: number

route

(parameter) route: RouteData

.path

(property) RouteData.path: string

.length)          

(property) String.length: number Returns the length of a String object.

return { method:

(property) method: string

route

(parameter) route: RouteData

.method,

(property) RouteData.method: string

path:

(property) path: string

route

(parameter) route: RouteData

.path,

(property) RouteData.path: string

routes:

(property) routes: RouteData[]

routeData

const routeData: Record<string, RouteData[]>

[key] }          

const key: string

}) .forEach(

(method) Array<{ method: string; path: string; routes: RouteData[]; } | undefined>.forEach(callbackfn: (value: { method: string; path: string; routes: RouteData[]; } | undefined, index: number, array: ({ method: string; path: string; routes: RouteData[]; } | undefined)[]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(data) => {          

(parameter) data: { method: string; path: string; routes: RouteData[]; } | undefined

if (!data) {          

(parameter) data: { method: string; path: string; routes: RouteData[]; } | undefined

return } const { method,

const method: string

path,

const path: string

routes } =

const routes: RouteData[]

data          

(parameter) data: { method: string; path: string; routes: RouteData[]; }

const methodStr =

const methodStr: string

colorEnabled ? `\x1b[32m$

const colorEnabled: boolean

{method}\x1b[0m` :

const method: string

method          

const method: string

console

var console: Console

.log(`$

(method) Console.log(...data: any[]): void MDN Reference

{methodStr} ${' '

const methodStr: string

.repeat

(method) String.repeat(count: number): string Returns a String value that is made from count copies appended together. If count is 0, the empty string is returned.

@param count — number of copies to append

(maxMethodLength -

let maxMethodLength: number

method

const method: string

.length)} $

(property) String.length: number Returns the length of a String object.

{path}`)          

const path: string

if (!opts?

(parameter) opts: ShowRoutesOptions | undefined

.verbose) {          

(property) ShowRoutesOptions.verbose?: boolean | undefined

return } routes

const routes: RouteData[]

.forEach(({

(method) Array<RouteData>.forEach(callbackfn: (value: RouteData, index: number, array: RouteData[]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

name }) => {          

(parameter) name: string

console

var console: Console

.log(`${' '

(method) Console.log(...data: any[]): void MDN Reference

.repeat

(method) String.repeat(count: number): string Returns a String value that is made from count copies appended together. If count is 0, the empty string is returned.

@param count — number of copies to append

(maxMethodLength + 3)} $

let maxMethodLength: number

{name}`)          

(parameter) name: string

}) }) } export const getRouterName =

const getRouterName: <E extends Env>(app: Hono<E>) => string

<E extends

(type parameter) E in <E extends Env>(app: Hono<E>): string

Env>

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

(app:

(parameter) app: Hono<E, BlankSchema, "/">

Hono

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

<E>): string => {          

(type parameter) E in <E extends Env>(app: Hono<E>): string

app

(parameter) app: Hono<E, BlankSchema, "/">

.router

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.router: Router<[H, RouterRoute]>

.match('GET', '/')          

(method) Router<[H, RouterRoute]>.match(method: string, path: string): Result<[H, RouterRoute]> Matches a route based on the given method and path.

@param method — The HTTP method (e.g., 'get', 'post').

@param path — The path to match.

@returns — The result of the match.

return app

(parameter) app: Hono<E, BlankSchema, "/">

.router

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.router: Router<[H, RouterRoute]>

.name          

(property) Router<[H, RouterRoute]>.name: string The name of the router.

}
src/helper/factory/index.test.ts
            
                /* eslint-disable @typescript-eslint/no-unused-vars */
                import { expectTypeOf } from 'vitest'
                import { hc } from '../../client'
                import type { ClientRequest } from '../../client/types'
                import { Hono } from '../../index'
                import type { ToSchema, TypedResponse } from '../../types'
                import type { StatusCode } from '../../utils/http-status'
                import { validator } from '../../validator'
                import { createFactory, createMiddleware } from './index'
                
                describe('createMiddleware', () => {
                  type Env = {

type Env = { Variables: { foo: string; }; }

Variables: {

(property) Variables: { foo: string; }

foo: string } }          

(property) foo: string

const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const mw =

const mw: (message: string) => MiddlewareHandler<Env, string, {}>

(message: string) =>          

(parameter) message: string

createMiddleware

(alias) createMiddleware<Env, string, {}>(middleware: MiddlewareHandler<Env, string, {}>): MiddlewareHandler<Env, string, {}> import createMiddleware

<Env>(async

type Env = { Variables: { foo: string; }; }

(c,

(parameter) c: Context<Env, string, {}>

next) => {          

(parameter) next: Next

expectTypeOf(c

(parameter) c: Context<Env, string, {}>

.var

(property) Context<Env, string, {}>.var: Readonly<ContextVariableMap & { foo: string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.foo).toEqualTypeOf()          

(property) foo: string

c

(parameter) c: Context<Env, string, {}>

.set('foo', 'bar')          

(property) Context<Env, string, {}>.set: Set <"foo">(key: "foo", value: string) => void (+1 overload)

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<Env, string, {}>

.header('X-Message',

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

message)          

(parameter) message: string

}) const route =

const route: Hono<BlankEnv, { "/message": { $get: { input: {}; output: `Hey, ${string}`; outputFormat: "text"; status: StatusCode; }; }; }, "/">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/message',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/message", "/message", Response & TypedResponse<`Hey, ${string}`, StatusCode, "text">, {}, {}, Env, Env>(path: "/message", handlers_0: H<Env, "/message", {}, any>, handlers_1: H<...>) => Hono<...> (+22 overloads)

mw('Hello Middleware'),

const mw: (message: string) => MiddlewareHandler<Env, string, {}>

(c) => {          

(parameter) c: Context<Env, "/message", {}>

return c

(parameter) c: Context<Env, "/message", {}>

.text(`Hey, $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`Hey, ${string}`, StatusCode>(text: `Hey, ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<Env, "/message", {}>

.var

(property) Context<Env, "/message", {}>.var: Readonly<ContextVariableMap & { foo: string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.foo}`)          

(property) foo: string

}) it('Should return the correct header and the content', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/message')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-message')).toBe('Hello Middleware')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('Hey, bar')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should provide the correct types', async () => { const client =

const client: { message: ClientRequest<{ $get: { input: {}; output: `Hey, ${string}`; outputFormat: "text"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/message": { $get: { input: {}; output: `Hey, ${string}`; outputFormat: "text"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

route>('http://localhost')          

const route: Hono<BlankEnv, { "/message": { $get: { input: {}; output: `Hey, ${string}`; outputFormat: "text"; status: StatusCode; }; }; }, "/">

const url =

const url: URL

client.message

const client: { message: ClientRequest<{ $get: { input: {}; output: `Hey, ${string}`; outputFormat: "text"; status: StatusCode; }; }>; }

.$url()          

(property) $url: (arg?: {} | undefined) => URL

expect(url

const url: URL

.pathname).toBe('/message')          

(property) URL.pathname: string MDN Reference

}) }) describe('createHandler', () => { const mw =

const mw: (message: string) => MiddlewareHandler<any, string, {}>

(message: string) =>          

(parameter) message: string

createMiddleware(async

(alias) createMiddleware<any, string, {}>(middleware: MiddlewareHandler<any, string, {}>): MiddlewareHandler<any, string, {}> import createMiddleware

(c,

(parameter) c: Context<any, string, {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<any, string, {}>

.header('x-message',

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

message)          

(parameter) message: string

}) describe('Basic', () => { const factory =

const factory: Factory<any, any>

createFactory()          

(alias) createFactory<any, any>(init?: { initApp?: InitApp<any> | undefined; } | undefined): Factory<any, any> import createFactory

const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const handlersA =

const handlersA: [H<any, any, {}, Response & TypedResponse<"A", StatusCode, "text">>]

factory

const factory: Factory<any, any>

.createHandlers(

(property) Factory<any, any>.createHandlers: CreateHandlersInterface <{}, Response & TypedResponse<"A", StatusCode, "text">>(handler1: H<any, any, {}, Response & TypedResponse<"A", StatusCode, "text">>) => [...] (+9 overloads)

(c) => {          

(parameter) c: Context<any, any, {}>

return c

(parameter) c: Context<any, any, {}>

.text('A')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"A", StatusCode>(text: "A", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"A", StatusCode, "text"> (+1 overload)

}) const routesA =

const routesA: Hono<BlankEnv, { "/a": { $get: { input: {}; output: "A"; outputFormat: "text"; status: StatusCode; }; }; }, "/">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/a', ..

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/a", any, Response & TypedResponse<"A", StatusCode, "text">, {}, any>(path: "/a", handler: H<any, any, {}, Response & TypedResponse<"A", StatusCode, "text">>) => Hono<...> (+22 overloads)

.handlersA)          

const handlersA: [H<any, any, {}, Response & TypedResponse<"A", StatusCode, "text">>]

const handlersB =

const handlersB: [H<any, any, {}, Response & TypedResponse<"B", StatusCode, "text">>, H<any, any, {}, Response & TypedResponse<"B", StatusCode, "text">>]

factory

const factory: Factory<any, any>

.createHandlers

(property) Factory<any, any>.createHandlers: CreateHandlersInterface <{}, {}, Response & TypedResponse<"B", StatusCode, "text">>(handler1: H<any, any, {}, Response & TypedResponse<"B", StatusCode, "text">>, handler2: H<...>) => [...] (+9 overloads)

(mw('B'),

const mw: (message: string) => MiddlewareHandler<any, string, {}>

(c) => {          

(parameter) c: Context<any, any, {}>

return c

(parameter) c: Context<any, any, {}>

.text('B')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"B", StatusCode>(text: "B", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"B", StatusCode, "text"> (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/b', ..

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/b", any, Response & TypedResponse<"B", StatusCode, "text">, {}, {}, any, any>(path: "/b", handlers_0: H<any, any, {}, any>, handlers_1: H<any, any, {}, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

.handlersB)          

const handlersB: [H<any, any, {}, Response & TypedResponse<"B", StatusCode, "text">>, H<any, any, {}, Response & TypedResponse<"B", StatusCode, "text">>]

it('Should return 200 response - GET /a', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/a')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('A')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return 200 response with a custom header - GET /b', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/b')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-message')).toBe('B')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('B')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return correct path types - /a', () => { const client =

const client: { a: ClientRequest<{ $get: { input: {}; output: "A"; outputFormat: "text"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<BlankEnv, { "/a": { $get: { input: {}; output: "A"; outputFormat: "text"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

routesA>('/')          

const routesA: Hono<BlankEnv, { "/a": { $get: { input: {}; output: "A"; outputFormat: "text"; status: StatusCode; }; }; }, "/">

expectTypeOf(client).toEqualTypeOf<{          

const client: { a: ClientRequest<{ $get: { input: {}; output: "A"; outputFormat: "text"; status: StatusCode; }; }>; }

a:

(property) a: ClientRequest<{ $get: { input: {}; output: "A"; outputFormat: "text"; status: StatusCode; }; }>

ClientRequest<{          

(alias) type ClientRequest<S extends Schema> = { [M in keyof S]: S[M] extends Endpoint & { input: infer R; } ? R extends object ? HasRequiredKeys<R> extends true ? (args: R, options?: ClientRequestOptions) => Promise<ClientResponseOfEndpoint<...>> : (args?: R, options?: ClientRequestOptions) => Promise<ClientResponseOfEndpoint<...>> : never : never; } & { ...; } & (S["$get"] extends { ...; } ? S["$get"] extends { ...; } ? { ...; } : {} : {}) import ClientRequest

$get: {          

(property) $get: { input: {}; output: "A"; outputFormat: "text"; status: StatusCode; }

input: {}          

(property) input: {}

output: 'A'          

(property) output: "A"

outputFormat: 'text'          

(property) outputFormat: "text"

status:

(property) status: StatusCode

StatusCode          

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

} }> }>() }) }) describe('Types', () => { type Env = {

type Env = { Variables: { foo: string; }; }

Variables: {

(property) Variables: { foo: string; }

foo: string } }          

(property) foo: string

const factory =

const factory: Factory<Env, any>

createFactory

(alias) createFactory<Env, any>(init?: { initApp?: InitApp<Env> | undefined; } | undefined): Factory<Env, any> import createFactory

<Env>()          

type Env = { Variables: { foo: string; }; }

const app = new

const app: Hono<Env, BlankSchema, "/">

Hono

(alias) new Hono<Env, BlankSchema, "/">(options?: HonoOptions<Env>): Hono<Env, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

<Env>()          

type Env = { Variables: { foo: string; }; }

const handlers =

const handlers: [H<Env, any, { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }, JSONRespondReturn<{ page: string; foo: string; }, StatusCode>>, H<...>]

factory

const factory: Factory<Env, any>

.createHandlers(          

(property) Factory<Env, any>.createHandlers: CreateHandlersInterface <{ in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }, { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }, JSONRespondReturn<{ page: string; foo: string; }, StatusCode>>(handler1: H<...>, handler2: H<...>) => [...] (+9 overloads)

validator('query', () => {          

(alias) validator<unknown, any, string, "query", { page: string; }, { page: string; }, any, { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }, Env>(target: "query", validationFunc: ValidationFunction<Record<string, string | string[]>, { ...; }, Env, any>): MiddlewareHandler<...> import validator

return { page: '1',          

(property) page: string

} }), (c) => {          

(parameter) c: Context<Env, any, { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }>

const foo =

const foo: string

c

(parameter) c: Context<Env, any, { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }>

.var

(property) Context<Env, any, { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }>.var: Readonly<ContextVariableMap & { foo: string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.foo          

(property) foo: string

const { page } =

const page: string

c

(parameter) c: Context<Env, any, { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }>

.req

(property) Context<Env, any, { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }>.req: HonoRequest<any, { query: { page: string; }; }> .req is the instance of HonoRequest.

.valid('query')          

(method) HonoRequest<any, { query: { page: string; }; }>.valid<"query">(target: "query"): { page: string; } Gets validated data from the request.

@param target — The target of the validation.

@returns — The validated data.

@see — https://hono.dev/docs/api/request#valid

return c

(parameter) c: Context<Env, any, { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ page: string; foo: string; }, StatusCode>(object: { page: string; foo: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

page,

(property) page: string

foo })          

(property) foo: string

} ) const routes =

const routes: Hono<Env, { "/posts": { $get: { input: { query: { page: string | string[]; }; }; output: { page: string; foo: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

app

const app: Hono<Env, BlankSchema, "/">

.get('/posts', ..

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/posts", any, JSONRespondReturn<{ page: string; foo: string; }, StatusCode>, { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }, { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }, Env, Env>(path: "/posts", handlers_0: H<...>, handlers_1: H<...>) => Hono<...> (+22 overloads)

.handlers)          

const handlers: [H<Env, any, { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }, JSONRespondReturn<{ page: string; foo: string; }, StatusCode>>, H<...>]

type Expected =

type Expected = Hono<Env, { "/posts": { $get: { input: { query: { page: string; }; }; output: { page: string; foo: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono<          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

Env,          

type Env = { Variables: { foo: string; }; }

ToSchema<          

(alias) type ToSchema<M extends string, P extends string, I extends Input | Input["in"], RorO> = { [KeyType in keyof { [K in P]: { [K2 in M as `$${Lowercase<K2>}`]: { [KeyType in keyof ({ input: AddParam<ExtractInput<I>, P>; } & (IsAny<RorO> extends true ? { ...; } : RorO extends TypedResponse<...> ? { ...; } : { ...; }))]: ({ input: AddParam<ExtractInput<I>, P>; } & (IsAny<RorO> extends true ? { ...; } : RorO extends TypedResponse<...> ? { ...; } : { ...; }))[KeyType]; }; }; }]: { [K in P]: { [K2 in M as `$${Lowercase<K2>}`]: { [KeyType in keyof ({ input: AddParam<ExtractInput<I>, P>; } & (IsAny<RorO> extends true ? { ...; } : RorO extends TypedResponse<...> ? { ...; } : { ...; }))]: ({ input: AddParam<ExtractInput<I>, P>; } & (IsAny<RorO> extends true ? { ...; } : RorO extends TypedResponse<...> ? { ...; } : { ...; }))[KeyType]; }; }; }[KeyType]; } import ToSchema

'get', '/posts', { in: {          

(property) in: { query: { page: string; }; }

query: {          

(property) query: { page: string; }

page: string          

(property) page: string

} } }, TypedResponse<{          

(alias) type TypedResponse<T = unknown, U extends StatusCode = StatusCode, F extends ResponseFormat = T extends string ? "text" : T extends JSONValue ? "json" : string> = { _data: T; _status: U; _format: F; } import TypedResponse

page: string          

(property) page: string

foo: string          

(property) foo: string

}> >, '/' > it('Should return correct types', () => { expectTypeOf(routes).toEqualTypeOf

const routes: Hono<Env, { "/posts": { $get: { input: { query: { page: string | string[]; }; }; output: { page: string; foo: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

<Expected>()          

type Expected = Hono<Env, { "/posts": { $get: { input: { query: { page: string; }; }; output: { page: string; foo: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

}) }) // It's difficult to cover all possible patterns, // so these tests will only cover the minimal cases. describe('Types - Complex', () => { type Env = {

type Env = { Variables: { foo: string; }; }

Variables: {

(property) Variables: { foo: string; }

foo: string } }          

(property) foo: string

const factory =

const factory: Factory<Env, any>

createFactory

(alias) createFactory<Env, any>(init?: { initApp?: InitApp<Env> | undefined; } | undefined): Factory<Env, any> import createFactory

<Env>()          

type Env = { Variables: { foo: string; }; }

const app = new

const app: Hono<Env, BlankSchema, "/">

Hono

(alias) new Hono<Env, BlankSchema, "/">(options?: HonoOptions<Env>): Hono<Env, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

<Env>()          

type Env = { Variables: { foo: string; }; }

const handlers =

const handlers: [H<Env, any, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; }, JSONRespondReturn<{ auth: string; page: string; foo: string; id: number; }, StatusCode>>, H<...>, H<...>, H<...>]

factory

const factory: Factory<Env, any>

.createHandlers(          

(property) Factory<Env, any>.createHandlers: CreateHandlersInterface <{ in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; }, { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }, { in: { json: { id: number; }; }; out: { json: { id: number; }; }; }, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; } & ... 1 more ... & { in: { json: { id: number; }; }; out: { json: { id: number; }; }; }, JSONRespondReturn<...>>(handler1: H<...>, handler2: H<...>, handler3: H<...>, handler4: H<...>) => [...] (+9 overloads)

validator('header', () => {          

(alias) validator<unknown, any, string, "header", { auth: string; }, { auth: string; }, any, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; }, Env>(target: "header", validationFunc: ValidationFunction<Record<string, string>, { ...; }, Env, any>): MiddlewareHandler<...> import validator

return { auth: 'token',          

(property) auth: string

} }), validator('query', () => {          

(alias) validator<unknown, any, string, "query", { page: string; }, { page: string; }, any, { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; }, Env>(target: "query", validationFunc: ValidationFunction<Record<string, string | string[]>, { ...; }, Env, any>): MiddlewareHandler<...> import validator

return { page: '1',          

(property) page: string

} }), validator('json', () => {          

(alias) validator<unknown, any, string, "json", { id: number; }, { id: number; }, any, { in: { json: { id: number; }; }; out: { json: { id: number; }; }; }, Env>(target: "json", validationFunc: ValidationFunction<any, { id: number; }, Env, any>): MiddlewareHandler<...> import validator

return { id: 123,          

(property) id: number

} }), (c) => {          

(parameter) c: Context<Env, any, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; } & { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; } & { in: { json: { id: number; }; }; out: { ...; }; }>

const foo =

const foo: string

c

(parameter) c: Context<Env, any, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; } & { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; } & { in: { json: { id: number; }; }; out: { ...; }; }>

.var

(property) Context<Env, any, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; } & { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; } & { in: { json: { id: number; }; }; out: { ...; }; }>.var: Readonly<ContextVariableMap & { foo: string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.foo          

(property) foo: string

const { auth } =

const auth: string

c

(parameter) c: Context<Env, any, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; } & { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; } & { in: { json: { id: number; }; }; out: { ...; }; }>

.req

(property) Context<Env, any, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; } & { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; } & { in: { json: { id: number; }; }; out: { ...; }; }>.req: HonoRequest<any, { header: { auth: string; }; } & { query: { page: string; }; } & { json: { id: number; }; }> .req is the instance of HonoRequest.

.valid('header')          

(method) HonoRequest<any, { header: { auth: string; }; } & { query: { page: string; }; } & { json: { id: number; }; }>.valid<"header">(target: "header"): { auth: string; } Gets validated data from the request.

@param target — The target of the validation.

@returns — The validated data.

@see — https://hono.dev/docs/api/request#valid

const { page } =

const page: string

c

(parameter) c: Context<Env, any, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; } & { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; } & { in: { json: { id: number; }; }; out: { ...; }; }>

.req

(property) Context<Env, any, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; } & { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; } & { in: { json: { id: number; }; }; out: { ...; }; }>.req: HonoRequest<any, { header: { auth: string; }; } & { query: { page: string; }; } & { json: { id: number; }; }> .req is the instance of HonoRequest.

.valid('query')          

(method) HonoRequest<any, { header: { auth: string; }; } & { query: { page: string; }; } & { json: { id: number; }; }>.valid<"query">(target: "query"): { page: string; } Gets validated data from the request.

@param target — The target of the validation.

@returns — The validated data.

@see — https://hono.dev/docs/api/request#valid

const { id } =

const id: number

c

(parameter) c: Context<Env, any, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; } & { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; } & { in: { json: { id: number; }; }; out: { ...; }; }>

.req

(property) Context<Env, any, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; } & { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; } & { in: { json: { id: number; }; }; out: { ...; }; }>.req: HonoRequest<any, { header: { auth: string; }; } & { query: { page: string; }; } & { json: { id: number; }; }> .req is the instance of HonoRequest.

.valid('json')          

(method) HonoRequest<any, { header: { auth: string; }; } & { query: { page: string; }; } & { json: { id: number; }; }>.valid<"json">(target: "json"): { id: number; } Gets validated data from the request.

@param target — The target of the validation.

@returns — The validated data.

@see — https://hono.dev/docs/api/request#valid

return c

(parameter) c: Context<Env, any, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; } & { in: { query: { page: string | string[]; }; }; out: { query: { page: string; }; }; } & { in: { json: { id: number; }; }; out: { ...; }; }>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ auth: string; page: string; foo: string; id: number; }, StatusCode>(object: { auth: string; page: string; foo: string; id: number; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

auth,

(property) auth: string

page,

(property) page: string

foo,

(property) foo: string

id })          

(property) id: number

} ) const routes =

const routes: Hono<Env, { "/posts": { $get: { input: { header: { auth: string; }; } & { query: { page: string | string[]; }; } & { json: { id: number; }; }; output: { auth: string; page: string; foo: string; id: number; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

app

const app: Hono<Env, BlankSchema, "/">

.get('/posts', ..

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/posts", any, JSONRespondReturn<{ auth: string; page: string; foo: string; id: number; }, StatusCode>, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; }, { ...; }, { ...; }, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; } & ... 1 more ... & { ...; }, Env, Env, Env, Env>(path: "/posts", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>) => Hono<...> (+22 overloads)

.handlers)          

const handlers: [H<Env, any, { in: { header: { auth: string; }; }; out: { header: { auth: string; }; }; }, JSONRespondReturn<{ auth: string; page: string; foo: string; id: number; }, StatusCode>>, H<...>, H<...>, H<...>]

type Expected =

type Expected = Hono<Env, { "/posts": { $get: { input: { header: { auth: string; }; } & { query: { page: string; }; } & { json: { id: number; }; }; output: { ...; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono<          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

Env,          

type Env = { Variables: { foo: string; }; }

ToSchema<          

(alias) type ToSchema<M extends string, P extends string, I extends Input | Input["in"], RorO> = { [KeyType in keyof { [K in P]: { [K2 in M as `$${Lowercase<K2>}`]: { [KeyType in keyof ({ input: AddParam<ExtractInput<I>, P>; } & (IsAny<RorO> extends true ? { ...; } : RorO extends TypedResponse<...> ? { ...; } : { ...; }))]: ({ input: AddParam<ExtractInput<I>, P>; } & (IsAny<RorO> extends true ? { ...; } : RorO extends TypedResponse<...> ? { ...; } : { ...; }))[KeyType]; }; }; }]: { [K in P]: { [K2 in M as `$${Lowercase<K2>}`]: { [KeyType in keyof ({ input: AddParam<ExtractInput<I>, P>; } & (IsAny<RorO> extends true ? { ...; } : RorO extends TypedResponse<...> ? { ...; } : { ...; }))]: ({ input: AddParam<ExtractInput<I>, P>; } & (IsAny<RorO> extends true ? { ...; } : RorO extends TypedResponse<...> ? { ...; } : { ...; }))[KeyType]; }; }; }[KeyType]; } import ToSchema

'get', '/posts', { in: {          

(property) in: { header: { auth: string; }; } & { query: { page: string; }; } & { json: { id: number; }; }

header: {          

(property) header: { auth: string; }

auth: string          

(property) auth: string

} } & { query: {          

(property) query: { page: string; }

page: string          

(property) page: string

} } & { json: {          

(property) json: { id: number; }

id: number          

(property) id: number

} } }, TypedResponse<{          

(alias) type TypedResponse<T = unknown, U extends StatusCode = StatusCode, F extends ResponseFormat = T extends string ? "text" : T extends JSONValue ? "json" : string> = { _data: T; _status: U; _format: F; } import TypedResponse

auth: string          

(property) auth: string

page: string          

(property) page: string

foo: string          

(property) foo: string

id: number          

(property) id: number

}> >, '/' > it('Should return correct types', () => { expectTypeOf(routes).toEqualTypeOf

const routes: Hono<Env, { "/posts": { $get: { input: { header: { auth: string; }; } & { query: { page: string | string[]; }; } & { json: { id: number; }; }; output: { auth: string; page: string; foo: string; id: number; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

<Expected>()          

type Expected = Hono<Env, { "/posts": { $get: { input: { header: { auth: string; }; } & { query: { page: string; }; } & { json: { id: number; }; }; output: { ...; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

}) }) }) describe('createApp', () => { type Env = {

type Env = { Variables: { foo: string; }; }

Variables: {

(property) Variables: { foo: string; }

foo: string } }          

(property) foo: string

const factory =

const factory: Factory<Env, any>

createFactory

(alias) createFactory<Env, any>(init?: { initApp?: InitApp<Env> | undefined; } | undefined): Factory<Env, any> import createFactory

<Env>({          

type Env = { Variables: { foo: string; }; }

initApp:

(property) initApp?: InitApp<Env> | undefined

(app) => {          

(parameter) app: Hono<Env, BlankSchema, "/">

app

(parameter) app: Hono<Env, BlankSchema, "/">

.use(

(property) Hono<Env, BlankSchema, "/">.use: MiddlewareHandlerInterface <Env>(...handlers: MiddlewareHandler<Env, never, {}>[]) => Hono<Env, BlankSchema, "/"> (+20 overloads)

(c,

(parameter) c: Context<Env, never, {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<Env, never, {}>

.set('foo', 'bar')          

(property) Context<Env, never, {}>.set: Set <"foo">(key: "foo", value: string) => void (+1 overload)

return next()          

(parameter) next: () => Promise<void>

}) }, }) const app =

const app: Hono<Env, BlankSchema, "/">

factory

const factory: Factory<Env, any>

.createApp()          

(property) Factory<Env, any>.createApp: () => Hono<Env, BlankSchema, "/">

it('Should set the correct type and initialize the app', async () => { app

const app: Hono<Env, BlankSchema, "/">

.get('/',

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<string, StatusCode, "text">, BlankInput, Env>(path: "/", handler: H<Env, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<Env, "/", BlankInput>

expectTypeOf(c

(parameter) c: Context<Env, "/", BlankInput>

.var

(property) Context<Env, "/", BlankInput>.var: Readonly<ContextVariableMap & { foo: string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.foo).toEqualTypeOf()          

(property) foo: string

return c

(parameter) c: Context<Env, "/", BlankInput>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<Env, "/", BlankInput>

.var

(property) Context<Env, "/", BlankInput>.var: Readonly<ContextVariableMap & { foo: string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.foo)          

(property) foo: string

}) const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('/')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('bar')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('Lint rules', () => { it('Should not throw a eslint `unbound-method` error if destructed', () => { const { createApp,

const createApp: () => Hono<any, BlankSchema, "/">

createHandlers,

const createHandlers: CreateHandlersInterface<any, any>

createMiddleware } =

const createMiddleware: <I extends Input = {}>(middleware: MiddlewareHandler<any, any, I>) => MiddlewareHandler<any, any, I>

createFactory()          

(alias) createFactory<any, any>(init?: { initApp?: InitApp<any> | undefined; } | undefined): Factory<any, any> import createFactory

expect(createApp).toBeDefined()          

const createApp: () => Hono<any, BlankSchema, "/">

expect(createHandlers).toBeDefined()          

const createHandlers: CreateHandlersInterface<any, any>

expect(createMiddleware).toBeDefined()          

const createMiddleware: <I extends Input = {}>(middleware: MiddlewareHandler<any, any, I>) => MiddlewareHandler<any, any, I>

}) })
src/helper/factory/index.ts
            
                /**
                 * @module
                 * Factory Helper for Hono.
                 */
                
                /* eslint-disable @typescript-eslint/no-explicit-any */
                import { Hono } from '../../hono'
                import type { Env, H, HandlerResponse, Input, MiddlewareHandler } from '../../types'
                
                type InitApp

type InitApp<E extends Env = Env> = (app: Hono<E>) => void

<E extends

(type parameter) E in type InitApp<E extends Env = Env>

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env> =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

(app:

(parameter) app: Hono<E, BlankSchema, "/">

Hono

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

<E>) => void          

(type parameter) E in type InitApp<E extends Env = Env>

export interface CreateHandlersInterface

interface CreateHandlersInterface<E extends Env, P extends string>

<E extends

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

Env,

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

P extends string> {          

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

<I extends

(type parameter) I in <I extends Input = {}, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>): [H<E, P, I, R>]

Input = {},

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

R extends

(type parameter) R in <I extends Input = {}, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>): [H<E, P, I, R>]

HandlerResponse = any>

(alias) type HandlerResponse<O> = Response | TypedResponse<O, StatusCode, O extends string ? "text" : O extends JSONValue ? "json" : string> | Promise<...> import HandlerResponse

(handler1:

(parameter) handler1: H<E, P, I, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>): [H<E, P, I, R>]

R>): [          

(type parameter) R in <I extends Input = {}, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>): [H<E, P, I, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>): [H<E, P, I, R>]

R>          

(type parameter) R in <I extends Input = {}, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>): [H<E, P, I, R>]

] // handler x2 <I extends

(type parameter) I in <I extends Input = {}, I2 extends Input = I, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>): [H<E, P, I, R>, H<E, P, I2, R>]

Input = {},

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I2 extends

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>): [H<E, P, I, R>, H<E, P, I2, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>): [H<E, P, I, R>, H<E, P, I2, R>]

R extends

(type parameter) R in <I extends Input = {}, I2 extends Input = I, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>): [H<E, P, I, R>, H<E, P, I2, R>]

HandlerResponse = any>(          

(alias) type HandlerResponse<O> = Response | TypedResponse<O, StatusCode, O extends string ? "text" : O extends JSONValue ? "json" : string> | Promise<...> import HandlerResponse

handler1:

(parameter) handler1: H<E, P, I, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>): [H<E, P, I, R>, H<E, P, I2, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>): [H<E, P, I, R>, H<E, P, I2, R>]

handler2:

(parameter) handler2: H<E, P, I2, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>): [H<E, P, I, R>, H<E, P, I2, R>]

R>          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>): [H<E, P, I, R>, H<E, P, I2, R>]

): [H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>): [H<E, P, I, R>, H<E, P, I2, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>): [H<E, P, I, R>, H<E, P, I2, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>): [H<E, P, I, R>, H<E, P, I2, R>]

R>]          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>): [H<E, P, I, R>, H<E, P, I2, R>]

// handler x3 < I extends

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

Input = {},          

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I2 extends

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I,          

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

I3 extends

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

I2,          

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

R extends

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

HandlerResponse = any          

(alias) type HandlerResponse<O> = Response | TypedResponse<O, StatusCode, O extends string ? "text" : O extends JSONValue ? "json" : string> | Promise<...> import HandlerResponse

>( handler1:

(parameter) handler1: H<E, P, I, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

handler2:

(parameter) handler2: H<E, P, I2, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

handler3:

(parameter) handler3: H<E, P, I3, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

R>          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

): [H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

R>]          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>]

// handler x4 < I extends

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

Input = {},          

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I2 extends

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I,          

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

I3 extends

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

I2,          

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

I4 extends

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

I3,          

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

R extends

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

HandlerResponse = any          

(alias) type HandlerResponse<O> = Response | TypedResponse<O, StatusCode, O extends string ? "text" : O extends JSONValue ? "json" : string> | Promise<...> import HandlerResponse

>( handler1:

(parameter) handler1: H<E, P, I, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

handler2:

(parameter) handler2: H<E, P, I2, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

handler3:

(parameter) handler3: H<E, P, I3, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

handler4:

(parameter) handler4: H<E, P, I4, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I4,

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

R>          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

): [H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I4,

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

R>]          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>]

// handler x5 < I extends

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

Input = {},          

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I2 extends

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I,          

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

I3 extends

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

I2,          

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

I4 extends

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

I3,          

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

I5 extends

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

I4,          

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

R extends

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

HandlerResponse = any          

(alias) type HandlerResponse<O> = Response | TypedResponse<O, StatusCode, O extends string ? "text" : O extends JSONValue ? "json" : string> | Promise<...> import HandlerResponse

>( handler1:

(parameter) handler1: H<E, P, I, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

handler2:

(parameter) handler2: H<E, P, I2, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

handler3:

(parameter) handler3: H<E, P, I3, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

handler4:

(parameter) handler4: H<E, P, I4, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I4,

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

handler5:

(parameter) handler5: H<E, P, I5, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I5,

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

R>          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

): [H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I4,

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I5,

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

R>]          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>]

// handler x6 < I extends

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

Input = {},          

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I2 extends

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I,          

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

I3 extends

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

I2,          

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

I4 extends

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

I3,          

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

I5 extends

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

I4,          

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

I6 extends

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

I5,          

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

R extends

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

HandlerResponse = any          

(alias) type HandlerResponse<O> = Response | TypedResponse<O, StatusCode, O extends string ? "text" : O extends JSONValue ? "json" : string> | Promise<...> import HandlerResponse

>( handler1:

(parameter) handler1: H<E, P, I, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

handler2:

(parameter) handler2: H<E, P, I2, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

handler3:

(parameter) handler3: H<E, P, I3, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

handler4:

(parameter) handler4: H<E, P, I4, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I4,

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

handler5:

(parameter) handler5: H<E, P, I5, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I5,

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

handler6:

(parameter) handler6: H<E, P, I6, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I6,

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

R>          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

): [H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I4,

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I5,

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

R>,

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I6,

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

R>]          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>]

// handler x7 < I extends

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

Input = {},          

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I2 extends

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I,          

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I3 extends

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I2,          

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I4 extends

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I3,          

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I5 extends

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I4,          

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I6 extends

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I5,          

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I7 extends

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I5 &

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

I6,          

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R extends

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

HandlerResponse = any          

(alias) type HandlerResponse<O> = Response | TypedResponse<O, StatusCode, O extends string ? "text" : O extends JSONValue ? "json" : string> | Promise<...> import HandlerResponse

>( handler1:

(parameter) handler1: H<E, P, I, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

handler2:

(parameter) handler2: H<E, P, I2, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

handler3:

(parameter) handler3: H<E, P, I3, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

handler4:

(parameter) handler4: H<E, P, I4, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I4,

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

handler5:

(parameter) handler5: H<E, P, I5, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I5,

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

handler6:

(parameter) handler6: H<E, P, I6, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I6,

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

handler7:

(parameter) handler7: H<E, P, I7, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I7,

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R>          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

): [ H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I4,

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I5,

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I6,

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I7,

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

R>          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>]

] // handler x8 < I extends

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

Input = {},          

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I2 extends

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I,          

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I3 extends

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I2,          

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I4 extends

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I3,          

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I5 extends

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I4,          

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I6 extends

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I5,          

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I7 extends

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I5 &

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I6,          

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I8 extends

(type parameter) I8 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I5 &

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I6 &

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

I7,          

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R extends

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

HandlerResponse = any          

(alias) type HandlerResponse<O> = Response | TypedResponse<O, StatusCode, O extends string ? "text" : O extends JSONValue ? "json" : string> | Promise<...> import HandlerResponse

>( handler1:

(parameter) handler1: H<E, P, I, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

handler2:

(parameter) handler2: H<E, P, I2, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

handler3:

(parameter) handler3: H<E, P, I3, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

handler4:

(parameter) handler4: H<E, P, I4, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I4,

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

handler5:

(parameter) handler5: H<E, P, I5, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I5,

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

handler6:

(parameter) handler6: H<E, P, I6, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I6,

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

handler7:

(parameter) handler7: H<E, P, I7, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I7,

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

handler8:

(parameter) handler8: H<E, P, I8, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I8,

(type parameter) I8 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

): [ H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I4,

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I5,

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I6,

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I7,

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I8,

(type parameter) I8 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

R>          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>]

] // handler x9 < I extends

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

Input = {},          

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I2 extends

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I,          

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I3 extends

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I2,          

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I4 extends

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I3,          

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I5 extends

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I4,          

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I6 extends

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I5,          

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I7 extends

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I5 &

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I6,          

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I8 extends

(type parameter) I8 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I5 &

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I6 &

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I7,          

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I9 extends

(type parameter) I9 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I5 &

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I6 &

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I7 &

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

I8,          

(type parameter) I8 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R extends

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

HandlerResponse = any          

(alias) type HandlerResponse<O> = Response | TypedResponse<O, StatusCode, O extends string ? "text" : O extends JSONValue ? "json" : string> | Promise<...> import HandlerResponse

>( handler1:

(parameter) handler1: H<E, P, I, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

handler2:

(parameter) handler2: H<E, P, I2, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

handler3:

(parameter) handler3: H<E, P, I3, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

handler4:

(parameter) handler4: H<E, P, I4, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I4,

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

handler5:

(parameter) handler5: H<E, P, I5, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I5,

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

handler6:

(parameter) handler6: H<E, P, I6, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I6,

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

handler7:

(parameter) handler7: H<E, P, I7, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I7,

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

handler8:

(parameter) handler8: H<E, P, I8, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I8,

(type parameter) I8 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

handler9:

(parameter) handler9: H<E, P, I9, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I9,

(type parameter) I9 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

): [ H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I4,

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I5,

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I6,

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I7,

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I8,

(type parameter) I8 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I9,

(type parameter) I9 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

R>          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>]

] // handler x10 < I extends

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

Input = {},          

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I2 extends

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I,          

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I3 extends

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I2,          

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I4 extends

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I3,          

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I5 extends

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I4,          

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I6 extends

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I5,          

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I7 extends

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I5 &

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I6,          

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I8 extends

(type parameter) I8 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I5 &

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I6 &

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I7,          

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I9 extends

(type parameter) I9 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I5 &

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I6 &

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I7 &

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I8,          

(type parameter) I8 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I10 extends

(type parameter) I10 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

Input =

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

I &

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I2 &

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I3 &

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I4 &

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I5 &

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I6 &

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I7 &

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I8 &

(type parameter) I8 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

I9,          

(type parameter) I9 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R extends

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

HandlerResponse = any          

(alias) type HandlerResponse<O> = Response | TypedResponse<O, StatusCode, O extends string ? "text" : O extends JSONValue ? "json" : string> | Promise<...> import HandlerResponse

>( handler1:

(parameter) handler1: H<E, P, I, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

handler2:

(parameter) handler2: H<E, P, I2, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

handler3:

(parameter) handler3: H<E, P, I3, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

handler4:

(parameter) handler4: H<E, P, I4, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I4,

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

handler5:

(parameter) handler5: H<E, P, I5, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I5,

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

handler6:

(parameter) handler6: H<E, P, I6, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I6,

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

handler7:

(parameter) handler7: H<E, P, I7, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I7,

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

handler8:

(parameter) handler8: H<E, P, I8, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I8,

(type parameter) I8 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

handler9:

(parameter) handler9: H<E, P, I9, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I9,

(type parameter) I9 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

handler10:

(parameter) handler10: H<E, P, I10, R>

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I10,

(type parameter) I10 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

): [ H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I,

(type parameter) I in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I2,

(type parameter) I2 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I3,

(type parameter) I3 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I4,

(type parameter) I4 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I5,

(type parameter) I5 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I6,

(type parameter) I6 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I7,

(type parameter) I7 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I8,

(type parameter) I8 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I9,

(type parameter) I9 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>,          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

H

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

<E,

(type parameter) E in CreateHandlersInterface<E extends Env, P extends string>

P,

(type parameter) P in CreateHandlersInterface<E extends Env, P extends string>

I10,

(type parameter) I10 in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

R>          

(type parameter) R in <I extends Input = {}, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & ... 4 more ... & I6, I8 extends Input = I & ... 5 more ... & I7, I9 extends Input = I & ... 6 more ... & I8, I10 extends Input = I & ... 7 more ... & I9, R extends HandlerResponse<any> = any>(handler1: H<E, P, I, R>, handler2: H<E, P, I2, R>, handler3: H<E, P, I3, R>, handler4: H<E, P, I4, R>, handler5: H<E, P, I5, R>, handler6: H<E, P, I6, R>, handler7: H<E, P, I7, R>, handler8: H<E, P, I8, R>, handler9: H<E, P, I9, R>, handler10: H<E, P, I10, R>): [H<E, P, I, R>, H<E, P, I2, R>, H<E, P, I3, R>, H<E, P, I4, R>, H<E, P, I5, R>, H<E, P, I6, R>, H<E, P, I7, R>, H<E, P, I8, R>, H<E, P, I9, R>, H<E, P, I10, R>]

] } export class Factory

class Factory<E extends Env = any, P extends string = any>

<E extends

(type parameter) E in Factory<E extends Env = any, P extends string = any>

Env = any,

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

P extends string = any> {          

(type parameter) P in Factory<E extends Env = any, P extends string = any>

private initApp?:

(property) Factory<E extends Env = any, P extends string = any>.initApp?: InitApp<E> | undefined

InitApp

type InitApp<E extends Env = Env> = (app: Hono<E>) => void

<E>          

(type parameter) E in Factory<E extends Env = any, P extends string = any>

constructor(init?: {

(parameter) init: { initApp?: InitApp<E>; } | undefined

initApp?:

(property) initApp?: InitApp<E> | undefined

InitApp

type InitApp<E extends Env = Env> = (app: Hono<E>) => void

<E> }) {          

(type parameter) E in Factory<E extends Env = any, P extends string = any>

this.initApp =

(property) Factory<E extends Env = any, P extends string = any>.initApp?: InitApp<E> | undefined

init?

(parameter) init: { initApp?: InitApp<E>; } | undefined

.initApp          

(property) initApp?: InitApp<E> | undefined

} createApp = ():

(property) Factory<E extends Env = any, P extends string = any>.createApp: () => Hono<E>

Hono

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

<E> => {          

(type parameter) E in Factory<E extends Env = any, P extends string = any>

const app = new

const app: Hono<E, BlankSchema, "/">

Hono

(alias) new Hono<E, BlankSchema, "/">(options?: HonoOptions<E>): Hono<E, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

<E>()          

(type parameter) E in Factory<E extends Env = any, P extends string = any>

if (this.initApp) {          

(property) Factory<E extends Env = any, P extends string = any>.initApp?: InitApp<E> | undefined

this.initApp

(property) Factory<E extends Env = any, P extends string = any>.initApp?: (app: Hono<E, BlankSchema, "/">) => void

(app)          

const app: Hono<E, BlankSchema, "/">

} return app          

const app: Hono<E, BlankSchema, "/">

} createMiddleware =

(property) Factory<E extends Env = any, P extends string = any>.createMiddleware: <I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>) => MiddlewareHandler<E, P, I>

<I extends

(type parameter) I in <I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>): MiddlewareHandler<E, P, I>

Input = {}>

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

(middleware:

(parameter) middleware: MiddlewareHandler<E, P, I>

MiddlewareHandler

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

<E,

(type parameter) E in Factory<E extends Env = any, P extends string = any>

P,

(type parameter) P in Factory<E extends Env = any, P extends string = any>

I>) =>

(type parameter) I in <I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>): MiddlewareHandler<E, P, I>

middleware          

(parameter) middleware: MiddlewareHandler<E, P, I>

createHandlers:

(property) Factory<E extends Env = any, P extends string = any>.createHandlers: CreateHandlersInterface<E, P>

CreateHandlersInterface

interface CreateHandlersInterface<E extends Env, P extends string>

<E,

(type parameter) E in Factory<E extends Env = any, P extends string = any>

P> = (..

(type parameter) P in Factory<E extends Env = any, P extends string = any>

.handlers: any) => {          

(parameter) handlers: any

// @ts-expect-error this should not be typed return handlers.filter(

(parameter) handlers: any

(handler) =>

(parameter) handler: any

handler !== undefined)          

(parameter) handler: any

} } export const createFactory =

const createFactory: <E extends Env = any, P extends string = any>(init?: { initApp?: InitApp<E>; }) => Factory<E, P>

<E extends

(type parameter) E in <E extends Env = any, P extends string = any>(init?: { initApp?: InitApp<E>; }): Factory<E, P>

Env = any,

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

P extends string = any>

(type parameter) P in <E extends Env = any, P extends string = any>(init?: { initApp?: InitApp<E>; }): Factory<E, P>

(init?: {          

(parameter) init: { initApp?: InitApp<E>; } | undefined

initApp?:

(property) initApp?: InitApp<E> | undefined

InitApp

type InitApp<E extends Env = Env> = (app: Hono<E>) => void

<E>          

(type parameter) E in <E extends Env = any, P extends string = any>(init?: { initApp?: InitApp<E>; }): Factory<E, P>

}): Factory

class Factory<E extends Env = any, P extends string = any>

<E,

(type parameter) E in <E extends Env = any, P extends string = any>(init?: { initApp?: InitApp<E>; }): Factory<E, P>

P> => new

(type parameter) P in <E extends Env = any, P extends string = any>(init?: { initApp?: InitApp<E>; }): Factory<E, P>

Factory

constructor Factory<E, P>(init?: { initApp?: InitApp<E> | undefined; } | undefined): Factory<E, P>

<E,

(type parameter) E in <E extends Env = any, P extends string = any>(init?: { initApp?: InitApp<E>; }): Factory<E, P>

P>

(type parameter) P in <E extends Env = any, P extends string = any>(init?: { initApp?: InitApp<E>; }): Factory<E, P>

(init)          

(parameter) init: { initApp?: InitApp<E>; } | undefined

export const createMiddleware = <          

const createMiddleware: <E extends Env = any, P extends string = string, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>) => MiddlewareHandler<E, P, I>

E extends

(type parameter) E in <E extends Env = any, P extends string = string, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>): MiddlewareHandler<E, P, I>

Env = any,          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

P extends string = string,          

(type parameter) P in <E extends Env = any, P extends string = string, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>): MiddlewareHandler<E, P, I>

I extends

(type parameter) I in <E extends Env = any, P extends string = string, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>): MiddlewareHandler<E, P, I>

Input = {}          

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } import Input

>( middleware:

(parameter) middleware: MiddlewareHandler<E, P, I>

MiddlewareHandler

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

<E,

(type parameter) E in <E extends Env = any, P extends string = string, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>): MiddlewareHandler<E, P, I>

P,

(type parameter) P in <E extends Env = any, P extends string = string, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>): MiddlewareHandler<E, P, I>

I>          

(type parameter) I in <E extends Env = any, P extends string = string, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>): MiddlewareHandler<E, P, I>

): MiddlewareHandler

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

<E,

(type parameter) E in <E extends Env = any, P extends string = string, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>): MiddlewareHandler<E, P, I>

P,

(type parameter) P in <E extends Env = any, P extends string = string, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>): MiddlewareHandler<E, P, I>

I> =>

(type parameter) I in <E extends Env = any, P extends string = string, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>): MiddlewareHandler<E, P, I>

createFactory

const createFactory: <E, P>(init?: { initApp?: InitApp<E> | undefined; } | undefined) => Factory<E, P>

<E,

(type parameter) E in <E extends Env = any, P extends string = string, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>): MiddlewareHandler<E, P, I>

P>()

(type parameter) P in <E extends Env = any, P extends string = string, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>): MiddlewareHandler<E, P, I>

.createMiddleware

(property) Factory<E, P>.createMiddleware: <I>(middleware: MiddlewareHandler<E, P, I>) => MiddlewareHandler<E, P, I>

<I>

(type parameter) I in <E extends Env = any, P extends string = string, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>): MiddlewareHandler<E, P, I>

(middleware)          

(parameter) middleware: MiddlewareHandler<E, P, I>

src/helper/html/index.test.ts
            
                import { HtmlEscapedCallbackPhase, resolveCallback } from '../../utils/html'
                import { html, raw } from '.'
                
                describe('Tagged Template Literals', () => {
                  it('Should escape special characters', () => {
                    const name = 'John "Johnny" Smith'          

const name: "John \"Johnny\" Smith"

// eslint-disable-next-line quotes expect(html`

I'm $

(alias) const html: (strings: TemplateStringsArray, ...values: unknown[]) => HtmlEscapedString | Promise<HtmlEscapedString> import html

{name}.

`

const name: "John \"Johnny\" Smith"

.toString()).toBe("

I'm John "Johnny" Smith.

")          

(method) toString(): string Returns a string representation of an object.

}) describe('Booleans, Null, and Undefined Are Ignored', () => { it.each([true, false, undefined, null])('%s', (item) => {          

(parameter) item: any

expect(html`$

(alias) const html: (strings: TemplateStringsArray, ...values: unknown[]) => HtmlEscapedString | Promise<HtmlEscapedString> import html

{item}`

(parameter) item: any

.toString()).toBe('')          

(method) toString(): string Returns a string representation of an object.

}) it('falsy value', () => { expect(html`${0}`

(alias) const html: (strings: TemplateStringsArray, ...values: unknown[]) => HtmlEscapedString | Promise<HtmlEscapedString> import html

.toString()).toBe('0')          

(method) toString(): string Returns a string representation of an object.

}) }) it('Should call $array.flat(Infinity)', () => { const values = [          

const values: (string | (string | null | undefined)[] | (HtmlEscapedString | Promise<HtmlEscapedString>)[])[]

'Name:', ['John "Johnny" Smith', undefined, null], ' Contact:', [html`My Website`],          

(alias) const html: (strings: TemplateStringsArray, ...values: unknown[]) => HtmlEscapedString | Promise<HtmlEscapedString> import html

] expect(html`

$

(alias) const html: (strings: TemplateStringsArray, ...values: unknown[]) => HtmlEscapedString | Promise<HtmlEscapedString> import html

{values}

`

const values: (string | (string | null | undefined)[] | (HtmlEscapedString | Promise<HtmlEscapedString>)[])[]

.toString()).toBe(          

(method) toString(): string Returns a string representation of an object.

'

Name:John "Johnny" Smith Contact:My Website

'
) }) describe('Promise', () => { it('Should return Promise when some variables contains Promise in variables', async () => { const name =

const name: Promise<string>

Promise

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

.resolve('John "Johnny" Smith')          

(method) PromiseConstructor.resolve<string>(value: string): Promise<string> (+2 overloads) Creates a new resolved promise for the provided value.

@param value — A promise.

@returns — A promise whose internal state matches the provided promise.

const res =

const res: HtmlEscapedString | Promise<HtmlEscapedString>

html`

I'm $

(alias) const html: (strings: TemplateStringsArray, ...values: unknown[]) => HtmlEscapedString | Promise<HtmlEscapedString> import html

{name}.

`          

const name: Promise<string>

expect(res).toBeInstanceOf

const res: HtmlEscapedString | Promise<HtmlEscapedString>

(Promise)          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

// eslint-disable-next-line quotes expect((await res)

const res: HtmlEscapedString | Promise<HtmlEscapedString>

.toString()).toBe("

I'm John "Johnny" Smith.

")          

(method) String.toString(): string Returns a string representation of a string.

}) it('Should return raw value when some variables contains Promise in variables', async () => { const name =

const name: Promise<HtmlEscapedString>

Promise

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

.resolve

(method) PromiseConstructor.resolve<HtmlEscapedString>(value: HtmlEscapedString): Promise<HtmlEscapedString> (+2 overloads) Creates a new resolved promise for the provided value.

@param value — A promise.

@returns — A promise whose internal state matches the provided promise.

(raw('John "Johnny" Smith'))          

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

const res =

const res: HtmlEscapedString | Promise<HtmlEscapedString>

html`

I'm $

(alias) const html: (strings: TemplateStringsArray, ...values: unknown[]) => HtmlEscapedString | Promise<HtmlEscapedString> import html

{name}.

`          

const name: Promise<HtmlEscapedString>

expect(res).toBeInstanceOf

const res: HtmlEscapedString | Promise<HtmlEscapedString>

(Promise)          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

expect((await res)

const res: HtmlEscapedString | Promise<HtmlEscapedString>

.toString()).toBe('

I\'m John "Johnny" Smith.

')          

(method) String.toString(): string Returns a string representation of a string.

}) }) describe('HtmlEscapedString', () => { it('Should preserve callbacks', async () => { const name =

const name: HtmlEscapedString

raw('Hono', [          

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

({ buffer }) => {          

(parameter) buffer: [string] | undefined

if (buffer) {          

(parameter) buffer: [string] | undefined

buffer[0] =

(parameter) buffer: [string]

buffer[0]

(parameter) buffer: [string]

.replace('Hono', 'Hono!')          

(method) String.replace(searchValue: string | RegExp, replaceValue: string): string (+3 overloads) Replaces text in a string, using a regular expression or search string.

@param searchValue — A string or regular expression to search for.

@param replaceValue — A string containing the text to replace. When the searchValue is a RegExp, all matches are replaced if the g flag is set (or only those matches at the beginning, if the y flag is also present). Otherwise, only the first match of searchValue is replaced.

} return undefined }, ]) const res =

const res: HtmlEscapedString | Promise<HtmlEscapedString>

html`

I'm $

(alias) const html: (strings: TemplateStringsArray, ...values: unknown[]) => HtmlEscapedString | Promise<HtmlEscapedString> import html

{name}.

`          

const name: HtmlEscapedString

expect(res).toBeInstanceOf

const res: HtmlEscapedString | Promise<HtmlEscapedString>

(Promise)          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

// eslint-disable-next-line quotes expect((await res)

const res: HtmlEscapedString | Promise<HtmlEscapedString>

.toString()).toBe("

I'm Hono.

")          

(method) String.toString(): string Returns a string representation of a string.

expect(await resolveCallback(await

(alias) resolveCallback(str: string | HtmlEscapedString | Promise<string>, phase: (typeof HtmlEscapedCallbackPhase)[keyof typeof HtmlEscapedCallbackPhase], preserveCallbacks: boolean, context: object, buffer?: [string]): Promise<string> import resolveCallback

res,

const res: HtmlEscapedString | Promise<HtmlEscapedString>

HtmlEscapedCallbackPhase

(alias) const HtmlEscapedCallbackPhase: { readonly Stringify: 1; readonly BeforeStream: 2; readonly Stream: 3; } import HtmlEscapedCallbackPhase

@module — HTML utility.

.Stringify, false, {})).toBe(          

(property) Stringify: 1

// eslint-disable-next-line quotes "

I'm Hono!.

"
) }) }) }) describe('raw', () => { it('Should be marked as escaped.', () => { const name = 'John "Johnny" Smith'          

const name: "John &quot;Johnny&quot; Smith"

expect(html`

I'm $

(alias) const html: (strings: TemplateStringsArray, ...values: unknown[]) => HtmlEscapedString | Promise<HtmlEscapedString> import html

{raw

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

(name)}.

`

const name: "John &quot;Johnny&quot; Smith"

.toString()).toBe(          

(method) toString(): string Returns a string representation of an object.

// eslint-disable-next-line quotes "

I'm John "Johnny" Smith.

"
) }) })
src/helper/html/index.ts
            
                /**
                 * @module
                 * html Helper for Hono.
                 */
                
                import { escapeToBuffer, raw, resolveCallbackSync, stringBufferToString } from '../../utils/html'
                import type { HtmlEscaped, HtmlEscapedString, StringBufferWithCallbacks } from '../../utils/html'
                
                export { raw }          

(alias) const raw: (value: unknown, callbacks?: HtmlEscapedCallback[]) => HtmlEscapedString export raw

export const html = (          

const html: (strings: TemplateStringsArray, ...values: unknown[]) => HtmlEscapedString | Promise<HtmlEscapedString>

strings:

(parameter) strings: TemplateStringsArray

TemplateStringsArray,          

interface TemplateStringsArray

...values: unknown[]          

(parameter) values: unknown[]

): HtmlEscapedString |

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<HtmlEscapedString> => {          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

const buffer:

const buffer: StringBufferWithCallbacks

StringBufferWithCallbacks = [''] as

(alias) type StringBufferWithCallbacks = StringBuffer & { callbacks: HtmlEscapedCallback[]; } import StringBufferWithCallbacks

StringBufferWithCallbacks          

(alias) type StringBufferWithCallbacks = StringBuffer & { callbacks: HtmlEscapedCallback[]; } import StringBufferWithCallbacks

for (let i = 0,

let i: number

len =

let len: number

strings

(parameter) strings: TemplateStringsArray

.length - 1;

(property) ReadonlyArray<string>.length: number Gets the length of the array. This is a number one higher than the highest element defined in an array.

i <

let i: number

len;

let len: number

i++) {          

let i: number

buffer[0] +=

const buffer: StringBufferWithCallbacks

strings

(parameter) strings: TemplateStringsArray

[i]          

let i: number

const children =          

const children: unknown[]

values

(parameter) values: unknown[]

[i] instanceof

let i: number

Array ?

var Array: ArrayConstructor

(values

(parameter) values: unknown[]

[i] as

let i: number

Array)

interface Array<T>

.flat(Infinity) :

(method) Array<unknown>.flat<unknown[], number>(this: unknown[], depth?: number | undefined): unknown[] Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

@param depth — The maximum recursion depth

[values

(parameter) values: unknown[]

[i]]          

let i: number

for (let i = 0,

let i: number

len =

let len: number

children

const children: unknown[]

.length;

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

i <

let i: number

len;

let len: number

i++) {          

let i: number

// eslint-disable-next-line @typescript-eslint/no-explicit-any const child =

const child: any

children

const children: unknown[]

[i] as any          

let i: number

if (typeof child === 'string') {          

const child: any

escapeToBuffer

(alias) escapeToBuffer(str: string, buffer: StringBuffer): void import escapeToBuffer

(child,

const child: string

buffer)          

const buffer: StringBufferWithCallbacks

} else if (typeof child === 'number') {          

const child: any

;(buffer[0] as string) +=

const buffer: StringBufferWithCallbacks

child          

const child: number

} else if (typeof child === 'boolean' ||

const child: any

child === null ||

const child: any

child === undefined) {          

const child: any

continue } else if (typeof child === 'object' &&

const child: any

(child as

const child: any

HtmlEscaped)

(alias) type HtmlEscaped = { isEscaped: true; callbacks?: HtmlEscapedCallback[]; } import HtmlEscaped

.isEscaped) {          

(property) isEscaped: true

if ((child as

const child: any

HtmlEscapedString)

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

.callbacks) {          

(property) callbacks?: HtmlEscapedCallback[] | undefined

buffer

const buffer: StringBufferWithCallbacks

.unshift('',

(method) Array<string | Promise<string>>.unshift(...items: (string | Promise<string>)[]): number Inserts new elements at the start of an array, and returns the new length of the array.

@param items — Elements to insert at the start of the array.

child)          

const child: any

} else { const tmp =

const tmp: any

child.toString()          

const child: any

if (tmp instanceof

const tmp: any

Promise) {          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

buffer

const buffer: StringBufferWithCallbacks

.unshift('',

(method) Array<string | Promise<string>>.unshift(...items: (string | Promise<string>)[]): number Inserts new elements at the start of an array, and returns the new length of the array.

@param items — Elements to insert at the start of the array.

tmp)          

const tmp: Promise<any>

} else { buffer[0] +=

const buffer: StringBufferWithCallbacks

tmp          

const tmp: any

} } } else if (child instanceof

const child: any

Promise) {          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

buffer

const buffer: StringBufferWithCallbacks

.unshift('',

(method) Array<string | Promise<string>>.unshift(...items: (string | Promise<string>)[]): number Inserts new elements at the start of an array, and returns the new length of the array.

@param items — Elements to insert at the start of the array.

child)          

const child: Promise<any>

} else { escapeToBuffer

(alias) escapeToBuffer(str: string, buffer: StringBuffer): void import escapeToBuffer

(child.toString(),

const child: any

buffer)          

const buffer: StringBufferWithCallbacks

} } } buffer[0] +=

const buffer: StringBufferWithCallbacks

strings

(parameter) strings: TemplateStringsArray

[strings

(parameter) strings: TemplateStringsArray

.length - 1]          

(property) ReadonlyArray<string>.length: number Gets the length of the array. This is a number one higher than the highest element defined in an array.

return buffer

const buffer: StringBufferWithCallbacks

.length === 1          

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

? 'callbacks' in buffer          

const buffer: StringBufferWithCallbacks

? raw

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

(resolveCallbackSync

(alias) resolveCallbackSync(str: string | HtmlEscapedString): string import resolveCallbackSync

(raw

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

(buffer[0],

const buffer: StringBufferWithCallbacks

buffer

const buffer: StringBufferWithCallbacks

.callbacks)))          

(property) callbacks: HtmlEscapedCallback[]

: raw

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

(buffer[0])          

const buffer: never

: stringBufferToString

(alias) stringBufferToString(buffer: StringBuffer, callbacks: HtmlEscapedCallback[] | undefined): Promise<HtmlEscapedString> import stringBufferToString

(buffer,

const buffer: StringBufferWithCallbacks

buffer

const buffer: StringBufferWithCallbacks

.callbacks)          

(property) callbacks: HtmlEscapedCallback[]

}
src/helper/ssg/index.ts
            
                /**
                 * @module
                 * SSG Helper for Hono.
                 */
                
                export * from './ssg'
                export {
                  X_HONO_DISABLE_SSG_HEADER_KEY,          

(alias) const X_HONO_DISABLE_SSG_HEADER_KEY: "x-hono-disable-ssg" export X_HONO_DISABLE_SSG_HEADER_KEY

ssgParams,          

(alias) const ssgParams: SSGParamsMiddleware export ssgParams Define SSG Route

isSSGContext,          

(alias) const isSSGContext: (c: Context) => boolean export isSSGContext

@experimental
isSSGContext is an experimental feature. The API might be changed.

disableSSG,          

(alias) const disableSSG: () => MiddlewareHandler export disableSSG

@experimental
disableSSG is an experimental feature. The API might be changed.

onlySSG,          

(alias) const onlySSG: () => MiddlewareHandler export onlySSG

@experimental
onlySSG is an experimental feature. The API might be changed.

} from './middleware'
src/helper/ssg/middleware.ts
            
                import type { Context } from '../../context'
                import type { Env, MiddlewareHandler } from '../../types'
                
                export const SSG_CONTEXT = 'HONO_SSG_CONTEXT'          

const SSG_CONTEXT: "HONO_SSG_CONTEXT"

export const X_HONO_DISABLE_SSG_HEADER_KEY = 'x-hono-disable-ssg'          

const X_HONO_DISABLE_SSG_HEADER_KEY: "x-hono-disable-ssg"

/** * @deprecated * Use `X_HONO_DISABLE_SSG_HEADER_KEY` instead. * This constant will be removed in the next minor version. */ export const SSG_DISABLED_RESPONSE = (() => {          

const SSG_DISABLED_RESPONSE: Response

@deprecated
Use X_HONO_DISABLE_SSG_HEADER_KEY instead. This constant will be removed in the next minor version.

try { return new Response('SSG is disabled', {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 404,          

(property) ResponseInit.status?: number | undefined

headers: {

(property) ResponseInit.headers?: HeadersInit | undefined

[X_HONO_DISABLE_SSG_HEADER_KEY]: 'true' },          

const X_HONO_DISABLE_SSG_HEADER_KEY: "x-hono-disable-ssg"

}) } catch { return null } })() as Response          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

interface SSGParam {          

interface SSGParam

[key: string]: string          

(parameter) key: string

} export type SSGParams =

type SSGParams = SSGParam[]

SSGParam[]          

interface SSGParam

interface SSGParamsMiddleware {          

interface SSGParamsMiddleware

<E extends

(type parameter) E in <E extends Env = Env>(generateParams: (c: Context<E>) => SSGParams | Promise<SSGParams>): MiddlewareHandler<E>

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env>(          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

generateParams:

(parameter) generateParams: (c: Context<E>) => SSGParams | Promise<SSGParams>

(c:

(parameter) c: Context<E, any, {}>

Context

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

<E>) =>

(type parameter) E in <E extends Env = Env>(generateParams: (c: Context<E>) => SSGParams | Promise<SSGParams>): MiddlewareHandler<E>

SSGParams |

type SSGParams = SSGParam[]

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<SSGParams>          

type SSGParams = SSGParam[]

): MiddlewareHandler

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

<E>          

(type parameter) E in <E extends Env = Env>(generateParams: (c: Context<E>) => SSGParams | Promise<SSGParams>): MiddlewareHandler<E>

<E extends

(type parameter) E in <E extends Env = Env>(params: SSGParams): MiddlewareHandler<E>

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env>

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

(params:

(parameter) params: SSGParams

SSGParams):

type SSGParams = SSGParam[]

MiddlewareHandler

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

<E>          

(type parameter) E in <E extends Env = Env>(params: SSGParams): MiddlewareHandler<E>

} export type AddedSSGDataRequest =

type AddedSSGDataRequest = Request & { ssgParams?: SSGParams; }

Request & {          

interface Request This Fetch API interface represents a resource request.

MDN Reference

ssgParams?:

(property) ssgParams?: SSGParams | undefined

SSGParams          

type SSGParams = SSGParam[]

} /** * Define SSG Route */ export const ssgParams:

const ssgParams: SSGParamsMiddleware Define SSG Route

SSGParamsMiddleware =

interface SSGParamsMiddleware

(params) => async

(parameter) params: ((c: Context<E>) => SSGParams | Promise<SSGParams>) | SSGParams

(c,

(parameter) c: Context<E, string, {}>

next) => {          

(parameter) next: Next

;(c

(parameter) c: Context<E, string, {}>

.req

(property) Context<E, string, {}>.req: HonoRequest<string, unknown> .req is the instance of HonoRequest.

.raw as

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

AddedSSGDataRequest)

type AddedSSGDataRequest = Request & { ssgParams?: SSGParams; }

.ssgParams =

(property) ssgParams?: SSGParams | undefined

Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(params) ?

(parameter) params: ((c: Context<E>) => SSGParams | Promise<SSGParams>) | SSGParams

params : await

(parameter) params: SSGParams

params

(parameter) params: (c: Context<E>) => SSGParams | Promise<SSGParams>

(c)          

(parameter) c: Context<E, string, {}>

await next()          

(parameter) next: () => Promise<void>

} /** * @experimental * `isSSGContext` is an experimental feature. * The API might be changed. */ export const isSSGContext =

const isSSGContext: (c: Context) => boolean

@experimental
isSSGContext is an experimental feature. The API might be changed.

(c:

(parameter) c: Context<any, any, {}>

Context): boolean => !

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

!c

(parameter) c: Context<any, any, {}>

.env?.

(property) Context<any, any, {}>.env: any .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

[SSG_CONTEXT]          

const SSG_CONTEXT: "HONO_SSG_CONTEXT"

/** * @experimental * `disableSSG` is an experimental feature. * The API might be changed. */ export const disableSSG = ():

const disableSSG: () => MiddlewareHandler

@experimental
disableSSG is an experimental feature. The API might be changed.

MiddlewareHandler =>          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

async function disableSSG

(local function) disableSSG(c: Context<any, string, {}>, next: Next): Promise<Response | undefined>

(c,

(parameter) c: Context<any, string, {}>

next) {          

(parameter) next: Next

if (isSSGContext

const isSSGContext: (c: Context) => boolean

@experimental
isSSGContext is an experimental feature. The API might be changed.

(c)) {          

(parameter) c: Context<any, string, {}>

c

(parameter) c: Context<any, string, {}>

.header

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

(X_HONO_DISABLE_SSG_HEADER_KEY, 'true')          

const X_HONO_DISABLE_SSG_HEADER_KEY: "x-hono-disable-ssg"

return c

(parameter) c: Context<any, string, {}>

.notFound()          

(property) Context<any, string, {}>.notFound: () => Response | Promise<Response> .notFound() can return the Not Found Response.

@see — https://hono.dev/docs/api/context#notfound

@example
ts app.get('/notfound', (c) => { return c.notFound() })

} await next()          

(parameter) next: () => Promise<void>

} /** * @experimental * `onlySSG` is an experimental feature. * The API might be changed. */ export const onlySSG = ():

const onlySSG: () => MiddlewareHandler

@experimental
onlySSG is an experimental feature. The API might be changed.

MiddlewareHandler =>          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

async function onlySSG

(local function) onlySSG(c: Context<any, string, {}>, next: Next): Promise<Response | undefined>

(c,

(parameter) c: Context<any, string, {}>

next) {          

(parameter) next: Next

if (!isSSGContext

const isSSGContext: (c: Context) => boolean

@experimental
isSSGContext is an experimental feature. The API might be changed.

(c)) {          

(parameter) c: Context<any, string, {}>

return c

(parameter) c: Context<any, string, {}>

.notFound()          

(property) Context<any, string, {}>.notFound: () => Response | Promise<Response> .notFound() can return the Not Found Response.

@see — https://hono.dev/docs/api/context#notfound

@example
ts app.get('/notfound', (c) => { return c.notFound() })

} await next()          

(parameter) next: () => Promise<void>

}
src/helper/ssg/ssg.ts
            
                import { replaceUrlParam } from '../../client/utils'
                import type { Hono } from '../../hono'
                import type { Env, Schema } from '../../types'
                import { createPool } from '../../utils/concurrent'
                import { getExtension } from '../../utils/mime'
                import type { AddedSSGDataRequest, SSGParams } from './middleware'
                import { SSG_CONTEXT, X_HONO_DISABLE_SSG_HEADER_KEY } from './middleware'
                import { dirname, filterStaticGenerateRoutes, joinPaths } from './utils'
                
                const DEFAULT_CONCURRENCY = 2 // default concurrency for ssg          

const DEFAULT_CONCURRENCY: 2

// 'default_content_type' is designed according to Bun's performance optimization, // which omits Content-Type by default for text responses. // This is based on benchmarks showing performance gains without Content-Type. // In Hono, using `c.text()` without a Content-Type implicitly assumes 'text/plain; charset=UTF-8'. // This approach maintains performance consistency across different environments. // For details, see GitHub issues: oven-sh/bun#8530 and https://github.com/honojs/hono/issues/2284. const DEFAULT_CONTENT_TYPE = 'text/plain'          

const DEFAULT_CONTENT_TYPE: "text/plain"

/** * @experimental * `FileSystemModule` is an experimental feature. * The API might be changed. */ export interface FileSystemModule {          

interface FileSystemModule

@experimental
FileSystemModule is an experimental feature. The API might be changed.

writeFile

(method) FileSystemModule.writeFile(path: string, data: string | Uint8Array): Promise<void>

(path: string,

(parameter) path: string

data: string |

(parameter) data: string | Uint8Array

Uint8Array):

interface Uint8Array A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

mkdir

(method) FileSystemModule.mkdir(path: string, options: { recursive: boolean; }): Promise<void | string>

(path: string,

(parameter) path: string

options: {

(parameter) options: { recursive: boolean; }

recursive: boolean }):

(property) recursive: boolean

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

} /** * @experimental * `ToSSGResult` is an experimental feature. * The API might be changed. */ export interface ToSSGResult {          

interface ToSSGResult

@experimental
ToSSGResult is an experimental feature. The API might be changed.

success: boolean          

(property) ToSSGResult.success: boolean

files: string[]          

(property) ToSSGResult.files: string[]

error?:

(property) ToSSGResult.error?: Error | undefined

Error          

interface Error

} const generateFilePath = (          

const generateFilePath: (routePath: string, outDir: string, mimeType: string, extensionMap?: Record<string, string>) => string

routePath: string,          

(parameter) routePath: string

outDir: string,          

(parameter) outDir: string

mimeType: string,          

(parameter) mimeType: string

extensionMap?:

(parameter) extensionMap: Record<string, string> | undefined

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

): string => { const extension =

const extension: string

determineExtension

const determineExtension: (mimeType: string, userExtensionMap?: Record<string, string>) => string

(mimeType,

(parameter) mimeType: string

extensionMap)          

(parameter) extensionMap: Record<string, string> | undefined

if (routePath

(parameter) routePath: string

.endsWith(`.$

(method) String.endsWith(searchString: string, endPosition?: number): boolean Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at endPosition – length(this). Otherwise returns false.

{extension}`)) {          

const extension: string

return joinPaths

(alias) joinPaths(...paths: string[]): string import joinPaths

(outDir,

(parameter) outDir: string

routePath)          

(parameter) routePath: string

} if (routePath === '/') {          

(parameter) routePath: string

return joinPaths

(alias) joinPaths(...paths: string[]): string import joinPaths

(outDir, `index.$

(parameter) outDir: string

{extension}`)          

const extension: string

} if (routePath

(parameter) routePath: string

.endsWith('/')) {          

(method) String.endsWith(searchString: string, endPosition?: number): boolean Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at endPosition – length(this). Otherwise returns false.

return joinPaths

(alias) joinPaths(...paths: string[]): string import joinPaths

(outDir,

(parameter) outDir: string

routePath, `index.$

(parameter) routePath: string

{extension}`)          

const extension: string

} return joinPaths

(alias) joinPaths(...paths: string[]): string import joinPaths

(outDir, `$

(parameter) outDir: string

{routePath}.$

(parameter) routePath: string

{extension}`)          

const extension: string

} const parseResponseContent = async

const parseResponseContent: (response: Response) => Promise<string | ArrayBuffer>

(response:

(parameter) response: Response

Response):

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

ArrayBuffer> => {          

interface ArrayBuffer Represents a raw buffer of binary data, which is used to store data for the different typed arrays. ArrayBuffers cannot be read from or written to directly, but can be passed to a typed array or DataView Object to interpret the raw buffer as needed.

const contentType =

const contentType: string | null

response

(parameter) response: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')          

(method) Headers.get(name: string): string | null MDN Reference

try { if (contentType?

const contentType: string | null

.includes('text') ||

(method) String.includes(searchString: string, position?: number): boolean Returns true if searchString appears as a substring of the result of converting this object to a String, at one or more positions that are greater than or equal to position; otherwise, returns false.

@param searchString — search string

@param position — If position is undefined, 0 is assumed, so as to search all of the String.

contentType?

const contentType: string | null

.includes('json')) {          

(method) String.includes(searchString: string, position?: number): boolean Returns true if searchString appears as a substring of the result of converting this object to a String, at one or more positions that are greater than or equal to position; otherwise, returns false.

@param searchString — search string

@param position — If position is undefined, 0 is assumed, so as to search all of the String.

return await response

(parameter) response: Response

.text()          

(method) Body.text(): Promise<string> MDN Reference

} else { return await response

(parameter) response: Response

.arrayBuffer()          

(method) Body.arrayBuffer(): Promise<ArrayBuffer> MDN Reference

} } catch (error) {          

(local var) error: unknown

throw new Error(          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

`Error processing response: ${error instanceof

(local var) error: unknown

Error ?

var Error: ErrorConstructor

error

(local var) error: Error

.message : 'Unknown error'}`          

(property) Error.message: string

) } } export const defaultExtensionMap:

const defaultExtensionMap: Record<string, string>

Record = {          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

'text/html': 'html', 'text/xml': 'xml', 'application/xml': 'xml', 'application/yaml': 'yaml', } const determineExtension = (          

const determineExtension: (mimeType: string, userExtensionMap?: Record<string, string>) => string

mimeType: string,          

(parameter) mimeType: string

userExtensionMap?:

(parameter) userExtensionMap: Record<string, string> | undefined

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

): string => { const extensionMap =

const extensionMap: Record<string, string>

userExtensionMap ||

(parameter) userExtensionMap: Record<string, string> | undefined

defaultExtensionMap          

const defaultExtensionMap: Record<string, string>

if (mimeType in

(parameter) mimeType: string

extensionMap) {          

const extensionMap: Record<string, string>

return extensionMap

const extensionMap: Record<string, string>

[mimeType]          

(parameter) mimeType: string

} return getExtension

(alias) getExtension(mimeType: string): string | undefined import getExtension

(mimeType) || 'html'          

(parameter) mimeType: string

} export type BeforeRequestHook =

type BeforeRequestHook = (req: Request) => Request | false | Promise<Request | false>

(req:

(parameter) req: Request

Request) =>

interface Request This Fetch API interface represents a resource request.

MDN Reference

Request | false |

interface Request This Fetch API interface represents a resource request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Request | false>          

interface Request This Fetch API interface represents a resource request.

MDN Reference

export type AfterResponseHook =

type AfterResponseHook = (res: Response) => Response | false | Promise<Response | false>

(res:

(parameter) res: Response

Response) =>

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Response | false |

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response | false>          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

export type AfterGenerateHook =

type AfterGenerateHook = (result: ToSSGResult) => void | Promise<void>

(result:

(parameter) result: ToSSGResult

ToSSGResult) => void |

interface ToSSGResult

@experimental
ToSSGResult is an experimental feature. The API might be changed.

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

export const combineBeforeRequestHooks = (          

const combineBeforeRequestHooks: (hooks: BeforeRequestHook | BeforeRequestHook[]) => BeforeRequestHook

hooks:

(parameter) hooks: BeforeRequestHook | BeforeRequestHook[]

BeforeRequestHook |

type BeforeRequestHook = (req: Request) => Request | false | Promise<Request | false>

BeforeRequestHook[]          

type BeforeRequestHook = (req: Request) => Request | false | Promise<Request | false>

): BeforeRequestHook => {          

type BeforeRequestHook = (req: Request) => Request | false | Promise<Request | false>

if (!Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(hooks)) {          

(parameter) hooks: BeforeRequestHook | BeforeRequestHook[]

return hooks          

(parameter) hooks: BeforeRequestHook

} return async (req:

(parameter) req: Request

Request):

interface Request This Fetch API interface represents a resource request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Request | false> => {          

interface Request This Fetch API interface represents a resource request.

MDN Reference

let currentReq =

let currentReq: Request

req          

(parameter) req: Request

for (const hook of

const hook: BeforeRequestHook

hooks) {          

(parameter) hooks: BeforeRequestHook[]

const result = await

const result: false | Request

hook

const hook: (req: Request) => Request | false | Promise<Request | false>

(currentReq)          

let currentReq: Request

if (result === false) {          

const result: false | Request

return false } if (result instanceof

const result: Request

Request) {          

var Request: { new (input: RequestInfo | URL, init?: RequestInit): Request; prototype: Request; } This Fetch API interface represents a resource request.

MDN Reference

currentReq =

let currentReq: Request

result          

const result: Request

} } return currentReq          

let currentReq: Request

} } export const combineAfterResponseHooks = (          

const combineAfterResponseHooks: (hooks: AfterResponseHook | AfterResponseHook[]) => AfterResponseHook

hooks:

(parameter) hooks: AfterResponseHook | AfterResponseHook[]

AfterResponseHook |

type AfterResponseHook = (res: Response) => Response | false | Promise<Response | false>

AfterResponseHook[]          

type AfterResponseHook = (res: Response) => Response | false | Promise<Response | false>

): AfterResponseHook => {          

type AfterResponseHook = (res: Response) => Response | false | Promise<Response | false>

if (!Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(hooks)) {          

(parameter) hooks: AfterResponseHook | AfterResponseHook[]

return hooks          

(parameter) hooks: AfterResponseHook

} return async (res:

(parameter) res: Response

Response):

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response | false> => {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

let currentRes =

let currentRes: Response

res          

(parameter) res: Response

for (const hook of

const hook: AfterResponseHook

hooks) {          

(parameter) hooks: AfterResponseHook[]

const result = await

const result: false | Response

hook

const hook: (res: Response) => Response | false | Promise<Response | false>

(currentRes)          

let currentRes: Response

if (result === false) {          

const result: false | Response

return false } if (result instanceof

const result: Response

Response) {          

var Response: { new (body?: BodyInit | null, init?: ResponseInit): Response; prototype: Response; error(): Response; json(data: any, init?: ResponseInit): Response; redirect(url: string | URL, status?: number): Response; } This Fetch API interface represents the response to a request.

MDN Reference

currentRes =

let currentRes: Response

result          

const result: Response

} } return currentRes          

let currentRes: Response

} } export const combineAfterGenerateHooks = (          

const combineAfterGenerateHooks: (hooks: AfterGenerateHook | AfterGenerateHook[]) => AfterGenerateHook

hooks:

(parameter) hooks: AfterGenerateHook | AfterGenerateHook[]

AfterGenerateHook |

type AfterGenerateHook = (result: ToSSGResult) => void | Promise<void>

AfterGenerateHook[]          

type AfterGenerateHook = (result: ToSSGResult) => void | Promise<void>

): AfterGenerateHook => {          

type AfterGenerateHook = (result: ToSSGResult) => void | Promise<void>

if (!Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(hooks)) {          

(parameter) hooks: AfterGenerateHook | AfterGenerateHook[]

return hooks          

(parameter) hooks: AfterGenerateHook

} return async (result:

(parameter) result: ToSSGResult

ToSSGResult):

interface ToSSGResult

@experimental
ToSSGResult is an experimental feature. The API might be changed.

Promise => {          

interface Promise<T> Represents the completion of an asynchronous operation

for (const hook of

const hook: AfterGenerateHook

hooks) {          

(parameter) hooks: AfterGenerateHook[]

await hook

const hook: (result: ToSSGResult) => void | Promise<void>

(result)          

(parameter) result: ToSSGResult

} } } export interface ToSSGOptions {          

interface ToSSGOptions

dir?: string          

(property) ToSSGOptions.dir?: string | undefined

beforeRequestHook?:

(property) ToSSGOptions.beforeRequestHook?: BeforeRequestHook | BeforeRequestHook[] | undefined

BeforeRequestHook |

type BeforeRequestHook = (req: Request) => Request | false | Promise<Request | false>

BeforeRequestHook[]          

type BeforeRequestHook = (req: Request) => Request | false | Promise<Request | false>

afterResponseHook?:

(property) ToSSGOptions.afterResponseHook?: AfterResponseHook | AfterResponseHook[] | undefined

AfterResponseHook |

type AfterResponseHook = (res: Response) => Response | false | Promise<Response | false>

AfterResponseHook[]          

type AfterResponseHook = (res: Response) => Response | false | Promise<Response | false>

afterGenerateHook?:

(property) ToSSGOptions.afterGenerateHook?: AfterGenerateHook | AfterGenerateHook[] | undefined

AfterGenerateHook |

type AfterGenerateHook = (result: ToSSGResult) => void | Promise<void>

AfterGenerateHook[]          

type AfterGenerateHook = (result: ToSSGResult) => void | Promise<void>

concurrency?: number          

(property) ToSSGOptions.concurrency?: number | undefined

extensionMap?:

(property) ToSSGOptions.extensionMap?: Record<string, string> | undefined

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

} /** * @experimental * `fetchRoutesContent` is an experimental feature. * The API might be changed. */ export const fetchRoutesContent = function* <          

const fetchRoutesContent: <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>, beforeRequestHook?: BeforeRequestHook, afterResponseHook?: AfterResponseHook, concurrency?: number) => Generator<Promise<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>> | undefined>>

@experimental
fetchRoutesContent is an experimental feature. The API might be changed.

E extends

(type parameter) E in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>, beforeRequestHook?: BeforeRequestHook, afterResponseHook?: AfterResponseHook, concurrency?: number): Generator<Promise<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>> | undefined>>

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env,          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

S extends

(type parameter) S in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>, beforeRequestHook?: BeforeRequestHook, afterResponseHook?: AfterResponseHook, concurrency?: number): Generator<Promise<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>> | undefined>>

Schema = {},          

(alias) type Schema = { [Path: string]: { [Method: `$${Lowercase<string>}`]: Endpoint; }; } import Schema

BasePath extends string = '/'          

(type parameter) BasePath in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>, beforeRequestHook?: BeforeRequestHook, afterResponseHook?: AfterResponseHook, concurrency?: number): Generator<Promise<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>> | undefined>>

>( app:

(parameter) app: Hono<E, S, BasePath>

Hono

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

<E,

(type parameter) E in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>, beforeRequestHook?: BeforeRequestHook, afterResponseHook?: AfterResponseHook, concurrency?: number): Generator<Promise<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>> | undefined>>

S,

(type parameter) S in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>, beforeRequestHook?: BeforeRequestHook, afterResponseHook?: AfterResponseHook, concurrency?: number): Generator<Promise<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>> | undefined>>

BasePath>,          

(type parameter) BasePath in <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>, beforeRequestHook?: BeforeRequestHook, afterResponseHook?: AfterResponseHook, concurrency?: number): Generator<Promise<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>> | undefined>>

beforeRequestHook?:

(parameter) beforeRequestHook: BeforeRequestHook | undefined

BeforeRequestHook,          

type BeforeRequestHook = (req: Request) => Request | false | Promise<Request | false>

afterResponseHook?:

(parameter) afterResponseHook: AfterResponseHook | undefined

AfterResponseHook,          

type AfterResponseHook = (res: Response) => Response | false | Promise<Response | false>

concurrency?: number          

(parameter) concurrency: number | undefined

): Generator<          

interface Generator<T = unknown, TReturn = any, TNext = any>

Promise<          

interface Promise<T> Represents the completion of an asynchronous operation

| Generator<          

interface Generator<T = unknown, TReturn = any, TNext = any>

Promise<{

interface Promise<T> Represents the completion of an asynchronous operation

routePath: string;

(property) routePath: string

mimeType: string;

(property) mimeType: string

content: string |

(property) content: string | ArrayBuffer

ArrayBuffer } | undefined>          

interface ArrayBuffer Represents a raw buffer of binary data, which is used to store data for the different typed arrays. ArrayBuffers cannot be read from or written to directly, but can be passed to a typed array or DataView Object to interpret the raw buffer as needed.

> | undefined > > { const baseURL = 'http://localhost'          

const baseURL: "http://localhost"

const pool =

const pool: Pool

createPool({

(alias) createPool({ concurrency, interval, }?: { concurrency?: number; interval?: number; }): Pool import createPool

concurrency })          

(property) concurrency?: number | undefined

for (const route of

const route: FilterStaticGenerateRouteData

filterStaticGenerateRoutes

(alias) filterStaticGenerateRoutes<E>(hono: Hono<E, BlankSchema, "/">): FilterStaticGenerateRouteData[] import filterStaticGenerateRoutes

(app)) {          

(parameter) app: Hono<E, S, BasePath>

// GET Route Info const thisRouteBaseURL = new

const thisRouteBaseURL: string

URL

var URL: new (url: string | URL, base?: string | URL) => URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

(route

const route: FilterStaticGenerateRouteData

.path,

(property) FilterStaticGenerateRouteData.path: string

baseURL)

const baseURL: "http://localhost"

.toString()          

(method) URL.toString(): string

let forGetInfoURLRequest = new

let forGetInfoURLRequest: AddedSSGDataRequest

Request

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

(thisRouteBaseURL) as

const thisRouteBaseURL: string

AddedSSGDataRequest          

(alias) type AddedSSGDataRequest = Request & { ssgParams?: SSGParams; } import AddedSSGDataRequest

// eslint-disable-next-line no-async-promise-executor yield new Promise(async

var Promise: PromiseConstructor new <Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | undefined>(executor: (resolve: (value: Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | PromiseLike<...> | undefined) => void, reject: (reason?: any) => void) => void) => Promise<...> Creates a new Promise.

@param executor
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

(resolveGetInfo,

(parameter) resolveGetInfo: (value: Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | PromiseLike<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | undefined> | undefined) => void

rejectGetInfo) => {          

(parameter) rejectGetInfo: (reason?: any) => void

try { if (beforeRequestHook) {          

(parameter) beforeRequestHook: BeforeRequestHook | undefined

const maybeRequest = await

const maybeRequest: false | Request

beforeRequestHook

(parameter) beforeRequestHook: (req: Request) => Request | false | Promise<Request | false>

(forGetInfoURLRequest)          

let forGetInfoURLRequest: AddedSSGDataRequest

if (!maybeRequest) {          

const maybeRequest: false | Request

resolveGetInfo(undefined)          

(parameter) resolveGetInfo: (value: Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | PromiseLike<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | undefined> | undefined) => void

return } forGetInfoURLRequest =

let forGetInfoURLRequest: AddedSSGDataRequest

maybeRequest as unknown as

const maybeRequest: Request

AddedSSGDataRequest          

(alias) type AddedSSGDataRequest = Request & { ssgParams?: SSGParams; } import AddedSSGDataRequest

} await pool

const pool: Pool

.run(() =>

(method) Pool.run<Response | Promise<Response>>(fn: () => Response | Promise<Response>): Promise<Response | Promise<Response>>

app

(parameter) app: Hono<E, S, BasePath>

.fetch

(property) Hono<E, S, BasePath>.fetch: (request: Request, Env?: {} | E["Bindings"] | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .fetch() will be entry point of your app.

@see — https://hono.dev/docs/api/hono#fetch

@param request — request Object of request

@param Env — env Object

@param — - context of execution

@returns — response of request

(forGetInfoURLRequest))          

let forGetInfoURLRequest: AddedSSGDataRequest

if (!forGetInfoURLRequest

let forGetInfoURLRequest: AddedSSGDataRequest

.ssgParams) {          

(property) ssgParams?: SSGParams | undefined

if (isDynamicRoute

const isDynamicRoute: (path: string) => boolean

(route

const route: FilterStaticGenerateRouteData

.path)) {          

(property) FilterStaticGenerateRouteData.path: string

resolveGetInfo(undefined)          

(parameter) resolveGetInfo: (value: Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | PromiseLike<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | undefined> | undefined) => void

return } forGetInfoURLRequest

let forGetInfoURLRequest: AddedSSGDataRequest

.ssgParams = [{}]          

(property) ssgParams?: SSGParams | undefined

} const requestInit = {          

const requestInit: { method: string; headers: Headers; }

method:

(property) method: string

forGetInfoURLRequest

let forGetInfoURLRequest: AddedSSGDataRequest

.method,          

(property) Request.method: string Returns request's HTTP method, which is "GET" by default.

MDN Reference

headers:

(property) headers: Headers

forGetInfoURLRequest

let forGetInfoURLRequest: AddedSSGDataRequest

.headers,          

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

} resolveGetInfo(          

(parameter) resolveGetInfo: (value: Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | PromiseLike<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | undefined> | undefined) => void

(function* () { for (const param of

const param: SSGParam

forGetInfoURLRequest

let forGetInfoURLRequest: AddedSSGDataRequest

.ssgParams as

(property) ssgParams?: SSGParams | undefined

SSGParams) {          

(alias) type SSGParams = SSGParam[] import SSGParams

// eslint-disable-next-line no-async-promise-executor yield new Promise(async

var Promise: PromiseConstructor new <{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>(executor: (resolve: (value: { routePath: string; mimeType: string; content: string | ArrayBuffer; } | PromiseLike<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined> | undefined) => void, reject: (reason?: any) => void) => void) => Promise<...> Creates a new Promise.

@param executor
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

(resolveReq,

(parameter) resolveReq: (value: { routePath: string; mimeType: string; content: string | ArrayBuffer; } | PromiseLike<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined> | undefined) => void

rejectReq) => {          

(parameter) rejectReq: (reason?: any) => void

try { const replacedUrlParam =

const replacedUrlParam: string

replaceUrlParam

(alias) replaceUrlParam(urlString: string, params: Record<string, string | undefined>): string import replaceUrlParam

(route

const route: FilterStaticGenerateRouteData

.path,

(property) FilterStaticGenerateRouteData.path: string

param)          

const param: SSGParam

let response = await

let response: Response

pool

const pool: Pool

.run(() =>          

(method) Pool.run<Response | Promise<Response>>(fn: () => Response | Promise<Response>): Promise<Response | Promise<Response>>

app

(parameter) app: Hono<E, S, BasePath>

.request

(property) Hono<E, S, BasePath>.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | E["Bindings"] | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(replacedUrlParam,

const replacedUrlParam: string

requestInit, {          

const requestInit: { method: string; headers: Headers; }

[SSG_CONTEXT]: true,          

(alias) const SSG_CONTEXT: "HONO_SSG_CONTEXT" import SSG_CONTEXT

}) ) if (response

let response: Response

.headers

(property) Response.headers: Headers MDN Reference

.get

(method) Headers.get(name: string): string | null MDN Reference

(X_HONO_DISABLE_SSG_HEADER_KEY)) {          

(alias) const X_HONO_DISABLE_SSG_HEADER_KEY: "x-hono-disable-ssg" import X_HONO_DISABLE_SSG_HEADER_KEY

resolveReq(undefined)          

(parameter) resolveReq: (value: { routePath: string; mimeType: string; content: string | ArrayBuffer; } | PromiseLike<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined> | undefined) => void

return } if (afterResponseHook) {          

(parameter) afterResponseHook: AfterResponseHook | undefined

const maybeResponse = await

const maybeResponse: false | Response

afterResponseHook

(parameter) afterResponseHook: (res: Response) => Response | false | Promise<Response | false>

(response)          

let response: Response

if (!maybeResponse) {          

const maybeResponse: false | Response

resolveReq(undefined)          

(parameter) resolveReq: (value: { routePath: string; mimeType: string; content: string | ArrayBuffer; } | PromiseLike<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined> | undefined) => void

return } response =

let response: Response

maybeResponse          

const maybeResponse: Response

} const mimeType =          

const mimeType: string

response

let response: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')?

(method) Headers.get(name: string): string | null MDN Reference

.split(';')[0] ||

(method) String.split(separator: string | RegExp, limit?: number): string[] (+1 overload) Split a string into substrings using the specified separator and return them as an array.

@param separator — A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.

@param limit — A value used to limit the number of elements returned in the array.

DEFAULT_CONTENT_TYPE          

const DEFAULT_CONTENT_TYPE: "text/plain"

const content = await

const content: string | ArrayBuffer

parseResponseContent

const parseResponseContent: (response: Response) => Promise<string | ArrayBuffer>

(response)          

let response: Response

resolveReq({          

(parameter) resolveReq: (value: { routePath: string; mimeType: string; content: string | ArrayBuffer; } | PromiseLike<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined> | undefined) => void

routePath:

(property) routePath: string

replacedUrlParam,          

const replacedUrlParam: string

mimeType,          

(property) mimeType: string

content,          

(property) content: string | ArrayBuffer

}) } catch (error) {          

(local var) error: unknown

rejectReq

(parameter) rejectReq: (reason?: any) => void

(error)          

(local var) error: unknown

} }) } })() ) } catch (error) {          

(local var) error: unknown

rejectGetInfo

(parameter) rejectGetInfo: (reason?: any) => void

(error)          

(local var) error: unknown

} }) } } const isDynamicRoute =

const isDynamicRoute: (path: string) => boolean

(path: string): boolean => {          

(parameter) path: string

return path

(parameter) path: string

.split('/')

(method) String.split(separator: string | RegExp, limit?: number): string[] (+1 overload) Split a string into substrings using the specified separator and return them as an array.

@param separator — A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.

@param limit — A value used to limit the number of elements returned in the array.

.some(

(method) Array<string>.some(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean Determines whether the specified callback function returns true for any element of an array.

@param predicate
A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

@param thisArg
An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

(segment) =>

(parameter) segment: string

segment

(parameter) segment: string

.startsWith(':') ||

(method) String.startsWith(searchString: string, position?: number): boolean Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false.

segment

(parameter) segment: string

.includes('*'))          

(method) String.includes(searchString: string, position?: number): boolean Returns true if searchString appears as a substring of the result of converting this object to a String, at one or more positions that are greater than or equal to position; otherwise, returns false.

@param searchString — search string

@param position — If position is undefined, 0 is assumed, so as to search all of the String.

} /** * @experimental * `saveContentToFile` is an experimental feature. * The API might be changed. */ const createdDirs:

const createdDirs: Set<string>

@experimental
saveContentToFile is an experimental feature. The API might be changed.

Set = new

interface Set<T>

Set()          

var Set: SetConstructor new <string>(iterable?: Iterable<string> | null | undefined) => Set<string> (+1 overload)

export const saveContentToFile = async (          

const saveContentToFile: (data: Promise<{ routePath: string; content: string | ArrayBuffer; mimeType: string; } | undefined>, fsModule: FileSystemModule, outDir: string, extensionMap?: Record<string, string>) => Promise<string | undefined>

data:

(parameter) data: Promise<{ routePath: string; content: string | ArrayBuffer; mimeType: string; } | undefined>

Promise<{

interface Promise<T> Represents the completion of an asynchronous operation

routePath: string;

(property) routePath: string

content: string |

(property) content: string | ArrayBuffer

ArrayBuffer;

interface ArrayBuffer Represents a raw buffer of binary data, which is used to store data for the different typed arrays. ArrayBuffers cannot be read from or written to directly, but can be passed to a typed array or DataView Object to interpret the raw buffer as needed.

mimeType: string } | undefined>,          

(property) mimeType: string

fsModule:

(parameter) fsModule: FileSystemModule

FileSystemModule,          

interface FileSystemModule

@experimental
FileSystemModule is an experimental feature. The API might be changed.

outDir: string,          

(parameter) outDir: string

extensionMap?:

(parameter) extensionMap: Record<string, string> | undefined

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

): Promise => {          

interface Promise<T> Represents the completion of an asynchronous operation

const awaitedData = await

const awaitedData: { routePath: string; content: string | ArrayBuffer; mimeType: string; } | undefined

data          

(parameter) data: Promise<{ routePath: string; content: string | ArrayBuffer; mimeType: string; } | undefined>

if (!awaitedData) {          

const awaitedData: { routePath: string; content: string | ArrayBuffer; mimeType: string; } | undefined

return } const { routePath,

const routePath: string

content,

const content: string | ArrayBuffer

mimeType } =

const mimeType: string

awaitedData          

const awaitedData: { routePath: string; content: string | ArrayBuffer; mimeType: string; }

const filePath =

const filePath: string

generateFilePath

const generateFilePath: (routePath: string, outDir: string, mimeType: string, extensionMap?: Record<string, string>) => string

(routePath,

const routePath: string

outDir,

(parameter) outDir: string

mimeType,

const mimeType: string

extensionMap)          

(parameter) extensionMap: Record<string, string> | undefined

const dirPath =

const dirPath: string

dirname

(alias) dirname(path: string): string import dirname Get dirname

@param path — File Path

@returns — Parent dir path

(filePath)          

const filePath: string

if (!createdDirs

const createdDirs: Set<string>

@experimental
saveContentToFile is an experimental feature. The API might be changed.

.has

(method) Set<string>.has(value: string): boolean

@returns — a boolean indicating whether an element with the specified value exists in the Set or not.

(dirPath)) {          

const dirPath: string

await fsModule

(parameter) fsModule: FileSystemModule

.mkdir

(method) FileSystemModule.mkdir(path: string, options: { recursive: boolean; }): Promise<void | string>

(dirPath, {

const dirPath: string

recursive: true })          

(property) recursive: boolean

createdDirs

const createdDirs: Set<string>

@experimental
saveContentToFile is an experimental feature. The API might be changed.

.add

(method) Set<string>.add(value: string): Set<string> Appends a new element with a specified value to the end of the Set.

(dirPath)          

const dirPath: string

} if (typeof content === 'string') {          

const content: string | ArrayBuffer

await fsModule

(parameter) fsModule: FileSystemModule

.writeFile

(method) FileSystemModule.writeFile(path: string, data: string | Uint8Array): Promise<void>

(filePath,

const filePath: string

content)          

const content: string

} else if (content instanceof

const content: ArrayBuffer

ArrayBuffer) {          

var ArrayBuffer: ArrayBufferConstructor Represents a raw buffer of binary data, which is used to store data for the different typed arrays. ArrayBuffers cannot be read from or written to directly, but can be passed to a typed array or DataView Object to interpret the raw buffer as needed.

await fsModule

(parameter) fsModule: FileSystemModule

.writeFile

(method) FileSystemModule.writeFile(path: string, data: string | Uint8Array): Promise<void>

(filePath, new

const filePath: string

Uint8Array

var Uint8Array: Uint8ArrayConstructor new (array: ArrayLike<number> | ArrayBufferLike) => Uint8Array (+4 overloads)

(content))          

const content: ArrayBuffer

} return filePath          

const filePath: string

} /** * @experimental * `ToSSGInterface` is an experimental feature. * The API might be changed. */ export interface ToSSGInterface {          

interface ToSSGInterface

@experimental
ToSSGInterface is an experimental feature. The API might be changed.

( // eslint-disable-next-line @typescript-eslint/no-explicit-any app:

(parameter) app: Hono<any, any, any>

Hono,          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

fsModule:

(parameter) fsModule: FileSystemModule

FileSystemModule,          

interface FileSystemModule

@experimental
FileSystemModule is an experimental feature. The API might be changed.

options?:

(parameter) options: ToSSGOptions | undefined

ToSSGOptions          

interface ToSSGOptions

): Promise

interface Promise<T> Represents the completion of an asynchronous operation

<ToSSGResult>          

interface ToSSGResult

@experimental
ToSSGResult is an experimental feature. The API might be changed.

} /** * @experimental * `ToSSGAdaptorInterface` is an experimental feature. * The API might be changed. */ export interface ToSSGAdaptorInterface<          

interface ToSSGAdaptorInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

@experimental
ToSSGAdaptorInterface is an experimental feature. The API might be changed.

E extends

(type parameter) E in ToSSGAdaptorInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env,          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

S extends

(type parameter) S in ToSSGAdaptorInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

Schema = {},          

(alias) type Schema = { [Path: string]: { [Method: `$${Lowercase<string>}`]: Endpoint; }; } import Schema

BasePath extends string = '/'          

(type parameter) BasePath in ToSSGAdaptorInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

> { (app:

(parameter) app: Hono<E, S, BasePath>

Hono

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

<E,

(type parameter) E in ToSSGAdaptorInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in ToSSGAdaptorInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath>,

(type parameter) BasePath in ToSSGAdaptorInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

options?:

(parameter) options: ToSSGOptions | undefined

ToSSGOptions):

interface ToSSGOptions

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<ToSSGResult>          

interface ToSSGResult

@experimental
ToSSGResult is an experimental feature. The API might be changed.

} /** * @experimental * `toSSG` is an experimental feature. * The API might be changed. */ export const toSSG:

const toSSG: ToSSGInterface

@experimental
toSSG is an experimental feature. The API might be changed.

ToSSGInterface = async

interface ToSSGInterface

@experimental
ToSSGInterface is an experimental feature. The API might be changed.

(app,

(parameter) app: Hono<any, any, any>

fs,

(parameter) fs: FileSystemModule

options) => {          

(parameter) options: ToSSGOptions | undefined

let result:

let result: ToSSGResult | undefined

ToSSGResult | undefined          

interface ToSSGResult

@experimental
ToSSGResult is an experimental feature. The API might be changed.

const getInfoPromises:

const getInfoPromises: Promise<unknown>[]

Promise[] = []          

interface Promise<T> Represents the completion of an asynchronous operation

const savePromises:

const savePromises: Promise<string | undefined>[]

Promise[] = []          

interface Promise<T> Represents the completion of an asynchronous operation

try { const outputDir =

const outputDir: string

options?

(parameter) options: ToSSGOptions | undefined

.dir ?? './static'          

(property) ToSSGOptions.dir?: string | undefined

const concurrency =

const concurrency: number

options?

(parameter) options: ToSSGOptions | undefined

.concurrency ??

(property) ToSSGOptions.concurrency?: number | undefined

DEFAULT_CONCURRENCY          

const DEFAULT_CONCURRENCY: 2

const combinedBeforeRequestHook =

const combinedBeforeRequestHook: BeforeRequestHook

combineBeforeRequestHooks(          

const combineBeforeRequestHooks: (hooks: BeforeRequestHook | BeforeRequestHook[]) => BeforeRequestHook

options?

(parameter) options: ToSSGOptions | undefined

.beforeRequestHook || (

(property) ToSSGOptions.beforeRequestHook?: BeforeRequestHook | BeforeRequestHook[] | undefined

(req) =>

(parameter) req: Request

req)          

(parameter) req: Request

) const combinedAfterResponseHook =

const combinedAfterResponseHook: AfterResponseHook

combineAfterResponseHooks(          

const combineAfterResponseHooks: (hooks: AfterResponseHook | AfterResponseHook[]) => AfterResponseHook

options?

(parameter) options: ToSSGOptions | undefined

.afterResponseHook || (

(property) ToSSGOptions.afterResponseHook?: AfterResponseHook | AfterResponseHook[] | undefined

(req) =>

(parameter) req: Response

req)          

(parameter) req: Response

) const getInfoGen =

const getInfoGen: Generator<Promise<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | undefined>, any, any>

fetchRoutesContent(          

const fetchRoutesContent: <any, any, any>(app: Hono<any, any, any>, beforeRequestHook?: BeforeRequestHook, afterResponseHook?: AfterResponseHook, concurrency?: number) => Generator<Promise<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>> | undefined>>

@experimental
fetchRoutesContent is an experimental feature. The API might be changed.

app,          

(parameter) app: Hono<any, any, any>

combinedBeforeRequestHook,          

const combinedBeforeRequestHook: BeforeRequestHook

combinedAfterResponseHook,          

const combinedAfterResponseHook: AfterResponseHook

concurrency          

const concurrency: number

) for (const getInfo of

const getInfo: Promise<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | undefined>

getInfoGen) {          

const getInfoGen: Generator<Promise<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | undefined>, any, any>

getInfoPromises

const getInfoPromises: Promise<unknown>[]

.push(          

(method) Array<Promise<unknown>>.push(...items: Promise<unknown>[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

getInfo

const getInfo: Promise<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | undefined>

.then(

(method) Promise<Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | undefined>.then<void, unknown>(onfulfilled?: ((value: Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | undefined) => void | PromiseLike<...>) | null | undefined, onrejected?: ((reason: any) => unknown) | ... 1 more ... | undefined): Promise<...> Attaches callbacks for the resolution and/or rejection of the Promise.

@param onfulfilled — The callback to execute when the Promise is resolved.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of which ever callback is executed.

(getContentGen) => {          

(parameter) getContentGen: Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | undefined

if (!getContentGen) {          

(parameter) getContentGen: Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any> | undefined

return } for (const content of

const content: Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>

getContentGen) {          

(parameter) getContentGen: Generator<Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>, any, any>

savePromises

const savePromises: Promise<string | undefined>[]

.push

(method) Array<Promise<string | undefined>>.push(...items: Promise<string | undefined>[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(saveContentToFile

const saveContentToFile: (data: Promise<{ routePath: string; content: string | ArrayBuffer; mimeType: string; } | undefined>, fsModule: FileSystemModule, outDir: string, extensionMap?: Record<string, string>) => Promise<string | undefined>

(content,

const content: Promise<{ routePath: string; mimeType: string; content: string | ArrayBuffer; } | undefined>

fs,

(parameter) fs: FileSystemModule

outputDir)

const outputDir: string

.catch(

(method) Promise<string | undefined>.catch<any>(onrejected?: ((reason: any) => any) | null | undefined): Promise<any> Attaches a callback for only the rejection of the Promise.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of the callback.

(e) =>

(parameter) e: any

e))          

(parameter) e: any

} }) ) } await Promise

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

.all

(method) PromiseConstructor.all<Promise<unknown>[]>(values: Promise<unknown>[]): Promise<unknown[]> (+1 overload) Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

@param values — An array of Promises.

@returns — A new Promise.

(getInfoPromises)          

const getInfoPromises: Promise<unknown>[]

const files: string[] = []          

const files: string[]

for (const savePromise of

const savePromise: Promise<string | undefined>

savePromises) {          

const savePromises: Promise<string | undefined>[]

const fileOrError = await

const fileOrError: string | undefined

savePromise          

const savePromise: Promise<string | undefined>

if (typeof fileOrError === 'string') {          

const fileOrError: string | undefined

files

const files: string[]

.push

(method) Array<string>.push(...items: string[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(fileOrError)          

const fileOrError: string

} else if (fileOrError) {          

const fileOrError: undefined

throw fileOrError          

const fileOrError: never

} } result = {

let result: ToSSGResult | undefined

success: true,

(property) ToSSGResult.success: boolean

files }          

(property) ToSSGResult.files: string[]

} catch (error) {          

(local var) error: unknown

const errorObj =

const errorObj: Error

error instanceof

(local var) error: unknown

Error ?

var Error: ErrorConstructor

error : new

(local var) error: Error

Error

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

(String

var String: StringConstructor (value?: any) => string Allows manipulation and formatting of text strings and determination and location of substrings within strings.

(error))          

(local var) error: unknown

result = {

let result: ToSSGResult | undefined

success: false,

(property) ToSSGResult.success: boolean

files: [],

(property) ToSSGResult.files: string[]

error:

(property) ToSSGResult.error?: Error | undefined

errorObj }          

const errorObj: Error

} if (options?

(parameter) options: ToSSGOptions | undefined

.afterGenerateHook) {          

(property) ToSSGOptions.afterGenerateHook?: AfterGenerateHook | AfterGenerateHook[] | undefined

const conbinedAfterGenerateHooks =

const conbinedAfterGenerateHooks: AfterGenerateHook

combineAfterGenerateHooks

const combineAfterGenerateHooks: (hooks: AfterGenerateHook | AfterGenerateHook[]) => AfterGenerateHook

(options?

(parameter) options: ToSSGOptions

.afterGenerateHook)          

(property) ToSSGOptions.afterGenerateHook?: AfterGenerateHook | AfterGenerateHook[]

await conbinedAfterGenerateHooks

const conbinedAfterGenerateHooks: (result: ToSSGResult) => void | Promise<void>

(result)          

let result: ToSSGResult

} return result          

let result: ToSSGResult

}
src/helper/ssg/utils.test.ts
            
                import { describe, expect, it } from 'vitest'
                import { dirname, joinPaths } from './utils'
                
                describe('joinPath', () => {
                  it('Should joined path is valid.', () => {
                    expect(joinPaths('test')).toBe('test') //single          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('.test')).toBe('.test') //single with dot          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('/.test')).toBe('/.test') //single with dot with root          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('test', 'test2')).toBe('test/test2') // single and single          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('test', 'test2', '../test3')).toBe('test/test3') // single and single and single with parent          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('.', '../')).toBe('..') // dot and parent          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('test/', 'test2/')).toBe('test/test2') // trailing slashes          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('./test', './test2')).toBe('test/test2') // dot and slash          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('', 'test')).toBe('test') // empty path          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('/test', '/test2')).toBe('/test/test2') // root path          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('../', 'test')).toBe('../test') // parent and single          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('test', '..', 'test2')).toBe('test2') // single triple dot and single          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('test', '...', 'test2')).toBe('test/.../test2') // single triple dot and single          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('test', './test2', '.test3.')).toBe('test/test2/.test3.') // single and single with slash and single with dot          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('test', '../', '.test2')).toBe('.test2') // single and parent and single with dot          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('..', '..', 'test')).toBe('../../test') // parent and parent and single          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('..', '..')).toBe('../..') // parent and parent          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('.test../test2/../')).toBe('.test..') //shuffle          

(alias) joinPaths(...paths: string[]): string import joinPaths

expect(joinPaths('.test./.test2/../')).toBe('.test.') //shuffle2          

(alias) joinPaths(...paths: string[]): string import joinPaths

}) it('Should windows path is valid.', () => { expect(joinPaths('a\\b\\c', 'd\\e')).toBe('a/b/c/d/e')          

(alias) joinPaths(...paths: string[]): string import joinPaths

}) }) describe('dirname', () => { it('Should dirname is valid.', () => { expect(dirname('parent/child')).toBe('parent')          

(alias) dirname(path: string): string import dirname Get dirname

@param path — File Path

@returns — Parent dir path

expect(dirname('windows\\test.txt')).toBe('windows')          

(alias) dirname(path: string): string import dirname Get dirname

@param path — File Path

@returns — Parent dir path

}) })
src/helper/ssg/utils.ts
            
                import type { Hono } from '../../hono'
                import { METHOD_NAME_ALL } from '../../router'
                import type { Env, RouterRoute } from '../../types'
                import { findTargetHandler, isMiddleware } from '../../utils/handler'
                
                /**
                 * Get dirname
                 * @param path File Path
                 * @returns Parent dir path
                 */
                export const dirname = 

const dirname: (path: string) => string Get dirname

@param path — File Path

@returns — Parent dir path

(path: string): string => {          

(parameter) path: string File Path

@param path — File Path

const splittedPath =

const splittedPath: string[]

path

(parameter) path: string File Path

@param path — File Path

.split(/[\/\\]/)          

(method) String.split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[] (+1 overload) Split a string into substrings using the specified separator and return them as an array.

@param splitter — An object that can split a string.

@param limit — A value used to limit the number of elements returned in the array.

return splittedPath

const splittedPath: string[]

.slice(0, -1)

(method) Array<string>.slice(start?: number, end?: number): string[] Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array.

@param start
The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.

@param end
The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the array.

.join('/') // Windows supports slash path          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

} const normalizePath =

const normalizePath: (path: string) => string

(path: string): string => {          

(parameter) path: string

return path

(parameter) path: string

.replace(/(\\)/g, '/')

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

.replace(/\/$/g, '')          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

} const handleParent =

const handleParent: (resultPaths: string[], beforeParentFlag: boolean) => void

(resultPaths: string[],

(parameter) resultPaths: string[]

beforeParentFlag: boolean): void => {          

(parameter) beforeParentFlag: boolean

if (resultPaths

(parameter) resultPaths: string[]

.length === 0 ||

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

beforeParentFlag) {          

(parameter) beforeParentFlag: boolean

resultPaths

(parameter) resultPaths: string[]

.push('..')          

(method) Array<string>.push(...items: string[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

} else { resultPaths

(parameter) resultPaths: string[]

.pop()          

(method) Array<string>.pop(): string | undefined Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

} } const handleNonDot =

const handleNonDot: (path: string, resultPaths: string[]) => void

(path: string,

(parameter) path: string

resultPaths: string[]): void => {          

(parameter) resultPaths: string[]

path =

(parameter) path: string

path

(parameter) path: string

.replace(/^\.(?!.)/, '')          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

if (path !== '') {          

(parameter) path: string

resultPaths

(parameter) resultPaths: string[]

.push

(method) Array<string>.push(...items: string[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(path)          

(parameter) path: string

} } const handleSegments =

const handleSegments: (paths: string[], resultPaths: string[]) => void

(paths: string[],

(parameter) paths: string[]

resultPaths: string[]): void => {          

(parameter) resultPaths: string[]

let beforeParentFlag = false          

let beforeParentFlag: boolean

for (const path of

const path: string

paths) {          

(parameter) paths: string[]

// Handle `..` if (path === '..') {          

const path: string

handleParent

const handleParent: (resultPaths: string[], beforeParentFlag: boolean) => void

(resultPaths,

(parameter) resultPaths: string[]

beforeParentFlag)          

let beforeParentFlag: boolean

beforeParentFlag = true          

let beforeParentFlag: boolean

} else { // Handle `.` or `abc` handleNonDot

const handleNonDot: (path: string, resultPaths: string[]) => void

(path,

const path: string

resultPaths)          

(parameter) resultPaths: string[]

beforeParentFlag = false          

let beforeParentFlag: boolean

} } } export const joinPaths = (..

const joinPaths: (...paths: string[]) => string

.paths: string[]): string => {          

(parameter) paths: string[]

paths =

(parameter) paths: string[]

paths

(parameter) paths: string[]

.map

(method) Array<string>.map<string>(callbackfn: (value: string, index: number, array: string[]) => string, thisArg?: any): string[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(normalizePath)          

const normalizePath: (path: string) => string

const resultPaths: string[] = []          

const resultPaths: string[]

handleSegments

const handleSegments: (paths: string[], resultPaths: string[]) => void

(paths

(parameter) paths: string[]

.join('/')

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

.split('/'),

(method) String.split(separator: string | RegExp, limit?: number): string[] (+1 overload) Split a string into substrings using the specified separator and return them as an array.

@param separator — A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.

@param limit — A value used to limit the number of elements returned in the array.

resultPaths)          

const resultPaths: string[]

return (paths[0][0] === '/' ? '/' : '') +

(parameter) paths: string[]

resultPaths

const resultPaths: string[]

.join('/')          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

} interface FilterStaticGenerateRouteData {          

interface FilterStaticGenerateRouteData

path: string          

(property) FilterStaticGenerateRouteData.path: string

} export const filterStaticGenerateRoutes =

const filterStaticGenerateRoutes: <E extends Env>(hono: Hono<E>) => FilterStaticGenerateRouteData[]

<E extends

(type parameter) E in <E extends Env>(hono: Hono<E>): FilterStaticGenerateRouteData[]

Env>(          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

hono:

(parameter) hono: Hono<E, BlankSchema, "/">

Hono

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

<E>          

(type parameter) E in <E extends Env>(hono: Hono<E>): FilterStaticGenerateRouteData[]

): FilterStaticGenerateRouteData[] => {          

interface FilterStaticGenerateRouteData

return hono

(parameter) hono: Hono<E, BlankSchema, "/">

.routes

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.routes: RouterRoute[]

.reduce(

(method) Array<RouterRoute>.reduce<FilterStaticGenerateRouteData[]>(callbackfn: (previousValue: FilterStaticGenerateRouteData[], currentValue: RouterRoute, currentIndex: number, array: RouterRoute[]) => FilterStaticGenerateRouteData[], initialValue: FilterStaticGenerateRouteData[]): FilterStaticGenerateRouteData[] (+2 overloads) Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

@param callbackfn — A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

@param initialValue — If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

(acc, {

(parameter) acc: FilterStaticGenerateRouteData[]

method,

(parameter) method: string

handler,

(parameter) handler: H<any, any, BlankInput, any>

path }:

(parameter) path: string

RouterRoute) => {          

(alias) interface RouterRoute import RouterRoute

const targetHandler =

const targetHandler: Function

findTargetHandler

(alias) findTargetHandler(handler: Function): Function import findTargetHandler

(handler)          

(parameter) handler: H<any, any, BlankInput, any>

if (['GET', METHOD_NAME_ALL]

(alias) const METHOD_NAME_ALL: "ALL" import METHOD_NAME_ALL Constant representing all HTTP methods in uppercase.

.includes

(method) Array<string>.includes(searchElement: string, fromIndex?: number): boolean Determines whether an array includes a certain element, returning true or false as appropriate.

@param searchElement — The element to search for.

@param fromIndex — The position in this array at which to begin searching for searchElement.

(method) &&

(parameter) method: string

!isMiddleware

(alias) isMiddleware(handler: Function): boolean import isMiddleware

(targetHandler)) {          

const targetHandler: Function

acc

(parameter) acc: FilterStaticGenerateRouteData[]

.push({

(method) Array<FilterStaticGenerateRouteData>.push(...items: FilterStaticGenerateRouteData[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

path })          

(property) FilterStaticGenerateRouteData.path: string

} return acc          

(parameter) acc: FilterStaticGenerateRouteData[]

}, [] as FilterStaticGenerateRouteData[])          

interface FilterStaticGenerateRouteData

}
src/helper/streaming/index.ts
            
                /**
                 * @module
                 * Streaming Helper for Hono.
                 */
                
                export { stream } from './stream'          

(alias) const stream: (c: Context, cb: (stream: StreamingApi) => Promise<void>, onError?: (e: Error, stream: StreamingApi) => Promise<void>) => Response export stream

export type { SSEMessage } from './sse'          

(alias) interface SSEMessage export SSEMessage

export { streamSSE,

(alias) const streamSSE: (c: Context, cb: (stream: SSEStreamingApi) => Promise<void>, onError?: (e: Error, stream: SSEStreamingApi) => Promise<void>) => Response export streamSSE

SSEStreamingApi } from './sse'          

(alias) class SSEStreamingApi export SSEStreamingApi

export { streamText } from './text'          

(alias) const streamText: (c: Context, cb: (stream: StreamingApi) => Promise<void>, onError?: (e: Error, stream: StreamingApi) => Promise<void>) => Response export streamText

src/helper/streaming/sse.ts
            
                import type { Context } from '../../context'
                import { HtmlEscapedCallbackPhase, resolveCallback } from '../../utils/html'
                import { StreamingApi } from '../../utils/stream'
                
                export interface SSEMessage {          

interface SSEMessage

data: string |

(property) SSEMessage.data: string | Promise<string>

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

event?: string          

(property) SSEMessage.event?: string | undefined

id?: string          

(property) SSEMessage.id?: string | undefined

retry?: number          

(property) SSEMessage.retry?: number | undefined

} export class SSEStreamingApi extends

class SSEStreamingApi

StreamingApi {          

(alias) class StreamingApi import StreamingApi

@module — Stream utility.

constructor(writable:

(parameter) writable: WritableStream<any>

WritableStream,

interface WritableStream<W = any> This Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing.

MDN Reference

readable:

(parameter) readable: ReadableStream<any>

ReadableStream) {          

interface ReadableStream<R = any> This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.

MDN Reference

super(writable,

(parameter) writable: WritableStream<any>

readable)          

(parameter) readable: ReadableStream<any>

} async writeSSE

(method) SSEStreamingApi.writeSSE(message: SSEMessage): Promise<void>

(message:

(parameter) message: SSEMessage

SSEMessage) {          

interface SSEMessage

const data = await

const data: string

resolveCallback

(alias) resolveCallback(str: string | HtmlEscapedString | Promise<string>, phase: (typeof HtmlEscapedCallbackPhase)[keyof typeof HtmlEscapedCallbackPhase], preserveCallbacks: boolean, context: object, buffer?: [string]): Promise<string> import resolveCallback

(message

(parameter) message: SSEMessage

.data,

(property) SSEMessage.data: string | Promise<string>

HtmlEscapedCallbackPhase

(alias) const HtmlEscapedCallbackPhase: { readonly Stringify: 1; readonly BeforeStream: 2; readonly Stream: 3; } import HtmlEscapedCallbackPhase

@module — HTML utility.

.Stringify, false, {})          

(property) Stringify: 1

const dataLines =

const dataLines: string

(data as string)          

const data: string

.split('\n')          

(method) String.split(separator: string | RegExp, limit?: number): string[] (+1 overload) Split a string into substrings using the specified separator and return them as an array.

@param separator — A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.

@param limit — A value used to limit the number of elements returned in the array.

.map(

(method) Array<string>.map<string>(callbackfn: (value: string, index: number, array: string[]) => string, thisArg?: any): string[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(line) => {          

(parameter) line: string

return `data: ${line}`          

(parameter) line: string

}) .join('\n')          

(method) Array<string>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

const sseData =          

const sseData: string

[ message

(parameter) message: SSEMessage

.event && `event: $

(property) SSEMessage.event?: string | undefined

{message

(parameter) message: SSEMessage

.event}`,          

(property) SSEMessage.event?: string

dataLines,          

const dataLines: string

message

(parameter) message: SSEMessage

.id && `id: $

(property) SSEMessage.id?: string | undefined

{message

(parameter) message: SSEMessage

.id}`,          

(property) SSEMessage.id?: string

message

(parameter) message: SSEMessage

.retry && `retry: $

(property) SSEMessage.retry?: number | undefined

{message

(parameter) message: SSEMessage

.retry}`,          

(property) SSEMessage.retry?: number

] .filter

(method) Array<string | 0 | undefined>.filter(predicate: (value: string | 0 | undefined, index: number, array: (string | 0 | undefined)[]) => unknown, thisArg?: any): (string | 0 | undefined)[] (+1 overload) Returns the elements of an array that meet the condition specified in a callback function.

@param predicate — A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

(Boolean)          

var Boolean: BooleanConstructor

.join('\n') + '\n\n'          

(method) Array<string | 0 | undefined>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

await this.write

(method) StreamingApi.write(input: Uint8Array | string): Promise<StreamingApi>

(sseData)          

const sseData: string

} } const run = async (          

const run: (stream: SSEStreamingApi, cb: (stream: SSEStreamingApi) => Promise<void>, onError?: (e: Error, stream: SSEStreamingApi) => Promise<void>) => Promise<void>

stream:

(parameter) stream: SSEStreamingApi

SSEStreamingApi,          

class SSEStreamingApi

cb:

(parameter) cb: (stream: SSEStreamingApi) => Promise<void>

(stream:

(parameter) stream: SSEStreamingApi

SSEStreamingApi) =>

class SSEStreamingApi

Promise,          

interface Promise<T> Represents the completion of an asynchronous operation

onError?:

(parameter) onError: ((e: Error, stream: SSEStreamingApi) => Promise<void>) | undefined

(e:

(parameter) e: Error

Error,

interface Error

stream:

(parameter) stream: SSEStreamingApi

SSEStreamingApi) =>

class SSEStreamingApi

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

): Promise => {          

interface Promise<T> Represents the completion of an asynchronous operation

try { await cb

(parameter) cb: (stream: SSEStreamingApi) => Promise<void>

(stream)          

(parameter) stream: SSEStreamingApi

} catch (e) {          

(local var) e: unknown

if (e instanceof

(local var) e: unknown

Error &&

var Error: ErrorConstructor

onError) {          

(parameter) onError: ((e: Error, stream: SSEStreamingApi) => Promise<void>) | undefined

await onError

(parameter) onError: (e: Error, stream: SSEStreamingApi) => Promise<void>

(e,

(local var) e: Error

stream)          

(parameter) stream: SSEStreamingApi

await stream

(parameter) stream: SSEStreamingApi

.writeSSE({          

(method) SSEStreamingApi.writeSSE(message: SSEMessage): Promise<void>

event: 'error',          

(property) SSEMessage.event?: string | undefined

data:

(property) SSEMessage.data: string | Promise<string>

e

(local var) e: Error

.message,          

(property) Error.message: string

}) } else { console

var console: Console

.error

(method) Console.error(...data: any[]): void MDN Reference

(e)          

(local var) e: unknown

} } finally { stream

(parameter) stream: SSEStreamingApi

.close()          

(method) StreamingApi.close(): Promise<void>

} } const contextStash:

const contextStash: WeakMap<ReadableStream<any>, Context<any, any, {}>>

WeakMap

interface WeakMap<K extends WeakKey, V>

<ReadableStream,

interface ReadableStream<R = any> This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.

MDN Reference

Context> = new

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

WeakMap

var WeakMap: WeakMapConstructor new <ReadableStream<any>, Context<any, any, {}>>(entries?: readonly (readonly [ReadableStream<any>, Context<any, any, {}>])[] | null | undefined) => WeakMap<...> (+1 overload)

<ReadableStream,

interface ReadableStream<R = any> This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.

MDN Reference

Context>()          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

export const streamSSE = (          

const streamSSE: (c: Context, cb: (stream: SSEStreamingApi) => Promise<void>, onError?: (e: Error, stream: SSEStreamingApi) => Promise<void>) => Response

c:

(parameter) c: Context<any, any, {}>

Context,          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

cb:

(parameter) cb: (stream: SSEStreamingApi) => Promise<void>

(stream:

(parameter) stream: SSEStreamingApi

SSEStreamingApi) =>

class SSEStreamingApi

Promise,          

interface Promise<T> Represents the completion of an asynchronous operation

onError?:

(parameter) onError: ((e: Error, stream: SSEStreamingApi) => Promise<void>) | undefined

(e:

(parameter) e: Error

Error,

interface Error

stream:

(parameter) stream: SSEStreamingApi

SSEStreamingApi) =>

class SSEStreamingApi

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

): Response => {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

const { readable,

const readable: ReadableStream<any> MDN Reference

writable } = new

const writable: WritableStream<any> MDN Reference

TransformStream()          

var TransformStream: new <any, any>(transformer?: Transformer<any, any> | undefined, writableStrategy?: QueuingStrategy<any> | undefined, readableStrategy?: QueuingStrategy<any> | undefined) => TransformStream<...> MDN Reference

const stream = new

const stream: SSEStreamingApi

SSEStreamingApi

constructor SSEStreamingApi(writable: WritableStream, readable: ReadableStream): SSEStreamingApi

(writable,

const writable: WritableStream<any> MDN Reference

readable)          

const readable: ReadableStream<any> MDN Reference

// bun does not cancel response stream when request is canceled, so detect abort by signal c

(parameter) c: Context<any, any, {}>

.req

(property) Context<any, any, {}>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.raw

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

.signal

(property) Request.signal: AbortSignal Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.

MDN Reference

.addEventListener('abort', () => {          

(method) AbortSignal.addEventListener<"abort">(type: "abort", listener: (this: AbortSignal, ev: Event) => any, options?: boolean | AddEventListenerOptions): void (+1 overload) Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

MDN Reference

if (!stream

const stream: SSEStreamingApi

.closed) {          

(property) StreamingApi.closed: boolean Whether the stream has been closed normally.

stream

const stream: SSEStreamingApi

.abort()          

(method) StreamingApi.abort(): void Abort the stream. You can call this method when stream is aborted by external event.

} }) // in bun, `c` is destroyed when the request is returned, so hold it until the end of streaming contextStash

const contextStash: WeakMap<ReadableStream<any>, Context<any, any, {}>>

.set

(method) WeakMap<ReadableStream<any>, Context<any, any, {}>>.set(key: ReadableStream<any>, value: Context<any, any, {}>): WeakMap<ReadableStream<any>, Context<any, any, {}>> Adds a new element with a specified key and value.

@param key — Must be an object or symbol.

(stream

const stream: SSEStreamingApi

.responseReadable,

(property) StreamingApi.responseReadable: ReadableStream<any>

c)          

(parameter) c: Context<any, any, {}>

c

(parameter) c: Context<any, any, {}>

.header('Transfer-Encoding', 'chunked')          

(property) Context<any, any, {}>.header: SetHeaders (name: ResponseHeader, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

(parameter) c: Context<any, any, {}>

.header('Content-Type', 'text/event-stream')          

(property) Context<any, any, {}>.header: SetHeaders (name: ResponseHeader, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

(parameter) c: Context<any, any, {}>

.header('Cache-Control', 'no-cache')          

(property) Context<any, any, {}>.header: SetHeaders (name: ResponseHeader, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

(parameter) c: Context<any, any, {}>

.header('Connection', 'keep-alive')          

(property) Context<any, any, {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

run

const run: (stream: SSEStreamingApi, cb: (stream: SSEStreamingApi) => Promise<void>, onError?: (e: Error, stream: SSEStreamingApi) => Promise<void>) => Promise<void>

(stream,

const stream: SSEStreamingApi

cb,

(parameter) cb: (stream: SSEStreamingApi) => Promise<void>

onError)          

(parameter) onError: ((e: Error, stream: SSEStreamingApi) => Promise<void>) | undefined

return c

(parameter) c: Context<any, any, {}>

.newResponse

(property) Context<any, any, {}>.newResponse: NewResponse (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

(stream

const stream: SSEStreamingApi

.responseReadable)          

(property) StreamingApi.responseReadable: ReadableStream<any>

}
src/helper/streaming/stream.test.ts
            
                import { Context } from '../../context'
                import { stream } from '.'
                
                describe('Basic Streaming Helper', () => {
                  const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

let c:

let c: Context<any, any, {}>

Context          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

beforeEach(() => { c = new

let c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

}) it('Check stream Response', async () => { const res =

const res: Response

stream

(alias) stream(c: Context, cb: (stream: StreamingApi) => Promise<void>, onError?: (e: Error, stream: StreamingApi) => Promise<void>): Response import stream

(c, async

let c: Context<any, any, {}>

(stream) => {          

(parameter) stream: StreamingApi

for (let i = 0;

let i: number

i < 3;

let i: number

i++) {          

let i: number

await stream

(parameter) stream: StreamingApi

.write(new

(method) StreamingApi.write(input: Uint8Array | string): Promise<StreamingApi>

Uint8Array(

var Uint8Array: Uint8ArrayConstructor new (elements: Iterable<number>) => Uint8Array (+4 overloads)

[i]))          

let i: number

await stream

(parameter) stream: StreamingApi

.sleep(1)          

(method) StreamingApi.sleep(ms: number): Promise<unknown>

} }) if (!res

const res: Response

.body) {          

(property) Body.body: ReadableStream<Uint8Array> | null MDN Reference

throw new Error('Body is null')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

} const reader =

const reader: ReadableStreamDefaultReader<Uint8Array>

res

const res: Response

.body

(property) Body.body: ReadableStream<Uint8Array> MDN Reference

.getReader()          

(method) ReadableStream<Uint8Array>.getReader(): ReadableStreamDefaultReader<Uint8Array> (+2 overloads) MDN Reference

for (let i = 0;

let i: number

i < 3;

let i: number

i++) {          

let i: number

const { value } = await

const value: Uint8Array | undefined

reader

const reader: ReadableStreamDefaultReader<Uint8Array>

.read()          

(method) ReadableStreamDefaultReader<Uint8Array>.read(): Promise<ReadableStreamReadResult<Uint8Array>> MDN Reference

expect(value).toEqual(new

const value: Uint8Array | undefined

Uint8Array(

var Uint8Array: Uint8ArrayConstructor new (elements: Iterable<number>) => Uint8Array (+4 overloads)

[i]))          

let i: number

} }) it('Check stream Response if aborted by client', async () => { let aborted = false          

let aborted: boolean

const res =

const res: Response

stream

(alias) stream(c: Context, cb: (stream: StreamingApi) => Promise<void>, onError?: (e: Error, stream: StreamingApi) => Promise<void>): Response import stream

(c, async

let c: Context<any, any, {}>

(stream) => {          

(parameter) stream: StreamingApi

stream

(parameter) stream: StreamingApi

.onAbort(() => {          

(method) StreamingApi.onAbort(listener: () => void | Promise<void>): void

aborted = true          

let aborted: boolean

}) for (let i = 0;

let i: number

i < 3;

let i: number

i++) {          

let i: number

await stream

(parameter) stream: StreamingApi

.write(new

(method) StreamingApi.write(input: Uint8Array | string): Promise<StreamingApi>

Uint8Array(

var Uint8Array: Uint8ArrayConstructor new (elements: Iterable<number>) => Uint8Array (+4 overloads)

[i]))          

let i: number

await stream

(parameter) stream: StreamingApi

.sleep(1)          

(method) StreamingApi.sleep(ms: number): Promise<unknown>

} }) if (!res

const res: Response

.body) {          

(property) Body.body: ReadableStream<Uint8Array> | null MDN Reference

throw new Error('Body is null')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

} const reader =

const reader: ReadableStreamDefaultReader<Uint8Array>

res

const res: Response

.body

(property) Body.body: ReadableStream<Uint8Array> MDN Reference

.getReader()          

(method) ReadableStream<Uint8Array>.getReader(): ReadableStreamDefaultReader<Uint8Array> (+2 overloads) MDN Reference

const { value } = await

const value: Uint8Array | undefined

reader

const reader: ReadableStreamDefaultReader<Uint8Array>

.read()          

(method) ReadableStreamDefaultReader<Uint8Array>.read(): Promise<ReadableStreamReadResult<Uint8Array>> MDN Reference

expect(value).toEqual(new

const value: Uint8Array | undefined

Uint8Array([0]))          

var Uint8Array: Uint8ArrayConstructor new (elements: Iterable<number>) => Uint8Array (+4 overloads)

reader

const reader: ReadableStreamDefaultReader<Uint8Array>

.cancel()          

(method) ReadableStreamGenericReader.cancel(reason?: any): Promise<void> MDN Reference

expect(aborted).toBeTruthy()          

let aborted: false

}) it('Check stream Response if aborted by abort signal', async () => { const ac = new

const ac: AbortController

AbortController()          

var AbortController: new () => AbortController A controller object that allows you to abort one or more DOM requests as and when desired.

MDN Reference

const req = new

const req: Request

Request('http://localhost/', {

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

signal:

(property) RequestInit.signal?: AbortSignal | null | undefined An AbortSignal to set request's signal.

ac

const ac: AbortController

.signal })          

(property) AbortController.signal: AbortSignal Returns the AbortSignal object associated with this object.

MDN Reference

const c = new

const c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

let aborted = false          

let aborted: boolean

const res =

const res: Response

stream

(alias) stream(c: Context, cb: (stream: StreamingApi) => Promise<void>, onError?: (e: Error, stream: StreamingApi) => Promise<void>): Response import stream

(c, async

const c: Context<any, any, {}>

(stream) => {          

(parameter) stream: StreamingApi

stream

(parameter) stream: StreamingApi

.onAbort(() => {          

(method) StreamingApi.onAbort(listener: () => void | Promise<void>): void

aborted = true          

let aborted: boolean

}) for (let i = 0;

let i: number

i < 3;

let i: number

i++) {          

let i: number

await stream

(parameter) stream: StreamingApi

.write(new

(method) StreamingApi.write(input: Uint8Array | string): Promise<StreamingApi>

Uint8Array(

var Uint8Array: Uint8ArrayConstructor new (elements: Iterable<number>) => Uint8Array (+4 overloads)

[i]))          

let i: number

await stream

(parameter) stream: StreamingApi

.sleep(1)          

(method) StreamingApi.sleep(ms: number): Promise<unknown>

} }) if (!res

const res: Response

.body) {          

(property) Body.body: ReadableStream<Uint8Array> | null MDN Reference

throw new Error('Body is null')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

} const reader =

const reader: ReadableStreamDefaultReader<Uint8Array>

res

const res: Response

.body

(property) Body.body: ReadableStream<Uint8Array> MDN Reference

.getReader()          

(method) ReadableStream<Uint8Array>.getReader(): ReadableStreamDefaultReader<Uint8Array> (+2 overloads) MDN Reference

const { value } = await

const value: Uint8Array | undefined

reader

const reader: ReadableStreamDefaultReader<Uint8Array>

.read()          

(method) ReadableStreamDefaultReader<Uint8Array>.read(): Promise<ReadableStreamReadResult<Uint8Array>> MDN Reference

expect(value).toEqual(new

const value: Uint8Array | undefined

Uint8Array([0]))          

var Uint8Array: Uint8ArrayConstructor new (elements: Iterable<number>) => Uint8Array (+4 overloads)

ac

const ac: AbortController

.abort()          

(method) AbortController.abort(reason?: any): void Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.

MDN Reference

expect(aborted).toBeTruthy()          

let aborted: false

}) it('Check stream Response if error occurred', async () => { const onError = vi.fn()          

const onError: any

const res =

const res: Response

stream(          

(alias) stream(c: Context, cb: (stream: StreamingApi) => Promise<void>, onError?: (e: Error, stream: StreamingApi) => Promise<void>): Response import stream

c,          

let c: Context<any, any, {}>

async () => { throw new Error('error')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}, onError          

const onError: any

) if (!res

const res: Response

.body) {          

(property) Body.body: ReadableStream<Uint8Array> | null MDN Reference

throw new Error('Body is null')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

} const reader =

const reader: ReadableStreamDefaultReader<Uint8Array>

res

const res: Response

.body

(property) Body.body: ReadableStream<Uint8Array> MDN Reference

.getReader()          

(method) ReadableStream<Uint8Array>.getReader(): ReadableStreamDefaultReader<Uint8Array> (+2 overloads) MDN Reference

const { value } = await

const value: Uint8Array | undefined

reader

const reader: ReadableStreamDefaultReader<Uint8Array>

.read()          

(method) ReadableStreamDefaultReader<Uint8Array>.read(): Promise<ReadableStreamReadResult<Uint8Array>> MDN Reference

expect(value).toBeUndefined()          

const value: Uint8Array | undefined

expect(onError).toBeCalledTimes(1)          

const onError: any

expect(onError).toBeCalledWith(new

const onError: any

Error('error'), expect.anything()) // 2nd argument is StreamingApi instance          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) })
src/helper/streaming/stream.ts
            
                import type { Context } from '../../context'
                import { StreamingApi } from '../../utils/stream'
                
                const contextStash:

const contextStash: WeakMap<ReadableStream<any>, Context<any, any, {}>>

WeakMap

interface WeakMap<K extends WeakKey, V>

<ReadableStream,

interface ReadableStream<R = any> This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.

MDN Reference

Context> = new

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

WeakMap

var WeakMap: WeakMapConstructor new <ReadableStream<any>, Context<any, any, {}>>(entries?: readonly (readonly [ReadableStream<any>, Context<any, any, {}>])[] | null | undefined) => WeakMap<...> (+1 overload)

<ReadableStream,

interface ReadableStream<R = any> This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.

MDN Reference

Context>()          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

export const stream = (          

const stream: (c: Context, cb: (stream: StreamingApi) => Promise<void>, onError?: (e: Error, stream: StreamingApi) => Promise<void>) => Response

c:

(parameter) c: Context<any, any, {}>

Context,          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

cb:

(parameter) cb: (stream: StreamingApi) => Promise<void>

(stream:

(parameter) stream: StreamingApi

StreamingApi) =>

(alias) class StreamingApi import StreamingApi

@module — Stream utility.

Promise,          

interface Promise<T> Represents the completion of an asynchronous operation

onError?:

(parameter) onError: ((e: Error, stream: StreamingApi) => Promise<void>) | undefined

(e:

(parameter) e: Error

Error,

interface Error

stream:

(parameter) stream: StreamingApi

StreamingApi) =>

(alias) class StreamingApi import StreamingApi

@module — Stream utility.

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

): Response => {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

const { readable,

const readable: ReadableStream<any> MDN Reference

writable } = new

const writable: WritableStream<any> MDN Reference

TransformStream()          

var TransformStream: new <any, any>(transformer?: Transformer<any, any> | undefined, writableStrategy?: QueuingStrategy<any> | undefined, readableStrategy?: QueuingStrategy<any> | undefined) => TransformStream<...> MDN Reference

const stream = new

const stream: StreamingApi

StreamingApi

(alias) new StreamingApi(writable: WritableStream, _readable: ReadableStream): StreamingApi import StreamingApi

@module — Stream utility.

(writable,

const writable: WritableStream<any> MDN Reference

readable)          

const readable: ReadableStream<any> MDN Reference

// bun does not cancel response stream when request is canceled, so detect abort by signal c

(parameter) c: Context<any, any, {}>

.req

(property) Context<any, any, {}>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.raw

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

.signal

(property) Request.signal: AbortSignal Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.

MDN Reference

.addEventListener('abort', () => {          

(method) AbortSignal.addEventListener<"abort">(type: "abort", listener: (this: AbortSignal, ev: Event) => any, options?: boolean | AddEventListenerOptions): void (+1 overload) Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.

The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.

When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.

When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.

When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.

If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.

The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.

MDN Reference

if (!stream

const stream: StreamingApi

.closed) {          

(property) StreamingApi.closed: boolean Whether the stream has been closed normally.

stream

const stream: StreamingApi

.abort()          

(method) StreamingApi.abort(): void Abort the stream. You can call this method when stream is aborted by external event.

} }) // in bun, `c` is destroyed when the request is returned, so hold it until the end of streaming contextStash

const contextStash: WeakMap<ReadableStream<any>, Context<any, any, {}>>

.set

(method) WeakMap<ReadableStream<any>, Context<any, any, {}>>.set(key: ReadableStream<any>, value: Context<any, any, {}>): WeakMap<ReadableStream<any>, Context<any, any, {}>> Adds a new element with a specified key and value.

@param key — Must be an object or symbol.

(stream

const stream: StreamingApi

.responseReadable,

(property) StreamingApi.responseReadable: ReadableStream<any>

c)          

(parameter) c: Context<any, any, {}>

;(async () => { try { await cb

(parameter) cb: (stream: StreamingApi) => Promise<void>

(stream)          

const stream: StreamingApi

} catch (e) {          

(local var) e: unknown

if (e instanceof

(local var) e: unknown

Error &&

var Error: ErrorConstructor

onError) {          

(parameter) onError: ((e: Error, stream: StreamingApi) => Promise<void>) | undefined

await onError

(parameter) onError: (e: Error, stream: StreamingApi) => Promise<void>

(e,

(local var) e: Error

stream)          

const stream: StreamingApi

} else { console

var console: Console

.error

(method) Console.error(...data: any[]): void MDN Reference

(e)          

(local var) e: unknown

} } finally { stream

const stream: StreamingApi

.close()          

(method) StreamingApi.close(): Promise<void>

} })() return c

(parameter) c: Context<any, any, {}>

.newResponse

(property) Context<any, any, {}>.newResponse: NewResponse (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

(stream

const stream: StreamingApi

.responseReadable)          

(property) StreamingApi.responseReadable: ReadableStream<any>

}
src/helper/streaming/text.test.ts
            
                import { Context } from '../../context'
                import { streamText } from '.'
                
                describe('Text Streaming Helper', () => {
                  const req = new

const req: Request

Request('http://localhost/')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

let c:

let c: Context<any, any, {}>

Context          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

beforeEach(() => { c = new

let c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(req)          

const req: Request

}) it('Check streamText Response', async () => { const res =

const res: Response

streamText

(alias) streamText(c: Context, cb: (stream: StreamingApi) => Promise<void>, onError?: (e: Error, stream: StreamingApi) => Promise<void>): Response import streamText

(c, async

let c: Context<any, any, {}>

(stream) => {          

(parameter) stream: StreamingApi

for (let i = 0;

let i: number

i < 3;

let i: number

i++) {          

let i: number

await stream

(parameter) stream: StreamingApi

.write(`$

(method) StreamingApi.write(input: Uint8Array | string): Promise<StreamingApi>

{i}`)          

let i: number

await stream

(parameter) stream: StreamingApi

.sleep(1)          

(method) StreamingApi.sleep(ms: number): Promise<unknown>

} }) expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('content-type')).toMatch(/^text\/plain/)          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-content-type-options')).toBe('nosniff')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('transfer-encoding')).toBe('chunked')          

(method) Headers.get(name: string): string | null MDN Reference

if (!res

const res: Response

.body) {          

(property) Body.body: ReadableStream<Uint8Array> | null MDN Reference

throw new Error('Body is null')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

} const reader =

const reader: ReadableStreamDefaultReader<Uint8Array>

res

const res: Response

.body

(property) Body.body: ReadableStream<Uint8Array> MDN Reference

.getReader()          

(method) ReadableStream<Uint8Array>.getReader(): ReadableStreamDefaultReader<Uint8Array> (+2 overloads) MDN Reference

const decoder = new

const decoder: TextDecoder

TextDecoder()          

var TextDecoder: new (label?: string, options?: TextDecoderOptions) => TextDecoder A decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays.

MDN Reference

for (let i = 0;

let i: number

i < 3;

let i: number

i++) {          

let i: number

const { value } = await

const value: Uint8Array | undefined

reader

const reader: ReadableStreamDefaultReader<Uint8Array>

.read()          

(method) ReadableStreamDefaultReader<Uint8Array>.read(): Promise<ReadableStreamReadResult<Uint8Array>> MDN Reference

expect(decoder

const decoder: TextDecoder

.decode

(method) TextDecoder.decode(input?: AllowSharedBufferSource, options?: TextDecodeOptions): string Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented input. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments.

var string = "", decoder = new TextDecoder(encoding), buffer; while(buffer = next_chunk()) { string += decoder.decode(buffer, {stream:true}); } string += decoder.decode(); // end-of-queue

If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError.

MDN Reference

(value)).toEqual(`$

const value: Uint8Array | undefined

{i}`)          

let i: number

} }) })
src/helper/streaming/text.ts
            
                import type { Context } from '../../context'
                import { TEXT_PLAIN } from '../../context'
                import type { StreamingApi } from '../../utils/stream'
                import { stream } from './'
                
                export const streamText = (          

const streamText: (c: Context, cb: (stream: StreamingApi) => Promise<void>, onError?: (e: Error, stream: StreamingApi) => Promise<void>) => Response

c:

(parameter) c: Context<any, any, {}>

Context,          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

cb:

(parameter) cb: (stream: StreamingApi) => Promise<void>

(stream:

(parameter) stream: StreamingApi

StreamingApi) =>

(alias) class StreamingApi import StreamingApi

@module — Stream utility.

Promise,          

interface Promise<T> Represents the completion of an asynchronous operation

onError?:

(parameter) onError: ((e: Error, stream: StreamingApi) => Promise<void>) | undefined

(e:

(parameter) e: Error

Error,

interface Error

stream:

(parameter) stream: StreamingApi

StreamingApi) =>

(alias) class StreamingApi import StreamingApi

@module — Stream utility.

Promise          

interface Promise<T> Represents the completion of an asynchronous operation

): Response => {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

c

(parameter) c: Context<any, any, {}>

.header('Content-Type',

(property) Context<any, any, {}>.header: SetHeaders (name: ResponseHeader, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

TEXT_PLAIN)          

(alias) const TEXT_PLAIN: "text/plain; charset=UTF-8" import TEXT_PLAIN

c

(parameter) c: Context<any, any, {}>

.header('X-Content-Type-Options', 'nosniff')          

(property) Context<any, any, {}>.header: SetHeaders (name: ResponseHeader, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

(parameter) c: Context<any, any, {}>

.header('Transfer-Encoding', 'chunked')          

(property) Context<any, any, {}>.header: SetHeaders (name: ResponseHeader, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

return stream

(alias) stream(c: Context, cb: (stream: StreamingApi) => Promise<void>, onError?: (e: Error, stream: StreamingApi) => Promise<void>): Response import stream

(c,

(parameter) c: Context<any, any, {}>

cb,

(parameter) cb: (stream: StreamingApi) => Promise<void>

onError)          

(parameter) onError: ((e: Error, stream: StreamingApi) => Promise<void>) | undefined

}
src/helper/testing/index.test.ts
            
                import { Hono } from '../../hono'
                import { testClient } from '.'
                
                describe('hono testClient', () => {
                  it('Should return the correct search result', async () => {
                    const app = new

const app: Hono<BlankEnv, { "/search": { $get: { input: {}; output: { hello: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/search',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/search", "/search", JSONRespondReturn<{ hello: string; }, StatusCode>, BlankInput, BlankEnv>(path: "/search", handler: H<BlankEnv, "/search", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/search", BlankInput>

c

(parameter) c: Context<BlankEnv, "/search", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ hello: string; }, StatusCode>(object: { hello: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ hello: string; }, StatusCode> (+1 overload)

hello: 'world' }))          

(property) hello: string

const res = await

const res: ClientResponse<{ hello: string; }, StatusCode, "json">

testClient

(alias) testClient<Hono<BlankEnv, { "/search": { $get: { input: {}; output: { hello: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(app: Hono<BlankEnv, { "/search": { $get: { input: {}; output: { hello: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">, Env?: unknown, executionCtx?: ExecutionContext): { ...; } import testClient

(app).search.$get()          

const app: Hono<BlankEnv, { "/search": { $get: { input: {}; output: { hello: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

expect(await res

const res: ClientResponse<{ hello: string; }, StatusCode, "json">

.json()).toEqual({

(method) ClientResponse<{ hello: string; }, StatusCode, "json">.json(): Promise<{ hello: string; }> MDN Reference

hello: 'world' })          

(property) hello: string

}) it('Should return the correct environment variables value', async () => { type Bindings = {

type Bindings = { hello: string; }

hello: string }          

(property) hello: string

const app = new

const app: Hono<{ Bindings: Bindings; }, { "/search": { $get: { input: {}; output: { hello: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono<{

(alias) new Hono<{ Bindings: Bindings; }, BlankSchema, "/">(options?: HonoOptions<{ Bindings: Bindings; }>): Hono<{ Bindings: Bindings; }, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

Bindings:

(property) Bindings: Bindings

Bindings }>()

type Bindings = { hello: string; }

.get('/search',

(property) Hono<{ Bindings: Bindings; }, BlankSchema, "/">.get: HandlerInterface <"/search", "/search", JSONRespondReturn<{ hello: string; }, StatusCode>, BlankInput, { Bindings: Bindings; }>(path: "/search", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<{ Bindings: Bindings; }, "/search", BlankInput>

return c

(parameter) c: Context<{ Bindings: Bindings; }, "/search", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ hello: string; }, StatusCode>(object: { hello: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ hello: string; }, StatusCode> (+1 overload)

hello:

(property) hello: string

c

(parameter) c: Context<{ Bindings: Bindings; }, "/search", BlankInput>

.env

(property) Context<{ Bindings: Bindings; }, "/search", BlankInput>.env: Bindings .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

.hello })          

(property) hello: string

}) const res = await

const res: ClientResponse<{ hello: string; }, StatusCode, "json">

testClient

(alias) testClient<Hono<{ Bindings: Bindings; }, { "/search": { $get: { input: {}; output: { hello: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(app: Hono<{ Bindings: Bindings; }, { ...; }, "/">, Env?: {} | ... 1 more ... | undefined, executionCtx?: ExecutionContext): { ...; } import testClient

(app, {

const app: Hono<{ Bindings: Bindings; }, { "/search": { $get: { input: {}; output: { hello: string; }; outputFormat: "json"; status: StatusCode; }; }; }, "/">

hello: 'world' }).search.$get()          

(property) hello: string

expect(await res

const res: ClientResponse<{ hello: string; }, StatusCode, "json">

.json()).toEqual({

(method) ClientResponse<{ hello: string; }, StatusCode, "json">.json(): Promise<{ hello: string; }> MDN Reference

hello: 'world' })          

(property) hello: string

}) it('Should return a correct URL with out throwing an error', async () => { const app = new

const app: Hono<BlankEnv, { "/abc": { $get: { input: {}; output: 0; outputFormat: "json"; status: StatusCode; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/abc',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/abc", "/abc", JSONRespondReturn<0, StatusCode>, BlankInput, BlankEnv>(path: "/abc", handler: H<BlankEnv, "/abc", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/abc", BlankInput>

c

(parameter) c: Context<BlankEnv, "/abc", BlankInput>

.json(0))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <0, StatusCode>(object: 0, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<0, StatusCode> (+1 overload)

const url =

const url: URL

testClient

(alias) testClient<Hono<BlankEnv, { "/abc": { $get: { input: {}; output: 0; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(app: Hono<BlankEnv, { "/abc": { $get: { input: {}; output: 0; outputFormat: "json"; status: StatusCode; }; }; }, "/">, Env?: unknown, executionCtx?: ExecutionContext): { ...; } import testClient

(app).abc

const app: Hono<BlankEnv, { "/abc": { $get: { input: {}; output: 0; outputFormat: "json"; status: StatusCode; }; }; }, "/">

.$url()          

(property) $url: (arg?: {} | undefined) => URL

expect(url

const url: URL

.pathname).toBe('/abc')          

(property) URL.pathname: string MDN Reference

}) it('Should not throw an error with $ws()', async () => { vi.stubGlobal('WebSocket', class {}) const app = new

const app: Hono<BlankEnv, { "/ws": { $get: { input: {}; output: "Fake response of a WebSocket"; outputFormat: "text"; status: StatusCode; }; }; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.get('/ws',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/ws", "/ws", Response & TypedResponse<"Fake response of a WebSocket", StatusCode, "text">, BlankInput, BlankEnv>(path: "/ws", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/ws", BlankInput>

c

(parameter) c: Context<BlankEnv, "/ws", BlankInput>

.text('Fake response of a WebSocket'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Fake response of a WebSocket", StatusCode>(text: "Fake response of a WebSocket", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

// @ts-expect-error $ws is not typed correctly expect(() => testClient

(alias) testClient<Hono<BlankEnv, { "/ws": { $get: { input: {}; output: "Fake response of a WebSocket"; outputFormat: "text"; status: StatusCode; }; }; }, "/">>(app: Hono<BlankEnv, { ...; }, "/">, Env?: unknown, executionCtx?: ExecutionContext): { ...; } import testClient

(app).ws.$ws()).not.toThrowError()          

const app: Hono<BlankEnv, { "/ws": { $get: { input: {}; output: "Fake response of a WebSocket"; outputFormat: "text"; status: StatusCode; }; }; }, "/">

}) })
src/helper/testing/index.ts
            
                /**
                 * @module
                 * Testing Helper for Hono.
                 */
                
                import { hc } from '../../client'
                import type { Client } from '../../client/types'
                import type { ExecutionContext } from '../../context'
                import type { Hono } from '../../hono'
                import type { Schema } from '../../types'
                import type { UnionToIntersection } from '../../utils/types'
                
                type ExtractEnv

type ExtractEnv<T> = T extends Hono<infer E extends Env, Schema, string> ? E : never

<T> =

(type parameter) T in type ExtractEnv<T>

T extends

(type parameter) T in type ExtractEnv<T>

Hono

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

E,

(type parameter) E

Schema, string> ?

(alias) type Schema = { [Path: string]: { [Method: `$${Lowercase<string>}`]: Endpoint; }; } import Schema

E : never          

(type parameter) E

// eslint-disable-next-line @typescript-eslint/no-explicit-any export const testClient =

const testClient: <T extends Hono<any, Schema, string>>(app: T, Env?: ExtractEnv<T>["Bindings"] | {}, executionCtx?: ExecutionContext) => UnionToIntersection<Client<T>>

<T extends

(type parameter) T in <T extends Hono<any, Schema, string>>(app: T, Env?: ExtractEnv<T>["Bindings"] | {}, executionCtx?: ExecutionContext): UnionToIntersection<Client<T>>

Hono

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

Schema, string>>(          

(alias) type Schema = { [Path: string]: { [Method: `$${Lowercase<string>}`]: Endpoint; }; } import Schema

app:

(parameter) app: T extends Hono<any, Schema, string>

T,          

(type parameter) T in <T extends Hono<any, Schema, string>>(app: T, Env?: ExtractEnv<T>["Bindings"] | {}, executionCtx?: ExecutionContext): UnionToIntersection<Client<T>>

Env?:

(parameter) Env: {} | ExtractEnv<T>["Bindings"] | undefined

ExtractEnv

type ExtractEnv<T> = T extends Hono<infer E extends Env, Schema, string> ? E : never

<T>['Bindings'] | {},          

(type parameter) T in <T extends Hono<any, Schema, string>>(app: T, Env?: ExtractEnv<T>["Bindings"] | {}, executionCtx?: ExecutionContext): UnionToIntersection<Client<T>>

executionCtx?:

(parameter) executionCtx: ExecutionContext | undefined

ExecutionContext          

(alias) interface ExecutionContext import ExecutionContext Interface for the execution context in a web worker or similar environment.

): UnionToIntersection

(alias) type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never import UnionToIntersection

<Client

(alias) type Client<T> = T extends Hono<any, infer S extends Schema, any> ? S extends Record<infer K extends string | number | symbol, Schema> ? K extends string ? PathToChain<...> : never : never : never import Client

<T>> => {          

(type parameter) T in <T extends Hono<any, Schema, string>>(app: T, Env?: ExtractEnv<T>["Bindings"] | {}, executionCtx?: ExecutionContext): UnionToIntersection<Client<T>>

const customFetch =

const customFetch: (input: RequestInfo | URL, init?: RequestInit) => Response | Promise<Response>

(input:

(parameter) input: RequestInfo | URL

RequestInfo |

type RequestInfo = string | Request

URL,

interface URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

init?:

(parameter) init: RequestInit | undefined

RequestInit) => {          

interface RequestInit

return app

(parameter) app: T extends Hono<any, Schema, string>

.request

(property) Hono<any, Schema, string>.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(input,

(parameter) input: RequestInfo | URL

init,

(parameter) init: RequestInit | undefined

Env,

(parameter) Env: {} | ExtractEnv<T>["Bindings"] | undefined

executionCtx)          

(parameter) executionCtx: ExecutionContext | undefined

} return hc

(alias) hc<T>(baseUrl: string, options?: ClientRequestOptions): UnionToIntersection<Client<T>> import hc

app>('http://localhost', {

(parameter) app: T extends Hono<any, Schema, string>

fetch:

(property) fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) | ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response>) | undefined

customFetch })          

const customFetch: (input: RequestInfo | URL, init?: RequestInit) => Response | Promise<Response>

}
src/helper/websocket/index.test.ts
            
                import { createWSMessageEvent } from '.'
                
                describe('`createWSMessageEvent`', () => {
                  it('Should `createWSMessageEvent` is working for string', () => {
                    const randomString =

const randomString: string

Math

var Math: Math An intrinsic object that provides basic mathematics functionality and constants.

.random()

(method) Math.random(): number Returns a pseudorandom number between 0 and 1.

.toString()          

(method) Number.toString(radix?: number): string Returns a string representation of an object.

@param radix — Specifies a radix for converting numeric values to strings. This value is only used for numbers.

const event =

const event: MessageEvent<WSMessageReceive>

createWSMessageEvent

(alias) createWSMessageEvent(source: WSMessageReceive): MessageEvent<WSMessageReceive> import createWSMessageEvent

(randomString)          

const randomString: string

expect(event

const event: MessageEvent<WSMessageReceive>

.data).toBe

(property) MessageEvent<WSMessageReceive>.data: WSMessageReceive Returns the data of the message.

MDN Reference

(randomString)          

const randomString: string

}) it('Should `createWSMessageEvent` type is `message`', () => { const event =

const event: MessageEvent<WSMessageReceive>

createWSMessageEvent('')          

(alias) createWSMessageEvent(source: WSMessageReceive): MessageEvent<WSMessageReceive> import createWSMessageEvent

expect(event

const event: MessageEvent<WSMessageReceive>

.type).toBe('message')          

(property) Event.type: string Returns the type of event, e.g. "click", "hashchange", or "submit".

MDN Reference

}) })
src/helper/websocket/index.ts
            
                /**
                 * @module
                 * WebSocket Helper for Hono.
                 */
                
                /* eslint-disable @typescript-eslint/no-explicit-any */
                import type { Context } from '../../context'
                import type { MiddlewareHandler } from '../../types'
                
                /**
                 * WebSocket Event Listeners type
                 */
                export interface WSEvents

interface WSEvents<T = unknown> WebSocket Event Listeners type

<T = unknown> {          

(type parameter) T in WSEvents<T = unknown>

onOpen?:

(property) WSEvents<T = unknown>.onOpen?: ((evt: Event, ws: WSContext<T>) => void) | undefined

(evt:

(parameter) evt: Event

Event,

interface Event An event which takes place in the DOM.

MDN Reference

ws:

(parameter) ws: WSContext<T>

WSContext

type WSContext<T = unknown> = { send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void; raw?: T; binaryType: BinaryType; readyState: WSReadyState; url: URL | null; protocol: string | null; close(code?: number, reason?: string): void; }

<T>) => void          

(type parameter) T in WSEvents<T = unknown>

onMessage?:

(property) WSEvents<T = unknown>.onMessage?: ((evt: MessageEvent<WSMessageReceive>, ws: WSContext<T>) => void) | undefined

(evt:

(parameter) evt: MessageEvent<WSMessageReceive>

MessageEvent

interface MessageEvent<T = any> A message received by a target object.

MDN Reference

<WSMessageReceive>,

type WSMessageReceive = string | Blob | ArrayBufferLike

ws:

(parameter) ws: WSContext<T>

WSContext

type WSContext<T = unknown> = { send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void; raw?: T; binaryType: BinaryType; readyState: WSReadyState; url: URL | null; protocol: string | null; close(code?: number, reason?: string): void; }

<T>) => void          

(type parameter) T in WSEvents<T = unknown>

onClose?:

(property) WSEvents<T = unknown>.onClose?: ((evt: CloseEvent, ws: WSContext<T>) => void) | undefined

(evt:

(parameter) evt: CloseEvent

CloseEvent,

interface CloseEvent A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.

MDN Reference

ws:

(parameter) ws: WSContext<T>

WSContext

type WSContext<T = unknown> = { send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void; raw?: T; binaryType: BinaryType; readyState: WSReadyState; url: URL | null; protocol: string | null; close(code?: number, reason?: string): void; }

<T>) => void          

(type parameter) T in WSEvents<T = unknown>

onError?:

(property) WSEvents<T = unknown>.onError?: ((evt: Event, ws: WSContext<T>) => void) | undefined

(evt:

(parameter) evt: Event

Event,

interface Event An event which takes place in the DOM.

MDN Reference

ws:

(parameter) ws: WSContext<T>

WSContext

type WSContext<T = unknown> = { send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void; raw?: T; binaryType: BinaryType; readyState: WSReadyState; url: URL | null; protocol: string | null; close(code?: number, reason?: string): void; }

<T>) => void          

(type parameter) T in WSEvents<T = unknown>

} /** * Upgrade WebSocket Type */ export type UpgradeWebSocket

type UpgradeWebSocket<T = unknown, U = any> = (createEvents: (c: Context) => WSEvents<T> | Promise<WSEvents<T>>, options?: U) => MiddlewareHandler<any, string, { outputFormat: "ws"; }> Upgrade WebSocket Type

<T = unknown,

(type parameter) T in type UpgradeWebSocket<T = unknown, U = any>

U = any> = (          

(type parameter) U in type UpgradeWebSocket<T = unknown, U = any>

createEvents:

(parameter) createEvents: (c: Context) => WSEvents<T> | Promise<WSEvents<T>>

(c:

(parameter) c: Context<any, any, {}>

Context) =>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

WSEvents

interface WSEvents<T = unknown> WebSocket Event Listeners type

<T> |

(type parameter) T in type UpgradeWebSocket<T = unknown, U = any>

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<WSEvents

interface WSEvents<T = unknown> WebSocket Event Listeners type

<T>>,          

(type parameter) T in type UpgradeWebSocket<T = unknown, U = any>

options?:

(parameter) options: U | undefined

U          

(type parameter) U in type UpgradeWebSocket<T = unknown, U = any>

) => MiddlewareHandler<          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

any, string, { outputFormat: 'ws'          

(property) outputFormat: "ws"

} > export type WSReadyState = 0 | 1 | 2 | 3          

type WSReadyState = 0 | 2 | 1 | 3

export type WSContext

type WSContext<T = unknown> = { send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void; raw?: T; binaryType: BinaryType; readyState: WSReadyState; url: URL | null; protocol: string | null; close(code?: number, reason?: string): void; }

<T = unknown> = {          

(type parameter) T in type WSContext<T = unknown>

send(          

(method) send(source: string | ArrayBuffer | Uint8Array, options?: { compress: boolean; }): void

source: string |

(parameter) source: string | ArrayBuffer | Uint8Array

ArrayBuffer |

interface ArrayBuffer Represents a raw buffer of binary data, which is used to store data for the different typed arrays. ArrayBuffers cannot be read from or written to directly, but can be passed to a typed array or DataView Object to interpret the raw buffer as needed.

Uint8Array,          

interface Uint8Array A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.

options?: {          

(parameter) options: { compress: boolean; } | undefined

compress: boolean          

(property) compress: boolean

} ): void raw?:

(property) raw?: T | undefined

T          

(type parameter) T in type WSContext<T = unknown>

binaryType:

(property) binaryType: BinaryType

BinaryType          

type BinaryType = "blob" | "arraybuffer"

readyState:

(property) readyState: WSReadyState

WSReadyState          

type WSReadyState = 0 | 2 | 1 | 3

url:

(property) url: URL | null

URL | null          

interface URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

protocol: string | null          

(property) protocol: string | null

close

(method) close(code?: number, reason?: string): void

(code?: number,

(parameter) code: number | undefined

reason?: string): void          

(parameter) reason: string | undefined

} export type WSMessageReceive = string |

type WSMessageReceive = string | Blob | ArrayBufferLike

Blob |

interface Blob A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system.

MDN Reference

ArrayBufferLike          

type ArrayBufferLike = ArrayBuffer | SharedArrayBuffer

export const createWSMessageEvent =

const createWSMessageEvent: (source: WSMessageReceive) => MessageEvent<WSMessageReceive>

(source:

(parameter) source: WSMessageReceive

WSMessageReceive):

type WSMessageReceive = string | Blob | ArrayBufferLike

MessageEvent

interface MessageEvent<T = any> A message received by a target object.

MDN Reference

<WSMessageReceive> => {          

type WSMessageReceive = string | Blob | ArrayBufferLike

return new MessageEvent

var MessageEvent: new <WSMessageReceive>(type: string, eventInitDict?: MessageEventInit<WSMessageReceive> | undefined) => MessageEvent<WSMessageReceive> A message received by a target object.

MDN Reference

<WSMessageReceive>('message', {          

type WSMessageReceive = string | Blob | ArrayBufferLike

data:

(property) MessageEventInit<WSMessageReceive>.data?: WSMessageReceive | undefined

source,          

(parameter) source: WSMessageReceive

}) }
src/hono-base.ts
            
                /**
                 * @module
                 * This module is the base module for the Hono object.
                 */
                
                /* eslint-disable @typescript-eslint/no-explicit-any */
                import { compose } from './compose'
                import { Context } from './context'
                import type { ExecutionContext } from './context'
                import type { Router } from './router'
                import { METHODS, METHOD_NAME_ALL, METHOD_NAME_ALL_LOWERCASE } from './router'
                import type {
                  Env,
                  ErrorHandler,
                  FetchEventLike,
                  H,
                  HTTPResponseError,
                  HandlerInterface,
                  MergePath,
                  MergeSchemaPath,
                  MiddlewareHandler,
                  MiddlewareHandlerInterface,
                  Next,
                  NotFoundHandler,
                  OnHandlerInterface,
                  RouterRoute,
                  Schema,
                } from './types'
                import { getPath, getPathNoStrict, mergePath } from './utils/url'
                
                /**
                 * Symbol used to mark a composed handler.
                 */
                export const COMPOSED_HANDLER =

const COMPOSED_HANDLER: typeof COMPOSED_HANDLER Symbol used to mark a composed handler.

Symbol('composedHandler')          

var Symbol: SymbolConstructor (description?: string | number) => symbol Returns a new unique Symbol value.

@param description — Description of the new Symbol object.

const notFoundHandler =

const notFoundHandler: (c: Context) => Response & TypedResponse<"404 Not Found", 404, "text">

(c:

(parameter) c: Context<any, any, {}>

Context) => {          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

return c

(parameter) c: Context<any, any, {}>

.text('404 Not Found', 404)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"404 Not Found", 404>(text: "404 Not Found", status?: 404 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"404 Not Found", 404, "text"> (+1 overload)

} const errorHandler =

const errorHandler: (err: Error | HTTPResponseError, c: Context) => Response

(err:

(parameter) err: Error | HTTPResponseError

Error |

interface Error

HTTPResponseError,

(alias) interface HTTPResponseError import HTTPResponseError

c:

(parameter) c: Context<any, any, {}>

Context) => {          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

if ('getResponse' in err) {          

(parameter) err: Error | HTTPResponseError

return err

(parameter) err: HTTPResponseError

.getResponse()          

(property) HTTPResponseError.getResponse: () => Response

} console

var console: Console

.error

(method) Console.error(...data: any[]): void MDN Reference

(err)          

(parameter) err: Error

return c

(parameter) c: Context<any, any, {}>

.text('Internal Server Error', 500)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Internal Server Error", 500>(text: "Internal Server Error", status?: 500 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Internal Server Error", 500, "text"> (+1 overload)

} type GetPath

type GetPath<E extends Env> = (request: Request, options?: { env?: E["Bindings"]; }) => string

<E extends

(type parameter) E in type GetPath<E extends Env>

Env> =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

(request:

(parameter) request: Request

Request,

interface Request This Fetch API interface represents a resource request.

MDN Reference

options?: {

(parameter) options: { env?: E["Bindings"]; } | undefined

env?:

(property) env?: E["Bindings"] | undefined

E['Bindings'] }) => string          

(type parameter) E in type GetPath<E extends Env>

export type HonoOptions

type HonoOptions<E extends Env> = { strict?: boolean; router?: Router<[H, RouterRoute]>; getPath?: GetPath<E>; }

<E extends

(type parameter) E in type HonoOptions<E extends Env>

Env> = {          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

/** * `strict` option specifies whether to distinguish whether the last path is a directory or not. * * @see {@link https://hono.dev/docs/api/hono#strict-mode} * * @default true */ strict?: boolean          

(property) strict?: boolean | undefined strict option specifies whether to distinguish whether the last path is a directory or not.

@see — https://hono.dev/docs/api/hono#strict-mode

@default
true

/** * `router` option specifices which router to use. * * @see {@link https://hono.dev/docs/api/hono#router-option} * * @example * ```ts * const app = new Hono({ router: new RegExpRouter() }) * ``` */ router?:

(property) router?: Router<[H, RouterRoute]> | undefined router option specifices which router to use.

@see — https://hono.dev/docs/api/hono#router-option

@example
ts const app = new Hono({ router: new RegExpRouter() })

Router<

(alias) interface Router<T> import Router Interface representing a router.

@template T — The type of the handler.

[H,

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

RouterRoute]>          

(alias) interface RouterRoute import RouterRoute

/** * `getPath` can handle the host header value. * * @see {@link https://hono.dev/docs/api/routing#routing-with-host-header-value} * * @example * ```ts * const app = new Hono({ * getPath: (req) => * '/' + req.headers.get('host') + req.url.replace(/^https?:\/\/[^/]+(\/[^?]*)/, '$1'), * }) * * app.get('/www1.example.com/hello', () => c.text('hello www1')) * * // A following request will match the route: * // new Request('http://www1.example.com/hello', { * // headers: { host: 'www1.example.com' }, * // }) * ``` */ getPath?:

(property) getPath?: GetPath<E> | undefined getPath can handle the host header value.

@see — https://hono.dev/docs/api/routing#routing-with-host-header-value

@example
```ts const app = new Hono({ getPath: (req) => '/' + req.headers.get('host') + req.url.replace(/^https?:\/\/[^/]+(\/[^?]*)/, '$1'), })

app.get('/www1.example.com/hello', () => c.text('hello www1'))

// A following request will match the route: // new Request('http://www1.example.com/hello', { // headers: { host: 'www1.example.com' }, // }) ```

GetPath

type GetPath<E extends Env> = (request: Request, options?: { env?: E["Bindings"]; }) => string

<E>          

(type parameter) E in type HonoOptions<E extends Env>

} type MountOptionHandler =

type MountOptionHandler = (c: Context) => unknown

(c:

(parameter) c: Context<any, any, {}>

Context) => unknown          

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

type MountReplaceRequest =

type MountReplaceRequest = (originalRequest: Request) => Request

(originalRequest:

(parameter) originalRequest: Request

Request) =>

interface Request This Fetch API interface represents a resource request.

MDN Reference

Request          

interface Request This Fetch API interface represents a resource request.

MDN Reference

type MountOptions =          

type MountOptions = MountOptionHandler | { optionHandler?: MountOptionHandler; replaceRequest?: MountReplaceRequest; }

| MountOptionHandler          

type MountOptionHandler = (c: Context) => unknown

| { optionHandler?:

(property) optionHandler?: MountOptionHandler | undefined

MountOptionHandler          

type MountOptionHandler = (c: Context) => unknown

replaceRequest?:

(property) replaceRequest?: MountReplaceRequest | undefined

MountReplaceRequest          

type MountReplaceRequest = (originalRequest: Request) => Request

} class Hono

class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

<E extends

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

Env,

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

S extends

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

Schema = {},

(alias) type Schema = { [Path: string]: { [Method: `$${Lowercase<string>}`]: Endpoint; }; } import Schema

BasePath extends string = '/'> {          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

get!:

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.get: HandlerInterface<E, "get", S, BasePath>

HandlerInterface

(alias) interface HandlerInterface<E extends Env = Env, M extends string = string, S extends Schema = BlankSchema, BasePath extends string = "/"> import HandlerInterface

<E, 'get',

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath>          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

post!:

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.post: HandlerInterface<E, "post", S, BasePath>

HandlerInterface

(alias) interface HandlerInterface<E extends Env = Env, M extends string = string, S extends Schema = BlankSchema, BasePath extends string = "/"> import HandlerInterface

<E, 'post',

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath>          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

put!:

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.put: HandlerInterface<E, "put", S, BasePath>

HandlerInterface

(alias) interface HandlerInterface<E extends Env = Env, M extends string = string, S extends Schema = BlankSchema, BasePath extends string = "/"> import HandlerInterface

<E, 'put',

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath>          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

delete!:

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.delete: HandlerInterface<E, "delete", S, BasePath>

HandlerInterface

(alias) interface HandlerInterface<E extends Env = Env, M extends string = string, S extends Schema = BlankSchema, BasePath extends string = "/"> import HandlerInterface

<E, 'delete',

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath>          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

options!:

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.options: HandlerInterface<E, "options", S, BasePath>

HandlerInterface

(alias) interface HandlerInterface<E extends Env = Env, M extends string = string, S extends Schema = BlankSchema, BasePath extends string = "/"> import HandlerInterface

<E, 'options',

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath>          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

patch!:

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.patch: HandlerInterface<E, "patch", S, BasePath>

HandlerInterface

(alias) interface HandlerInterface<E extends Env = Env, M extends string = string, S extends Schema = BlankSchema, BasePath extends string = "/"> import HandlerInterface

<E, 'patch',

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath>          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

all!:

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.all: HandlerInterface<E, "all", S, BasePath>

HandlerInterface

(alias) interface HandlerInterface<E extends Env = Env, M extends string = string, S extends Schema = BlankSchema, BasePath extends string = "/"> import HandlerInterface

<E, 'all',

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath>          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

on:

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.on: OnHandlerInterface<E, S, BasePath>

OnHandlerInterface

(alias) interface OnHandlerInterface<E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = "/"> import OnHandlerInterface

<E,

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath>          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

use:

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.use: MiddlewareHandlerInterface<E, S, BasePath>

MiddlewareHandlerInterface

(alias) interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = "/"> import MiddlewareHandlerInterface

<E,

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath>          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

/* This class is like an abstract class and does not have a router. To use it, inherit the class and implement router in the constructor. */ router!:

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.router: Router<[H, RouterRoute]>

Router<

(alias) interface Router<T> import Router Interface representing a router.

@template T — The type of the handler.

[H,

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

RouterRoute]>          

(alias) interface RouterRoute import RouterRoute

readonly getPath:

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.getPath: GetPath<E>

GetPath

type GetPath<E extends Env> = (request: Request, options?: { env?: E["Bindings"]; }) => string

<E>          

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

// Cannot use `#` because it requires visibility at JavaScript runtime. private _basePath: string = '/'          

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">._basePath: string

#path: string = '/' routes:

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.routes: RouterRoute[]

RouterRoute[] = []          

(alias) interface RouterRoute import RouterRoute

constructor(options:

(parameter) options: HonoOptions<E>

HonoOptions

type HonoOptions<E extends Env> = { strict?: boolean; router?: Router<[H, RouterRoute]>; getPath?: GetPath<E>; }

<E> = {}) {          

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

// Implementation of app.get(...handlers[]) or app.get(path, ...handlers[]) const allMethods = [..

const allMethods: ("delete" | "all" | "get" | "post" | "put" | "options" | "patch")[]

.METHODS,

(alias) const METHODS: readonly ["get", "post", "put", "delete", "options", "patch"] import METHODS Array of supported HTTP methods.

METHOD_NAME_ALL_LOWERCASE]          

(alias) const METHOD_NAME_ALL_LOWERCASE: "all" import METHOD_NAME_ALL_LOWERCASE Constant representing all HTTP methods in lowercase.

allMethods

const allMethods: ("delete" | "all" | "get" | "post" | "put" | "options" | "patch")[]

.forEach(

(method) Array<"delete" | "all" | "get" | "post" | "put" | "options" | "patch">.forEach(callbackfn: (value: "delete" | "all" | "get" | "post" | "put" | "options" | "patch", index: number, array: ("delete" | "all" | "get" | "post" | "put" | "options" | "patch")[]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(method) => {          

(parameter) method: "delete" | "all" | "get" | "post" | "put" | "options" | "patch"

this[method] =

(parameter) method: "delete" | "all" | "get" | "post" | "put" | "options" | "patch"

(args1: string |

(parameter) args1: string | H

H, ..

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

.args:

(parameter) args: H[]

H[]) => {          

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

if (typeof args1 === 'string') {          

(parameter) args1: string | H

this.#path = args1          

(parameter) args1: string

} else { this.addRoute

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.addRoute(method: string, path: string, handler: H): void

(method, this.#path,

(parameter) method: "delete" | "all" | "get" | "post" | "put" | "options" | "patch"

args1)          

(parameter) args1: H

} args

(parameter) args: H[]

.forEach(

(method) Array<H>.forEach(callbackfn: (value: H, index: number, array: H[]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(handler) => {          

(parameter) handler: H

if (typeof handler !== 'string') {          

(parameter) handler: H

this.addRoute

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.addRoute(method: string, path: string, handler: H): void

(method, this.#path,

(parameter) method: "delete" | "all" | "get" | "post" | "put" | "options" | "patch"

handler)          

(parameter) handler: H

} }) return this as any } }) // Implementation of app.on(method, path, ...handlers[]) this.on =

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.on: OnHandlerInterface<E, S, BasePath>

(method: string | string[],

(parameter) method: string | string[]

path: string | string[], ..

(parameter) path: string | string[]

.handlers:

(parameter) handlers: H[]

H[]) => {          

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

for (const p of

const p: string

[path]

(parameter) path: string | string[]

.flat()) {          

(method) Array<string | string[]>.flat<(string | string[])[], 1>(this: (string | string[])[], depth?: 1 | undefined): string[] Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

@param depth — The maximum recursion depth

this.#path = p          

const p: string

for (const m of

const m: string

[method]

(parameter) method: string | string[]

.flat()) {          

(method) Array<string | string[]>.flat<(string | string[])[], 1>(this: (string | string[])[], depth?: 1 | undefined): string[] Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

@param depth — The maximum recursion depth

handlers

(parameter) handlers: H[]

.map(

(method) Array<H>.map<void>(callbackfn: (value: H, index: number, array: H[]) => void, thisArg?: any): void[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(handler) => {          

(parameter) handler: H

this.addRoute

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.addRoute(method: string, path: string, handler: H): void

(m

const m: string

.toUpperCase(), this.#path,

(method) String.toUpperCase(): string Converts all the alphabetic characters in a string to uppercase.

handler)          

(parameter) handler: H

}) } } return this as any } // Implementation of app.use(...handlers[]) or app.use(path, ...handlers[]) this.use =

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.use: MiddlewareHandlerInterface<E, S, BasePath>

(arg1: string |

(parameter) arg1: string | MiddlewareHandler<any>

MiddlewareHandler, ..

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

.handlers:

(parameter) handlers: MiddlewareHandler<any>[]

MiddlewareHandler[]) => {          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

if (typeof arg1 === 'string') {          

(parameter) arg1: string | MiddlewareHandler<any>

this.#path = arg1          

(parameter) arg1: string

} else { this.#path = '*' handlers

(parameter) handlers: MiddlewareHandler<any>[]

.unshift

(method) Array<MiddlewareHandler<any>>.unshift(...items: MiddlewareHandler<any>[]): number Inserts new elements at the start of an array, and returns the new length of the array.

@param items — Elements to insert at the start of the array.

(arg1)          

(parameter) arg1: MiddlewareHandler<any>

} handlers

(parameter) handlers: MiddlewareHandler<any>[]

.forEach(

(method) Array<MiddlewareHandler<any>>.forEach(callbackfn: (value: MiddlewareHandler<any>, index: number, array: MiddlewareHandler<any>[]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(handler) => {          

(parameter) handler: MiddlewareHandler<any>

this.addRoute

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.addRoute(method: string, path: string, handler: H): void

(METHOD_NAME_ALL, this.#path,

(alias) const METHOD_NAME_ALL: "ALL" import METHOD_NAME_ALL Constant representing all HTTP methods in uppercase.

handler)          

(parameter) handler: MiddlewareHandler<any>

}) return this as any } const strict =

const strict: boolean

options

(parameter) options: HonoOptions<E>

.strict ?? true          

(property) strict?: boolean | undefined strict option specifies whether to distinguish whether the last path is a directory or not.

@see — https://hono.dev/docs/api/hono#strict-mode

@default
true

delete options

(parameter) options: HonoOptions<E>

.strict          

(property) strict?: boolean | undefined strict option specifies whether to distinguish whether the last path is a directory or not.

@see — https://hono.dev/docs/api/hono#strict-mode

@default
true

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.assign(this,

(method) ObjectConstructor.assign<this, HonoOptions<E>>(target: this, source: HonoOptions<E>): this & HonoOptions<E> (+3 overloads) Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object.

@param target — The target object to copy to.

@param source — The source object from which to copy properties.

options)          

(parameter) options: HonoOptions<E>

this.getPath =

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.getPath: GetPath<E>

strict ?

const strict: boolean

options

(parameter) options: HonoOptions<E>

.getPath ??

(property) getPath?: GetPath<E> | undefined getPath can handle the host header value.

@see — https://hono.dev/docs/api/routing#routing-with-host-header-value

@example
```ts const app = new Hono({ getPath: (req) => '/' + req.headers.get('host') + req.url.replace(/^https?:\/\/[^/]+(\/[^?]*)/, '$1'), })

app.get('/www1.example.com/hello', () => c.text('hello www1'))

// A following request will match the route: // new Request('http://www1.example.com/hello', { // headers: { host: 'www1.example.com' }, // }) ```

getPath :

(alias) const getPath: (request: Request) => string import getPath

getPathNoStrict          

(alias) const getPathNoStrict: (request: Request) => string import getPathNoStrict

} private clone():

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.clone(): Hono<E, S, BasePath>

Hono

class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

<E,

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath> {          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

const clone = new

const clone: Hono<E, S, BasePath>

Hono

constructor Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(options?: HonoOptions<E>): Hono<E, S, BasePath>

<E,

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath>({          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

router: this

(property) router?: Router<[H, RouterRoute]> | undefined router option specifices which router to use.

@see — https://hono.dev/docs/api/hono#router-option

@example
ts const app = new Hono({ router: new RegExpRouter() })

.router,          

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.router: Router<[H, RouterRoute]>

getPath: this

(property) getPath?: GetPath<E> | undefined getPath can handle the host header value.

@see — https://hono.dev/docs/api/routing#routing-with-host-header-value

@example
```ts const app = new Hono({ getPath: (req) => '/' + req.headers.get('host') + req.url.replace(/^https?:\/\/[^/]+(\/[^?]*)/, '$1'), })

app.get('/www1.example.com/hello', () => c.text('hello www1'))

// A following request will match the route: // new Request('http://www1.example.com/hello', { // headers: { host: 'www1.example.com' }, // }) ```

.getPath,          

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.getPath: GetPath<E>

}) clone

const clone: Hono<E, S, BasePath>

.routes = this

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.routes: RouterRoute[]

.routes          

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.routes: RouterRoute[]

return clone          

const clone: Hono<E, S, BasePath>

} private notFoundHandler:

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.notFoundHandler: NotFoundHandler

NotFoundHandler =

(alias) type NotFoundHandler<E extends Env = any> = (c: Context<E>) => Response | Promise<Response> import NotFoundHandler

notFoundHandler          

const notFoundHandler: (c: Context) => Response & TypedResponse<"404 Not Found", 404, "text">

private errorHandler:

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.errorHandler: ErrorHandler

ErrorHandler =

(alias) type ErrorHandler<E extends Env = any> = (err: Error | HTTPResponseError, c: Context<E>) => Response | Promise<Response> import ErrorHandler

errorHandler          

const errorHandler: (err: Error | HTTPResponseError, c: Context) => Response

/** * `.route()` allows grouping other Hono instance in routes. * * @see {@link https://hono.dev/docs/api/routing#grouping} * * @param {string} path - base Path * @param {Hono} app - other Hono instance * @returns {Hono} routed Hono instance * * @example * ```ts * const app = new Hono() * const app2 = new Hono() * * app2.get("/user", (c) => c.text("user")) * app.route("/api", app2) // GET /api/user * ``` */ route<          

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string>(path: SubPath, app: Hono<SubEnv, SubSchema, SubBasePath>): Hono<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> & S, BasePath> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

SubPath extends string,          

(type parameter) SubPath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string>(path: SubPath, app: Hono<SubEnv, SubSchema, SubBasePath>): Hono<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> & S, BasePath>

SubEnv extends

(type parameter) SubEnv in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string>(path: SubPath, app: Hono<SubEnv, SubSchema, SubBasePath>): Hono<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> & S, BasePath>

Env,          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

SubSchema extends

(type parameter) SubSchema in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string>(path: SubPath, app: Hono<SubEnv, SubSchema, SubBasePath>): Hono<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> & S, BasePath>

Schema,          

(alias) type Schema = { [Path: string]: { [Method: `$${Lowercase<string>}`]: Endpoint; }; } import Schema

SubBasePath extends string          

(type parameter) SubBasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string>(path: SubPath, app: Hono<SubEnv, SubSchema, SubBasePath>): Hono<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> & S, BasePath>

>( path:

(parameter) path: SubPath extends string - base Path

@param path — base Path

SubPath,          

(type parameter) SubPath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string>(path: SubPath, app: Hono<SubEnv, SubSchema, SubBasePath>): Hono<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> & S, BasePath>

app:

(parameter) app: Hono<SubEnv, SubSchema, SubBasePath> - other Hono instance

@param app — other Hono instance

Hono

class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

<SubEnv,

(type parameter) SubEnv in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string>(path: SubPath, app: Hono<SubEnv, SubSchema, SubBasePath>): Hono<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> & S, BasePath>

SubSchema,

(type parameter) SubSchema in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string>(path: SubPath, app: Hono<SubEnv, SubSchema, SubBasePath>): Hono<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> & S, BasePath>

SubBasePath>          

(type parameter) SubBasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string>(path: SubPath, app: Hono<SubEnv, SubSchema, SubBasePath>): Hono<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> & S, BasePath>

): Hono

class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

<E,

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

MergeSchemaPath

(alias) type MergeSchemaPath<OrigSchema extends Schema, SubPath extends string> = { [KeyType in keyof { [P in keyof OrigSchema as MergePath<SubPath, P & string>]: { [M in keyof OrigSchema[P]]: MergeEndpointParamsWithPath<OrigSchema[P][M], SubPath>; }; }]: { [P in keyof OrigSchema as MergePath<SubPath, P & string>]: { [M in keyof OrigSchema[P]]: MergeEndpointParamsWithPath<OrigSchema[P][M], SubPath>; }; }[KeyType]; } import MergeSchemaPath

<SubSchema,

(type parameter) SubSchema in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string>(path: SubPath, app: Hono<SubEnv, SubSchema, SubBasePath>): Hono<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> & S, BasePath>

MergePath

(alias) type MergePath<A extends string, B extends string> = B extends "" ? A extends "" ? "/" : A extends "/" ? "/" : A extends `${infer P}/` ? `${P}/` : A : A extends "" ? B : A extends "/" ? B : A extends `${infer P}/` ? B extends `/${infer Q}` ? `${P}/${Q}` : `${P}/${B}` : B extends `/${infer Q}` ? Q extends "" ? A : `${A}/${Q}` : `${A}/${B}` import MergePath

<BasePath,

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

SubPath>> &

(type parameter) SubPath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.route<SubPath extends string, SubEnv extends Env, SubSchema extends Schema, SubBasePath extends string>(path: SubPath, app: Hono<SubEnv, SubSchema, SubBasePath>): Hono<E, MergeSchemaPath<SubSchema, MergePath<BasePath, SubPath>> & S, BasePath>

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath> {          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

const subApp = this

const subApp: Hono<E, S, MergePath<BasePath, SubPath>>

.basePath

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.basePath<SubPath>(path: SubPath): Hono<E, S, MergePath<BasePath, SubPath>> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

(path)          

(parameter) path: SubPath extends string - base Path

@param path — base Path

app

(parameter) app: Hono<SubEnv, SubSchema, SubBasePath> - other Hono instance

@param app — other Hono instance

.routes

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.routes: RouterRoute[]

.map(

(method) Array<RouterRoute>.map<void>(callbackfn: (value: RouterRoute, index: number, array: RouterRoute[]) => void, thisArg?: any): void[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(r) => {          

(parameter) r: RouterRoute

let handler          

let handler: any

if (app

(parameter) app: Hono<SubEnv, SubSchema, SubBasePath> - other Hono instance

@param app — other Hono instance

.errorHandler ===

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.errorHandler: ErrorHandler

errorHandler) {          

const errorHandler: (err: Error | HTTPResponseError, c: Context) => Response

handler =

let handler: any

r

(parameter) r: RouterRoute

.handler          

(property) RouterRoute.handler: H<any, any, BlankInput, any>

} else { handler = async

let handler: any

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

next:

(parameter) next: Next

Next) =>          

(alias) type Next = () => Promise<void> import Next

(await compose

(alias) compose<Context<any, any, {}>, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: Context<...>, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<Context>([],

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

app

(parameter) app: Hono<SubEnv, SubSchema, SubBasePath> - other Hono instance

@param app — other Hono instance

.errorHandler)

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.errorHandler: ErrorHandler

(c, () =>

(parameter) c: Context<any, any, {}>

r

(parameter) r: RouterRoute

.handler

(property) RouterRoute.handler: (c: Context<any, any, BlankInput>, next: Next) => any

(c,

(parameter) c: Context<any, any, {}>

next)))

(parameter) next: Next

.res          

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

;(handler as any)

let handler: (c: Context, next: Next) => Promise<Response>

[COMPOSED_HANDLER] =

const COMPOSED_HANDLER: typeof COMPOSED_HANDLER Symbol used to mark a composed handler.

r

(parameter) r: RouterRoute

.handler          

(property) RouterRoute.handler: H<any, any, BlankInput, any>

} subApp

const subApp: Hono<E, S, MergePath<BasePath, SubPath>>

.addRoute

(method) Hono<E, S, MergePath<BasePath, SubPath>>.addRoute(method: string, path: string, handler: H): void

(r

(parameter) r: RouterRoute

.method,

(property) RouterRoute.method: string

r

(parameter) r: RouterRoute

.path,

(property) RouterRoute.path: string

handler)          

let handler: H<any, any, BlankInput, any>

}) return this } /** * `.basePath()` allows base paths to be specified. * * @see {@link https://hono.dev/docs/api/routing#base-path} * * @param {string} path - base Path * @returns {Hono} changed Hono instance * * @example * ```ts * const api = new Hono().basePath('/api') * ``` */ basePath

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.basePath<SubPath extends string>(path: SubPath): Hono<E, S, MergePath<BasePath, SubPath>> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

<SubPath extends string>

(type parameter) SubPath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.basePath<SubPath extends string>(path: SubPath): Hono<E, S, MergePath<BasePath, SubPath>>

(path:

(parameter) path: SubPath extends string - base Path

@param path — base Path

SubPath):

(type parameter) SubPath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.basePath<SubPath extends string>(path: SubPath): Hono<E, S, MergePath<BasePath, SubPath>>

Hono

class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

<E,

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

MergePath

(alias) type MergePath<A extends string, B extends string> = B extends "" ? A extends "" ? "/" : A extends "/" ? "/" : A extends `${infer P}/` ? `${P}/` : A : A extends "" ? B : A extends "/" ? B : A extends `${infer P}/` ? B extends `/${infer Q}` ? `${P}/${Q}` : `${P}/${B}` : B extends `/${infer Q}` ? Q extends "" ? A : `${A}/${Q}` : `${A}/${B}` import MergePath

<BasePath,

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

SubPath>> {          

(type parameter) SubPath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.basePath<SubPath extends string>(path: SubPath): Hono<E, S, MergePath<BasePath, SubPath>>

const subApp = this

const subApp: Hono<E, S, BasePath>

.clone()          

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.clone(): Hono<E, S, BasePath>

subApp

const subApp: Hono<E, S, BasePath>

._basePath =

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">._basePath: string

mergePath(this

(alias) mergePath(...paths: string[]): string import mergePath

._basePath,

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">._basePath: string

path)          

(parameter) path: SubPath extends string - base Path

@param path — base Path

return subApp          

const subApp: Hono<E, S, BasePath>

} /** * `.onError()` handles an error and returns a customized Response. * * @see {@link https://hono.dev/docs/api/hono#error-handling} * * @param {ErrorHandler} handler - request Handler for error * @returns {Hono} changed Hono instance * * @example * ```ts * app.onError((err, c) => { * console.error(`${err}`) * return c.text('Custom Error Message', 500) * }) * ``` */ onError =

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.onError: (handler: ErrorHandler<E>) => Hono<E, S, BasePath> .onError() handles an error and returns a customized Response.

@see — https://hono.dev/docs/api/hono#error-handling

@param handler — request Handler for error

@returns — changed Hono instance

@example
ts app.onError((err, c) => { console.error(`${err}`) return c.text('Custom Error Message', 500) })

(handler:

(parameter) handler: ErrorHandler<E> - request Handler for error

@param handler — request Handler for error

ErrorHandler

(alias) type ErrorHandler<E extends Env = any> = (err: Error | HTTPResponseError, c: Context<E>) => Response | Promise<Response> import ErrorHandler

<E>):

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

Hono

class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

<E,

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath> => {          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

this.errorHandler =

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.errorHandler: ErrorHandler

handler          

(parameter) handler: ErrorHandler<E> - request Handler for error

@param handler — request Handler for error

return this } /** * `.notFound()` allows you to customize a Not Found Response. * * @see {@link https://hono.dev/docs/api/hono#not-found} * * @param {NotFoundHandler} handler - request handler for not-found * @returns {Hono} changed Hono instance * * @example * ```ts * app.notFound((c) => { * return c.text('Custom 404 Message', 404) * }) * ``` */ notFound =

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.notFound: (handler: NotFoundHandler<E>) => Hono<E, S, BasePath> .notFound() allows you to customize a Not Found Response.

@see — https://hono.dev/docs/api/hono#not-found

@param handler — request handler for not-found

@returns — changed Hono instance

@example
ts app.notFound((c) => { return c.text('Custom 404 Message', 404) })

(handler:

(parameter) handler: NotFoundHandler<E> - request handler for not-found

@param handler — request handler for not-found

NotFoundHandler

(alias) type NotFoundHandler<E extends Env = any> = (c: Context<E>) => Response | Promise<Response> import NotFoundHandler

<E>):

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

Hono

class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

<E,

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath> => {          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

this.notFoundHandler =

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.notFoundHandler: NotFoundHandler

handler          

(parameter) handler: NotFoundHandler<E> - request handler for not-found

@param handler — request handler for not-found

return this } /** * `.mount()` allows you to mount applications built with other frameworks into your Hono application. * * @see {@link https://hono.dev/docs/api/hono#mount} * * @param {string} path - base Path * @param {Function} applicationHandler - other Request Handler * @param {MountOptions} [options] - options of `.mount()` * @returns {Hono} mounted Hono instance * * @example * ```ts * import { Router as IttyRouter } from 'itty-router' * import { Hono } from 'hono' * // Create itty-router application * const ittyRouter = IttyRouter() * // GET /itty-router/hello * ittyRouter.get('/hello', () => new Response('Hello from itty-router')) * * const app = new Hono() * app.mount('/itty-router', ittyRouter.handle) * ``` * * @example * ```ts * const app = new Hono() * // Send the request to another application without modification. * app.mount('/app', anotherApp, { * replaceRequest: (req) => req, * }) * ``` */ mount(          

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.mount(path: string, applicationHandler: (request: Request, ...args: any) => Response | Promise<Response>, options?: MountOptions): Hono<E, S, BasePath> .mount() allows you to mount applications built with other frameworks into your Hono application.

@see — https://hono.dev/docs/api/hono#mount

@param path — base Path

@param applicationHandler — other Request Handler

@param options — options of .mount()

@returns — mounted Hono instance

@example
```ts import { Router as IttyRouter } from 'itty-router' import { Hono } from 'hono' // Create itty-router application const ittyRouter = IttyRouter() // GET /itty-router/hello ittyRouter.get('/hello', () => new Response('Hello from itty-router'))

const app = new Hono() app.mount('/itty-router', ittyRouter.handle) ```

@example
ts const app = new Hono() // Send the request to another application without modification. app.mount('/app', anotherApp, { replaceRequest: (req) => req, })

path: string,          

(parameter) path: string - base Path

@param path — base Path

applicationHandler:

(parameter) applicationHandler: (request: Request, ...args: any) => Response | Promise<Response> - other Request Handler

@param applicationHandler — other Request Handler

(request:

(parameter) request: Request

Request, ..

interface Request This Fetch API interface represents a resource request.

MDN Reference

.args: any) =>

(parameter) args: any

Response |

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response>,          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

options?:

(parameter) options: MountOptions | undefined - options of .mount()

@param options — options of .mount()

MountOptions          

type MountOptions = MountOptionHandler | { optionHandler?: MountOptionHandler; replaceRequest?: MountReplaceRequest; }

): Hono

class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

<E,

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

S,

(type parameter) S in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

BasePath> {          

(type parameter) BasePath in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

// handle options let replaceRequest:

let replaceRequest: MountReplaceRequest | undefined

MountReplaceRequest | undefined          

type MountReplaceRequest = (originalRequest: Request) => Request

let optionHandler:

let optionHandler: MountOptionHandler | undefined

MountOptionHandler | undefined          

type MountOptionHandler = (c: Context) => unknown

if (options) {          

(parameter) options: MountOptions | undefined - options of .mount()

@param options — options of .mount()

if (typeof options === 'function') {          

(parameter) options: MountOptions - options of .mount()

@param options — options of .mount()

optionHandler =

let optionHandler: MountOptionHandler | undefined

options          

(parameter) options: MountOptionHandler - options of .mount()

@param options — options of .mount()

} else { optionHandler =

let optionHandler: MountOptionHandler | undefined

options

(parameter) options: { optionHandler?: MountOptionHandler; replaceRequest?: MountReplaceRequest; } - options of .mount()

@param options — options of .mount()

.optionHandler          

(property) optionHandler?: MountOptionHandler | undefined

replaceRequest =

let replaceRequest: MountReplaceRequest | undefined

options

(parameter) options: { optionHandler?: MountOptionHandler; replaceRequest?: MountReplaceRequest; } - options of .mount()

@param options — options of .mount()

.replaceRequest          

(property) replaceRequest?: MountReplaceRequest | undefined

} } // prepare handlers for request const getOptions:

const getOptions: (c: Context) => unknown[]

(c:

(parameter) c: Context<any, any, {}>

Context) => unknown[] =

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

optionHandler          

let optionHandler: MountOptionHandler | undefined

? (c) => {          

(parameter) c: Context<any, any, {}>

const options =

const options: unknown

optionHandler!

let optionHandler: MountOptionHandler

(c)          

(parameter) c: Context<any, any, {}>

return Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(options) ?

const options: unknown

options :

const options: any[]

[options]          

const options: unknown

} : (c) => {          

(parameter) c: Context<any, any, {}>

let executionContext:

let executionContext: ExecutionContext | undefined

ExecutionContext | undefined = undefined          

(alias) interface ExecutionContext import ExecutionContext Interface for the execution context in a web worker or similar environment.

try { executionContext =

let executionContext: ExecutionContext | undefined

c

(parameter) c: Context<any, any, {}>

.executionCtx          

(property) Context<any, any, {}>.executionCtx: ExecutionContext

@see — https://hono.dev/docs/api/context#executionctxThe ExecutionContext associated with the current request.

@throws — Will throw an error if the context does not have an ExecutionContext.

} catch {} // Do nothing return [c

(parameter) c: Context<any, any, {}>

.env,

(property) Context<any, any, {}>.env: any .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

executionContext]          

let executionContext: ExecutionContext | undefined

} replaceRequest ||= (() => {          

let replaceRequest: MountReplaceRequest | undefined

const mergedPath =

const mergedPath: string

mergePath(this

(alias) mergePath(...paths: string[]): string import mergePath

._basePath,

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">._basePath: string

path)          

(parameter) path: string - base Path

@param path — base Path

const pathPrefixLength =

const pathPrefixLength: number

mergedPath === '/' ? 0 :

const mergedPath: string

mergedPath

const mergedPath: string

.length          

(property) String.length: number Returns the length of a String object.

return (request) => {          

(parameter) request: Request

const url = new

const url: URL

URL

var URL: new (url: string | URL, base?: string | URL) => URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

(request

(parameter) request: Request

.url)          

(property) Request.url: string Returns the URL of request as a string.

MDN Reference

url

const url: URL

.pathname =

(property) URL.pathname: string MDN Reference

url

const url: URL

.pathname

(property) URL.pathname: string MDN Reference

.slice

(method) String.slice(start?: number, end?: number): string Returns a section of a string.

@param start — The index to the beginning of the specified portion of stringObj.

@param end
The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. If this value is not specified, the substring continues to the end of stringObj.

(pathPrefixLength) || '/'          

const pathPrefixLength: number

return new Request

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

(url,

const url: URL

request)          

(parameter) request: Request

} })() const handler:

const handler: MiddlewareHandler

MiddlewareHandler = async

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

(c,

(parameter) c: Context<any, string, {}>

next) => {          

(parameter) next: Next

const res = await

const res: Response

applicationHandler

(parameter) applicationHandler: (request: Request, ...args: any) => Response | Promise<Response> - other Request Handler

@param applicationHandler — other Request Handler

(replaceRequest!

let replaceRequest: MountReplaceRequest

(c

(parameter) c: Context<any, string, {}>

.req

(property) Context<any, string, {}>.req: HonoRequest<string, unknown> .req is the instance of HonoRequest.

.raw), ..

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

.getOptions

const getOptions: (c: Context) => unknown[]

(c))          

(parameter) c: Context<any, string, {}>

if (res) {          

const res: Response

return res          

const res: Response

} await next()          

(parameter) next: () => Promise<void>

} this.addRoute

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.addRoute(method: string, path: string, handler: H): void

(METHOD_NAME_ALL,

(alias) const METHOD_NAME_ALL: "ALL" import METHOD_NAME_ALL Constant representing all HTTP methods in uppercase.

mergePath

(alias) mergePath(...paths: string[]): string import mergePath

(path, '*'),

(parameter) path: string - base Path

@param path — base Path

handler)          

const handler: MiddlewareHandler

return this } private addRoute

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.addRoute(method: string, path: string, handler: H): void

(method: string,

(parameter) method: string

path: string,

(parameter) path: string

handler:

(parameter) handler: H

H) {          

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

method =

(parameter) method: string

method

(parameter) method: string

.toUpperCase()          

(method) String.toUpperCase(): string Converts all the alphabetic characters in a string to uppercase.

path =

(parameter) path: string

mergePath(this

(alias) mergePath(...paths: string[]): string import mergePath

._basePath,

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">._basePath: string

path)          

(parameter) path: string

const r:

const r: RouterRoute

RouterRoute = {

(alias) interface RouterRoute import RouterRoute

path:

(property) RouterRoute.path: string

path,

(parameter) path: string

method:

(property) RouterRoute.method: string

method,

(parameter) method: string

handler:

(property) RouterRoute.handler: H<any, any, BlankInput, any>

handler }          

(parameter) handler: H

this.router

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.router: Router<[H, RouterRoute]>

.add

(method) Router<[H, RouterRoute]>.add(method: string, path: string, handler: [H, RouterRoute]): void Adds a route to the router.

@param method — The HTTP method (e.g., 'get', 'post').

@param path — The path for the route.

@param handler — The handler for the route.

(method,

(parameter) method: string

path,

(parameter) path: string

[handler,

(parameter) handler: H

r])          

const r: RouterRoute

this.routes

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.routes: RouterRoute[]

.push

(method) Array<RouterRoute>.push(...items: RouterRoute[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(r)          

const r: RouterRoute

} private matchRoute

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.matchRoute(method: string, path: string): Result<[H, RouterRoute]>

(method: string,

(parameter) method: string

path: string) {          

(parameter) path: string

return this.router

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.router: Router<[H, RouterRoute]>

.match

(method) Router<[H, RouterRoute]>.match(method: string, path: string): Result<[H, RouterRoute]> Matches a route based on the given method and path.

@param method — The HTTP method (e.g., 'get', 'post').

@param path — The path to match.

@returns — The result of the match.

(method,

(parameter) method: string

path)          

(parameter) path: string

} private handleError

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.handleError(err: unknown, c: Context<E>): Response | Promise<Response>

(err: unknown,

(parameter) err: unknown

c:

(parameter) c: Context<E, any, {}>

Context

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

<E>) {          

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

if (err instanceof

(parameter) err: unknown

Error) {          

var Error: ErrorConstructor

return this.errorHandler

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.errorHandler: (err: Error | HTTPResponseError, c: Context<any, any, {}>) => Response | Promise<Response>

(err,

(parameter) err: Error

c)          

(parameter) c: Context<E, any, {}>

} throw err          

(parameter) err: unknown

} private dispatch(          

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.dispatch(request: Request, executionCtx: ExecutionContext | FetchEventLike | undefined, env: E["Bindings"], method: string): Response | Promise<Response>

request:

(parameter) request: Request

Request,          

interface Request This Fetch API interface represents a resource request.

MDN Reference

executionCtx:

(parameter) executionCtx: FetchEventLike | ExecutionContext | undefined

ExecutionContext |

(alias) interface ExecutionContext import ExecutionContext Interface for the execution context in a web worker or similar environment.

FetchEventLike | undefined,          

(alias) class FetchEventLike import FetchEventLike

env:

(parameter) env: E["Bindings"]

E['Bindings'],          

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

method: string          

(parameter) method: string

): Response |

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response> {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

// Handle HEAD method if (method === 'HEAD') {          

(parameter) method: string

return (async () => new Response(null, await this

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

.dispatch

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.dispatch(request: Request, executionCtx: ExecutionContext | FetchEventLike | undefined, env: E["Bindings"], method: string): Response | Promise<Response>

(request,

(parameter) request: Request

executionCtx,

(parameter) executionCtx: FetchEventLike | ExecutionContext | undefined

env, 'GET')))()          

(parameter) env: E["Bindings"]

} const path = this

const path: string

.getPath

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.getPath: (request: Request, options?: { env?: E["Bindings"] | undefined; } | undefined) => string

(request, {

(parameter) request: Request

env })          

(property) env?: E["Bindings"] | undefined

const matchResult = this

const matchResult: Result<[H, RouterRoute]>

.matchRoute

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.matchRoute(method: string, path: string): Result<[H, RouterRoute]>

(method,

(parameter) method: string

path)          

const path: string

const c = new

const c: Context<any, any, {}>

Context

(alias) new Context<any, any, {}>(req: Request, options?: ContextOptions<any> | undefined): Context<any, any, {}> import Context Creates an instance of the Context class.

@param req — The Request object.

@param options — Optional configuration options for the context.

(request, {          

(parameter) request: Request

path,          

(property) path?: string | undefined

matchResult,          

(property) matchResult?: Result<[H, RouterRoute]> | undefined

env,          

(property) env: any Bindings for the environment.

executionCtx,          

(property) executionCtx?: FetchEventLike | ExecutionContext | undefined Execution context for the request.

notFoundHandler: this

(property) notFoundHandler?: NotFoundHandler<any> | undefined Handler for not found responses.

.notFoundHandler,          

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.notFoundHandler: NotFoundHandler

}) // Do not `compose` if it has only one handler if (matchResult[0]

const matchResult: Result<[H, RouterRoute]>

.length === 1) {          

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

let res:

let res: any

ReturnType

type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any Obtain the return type of a function type

<H>          

(alias) type H<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = Handler<E, P, I, R> | MiddlewareHandler<E, P, I> import H

try { res =

let res: any

matchResult[0][0][0][0]

const matchResult: Result<[H, RouterRoute]>

(c, async () => {          

const c: Context<any, any, {}>

c

const c: Context<any, any, {}>

.res = await this

(property) Context<any, any, {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.notFoundHandler

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.notFoundHandler: (c: Context<any, any, {}>) => Response | Promise<Response>

(c)          

const c: Context<any, any, {}>

}) } catch (err) {          

(local var) err: unknown

return this.handleError

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.handleError(err: unknown, c: Context<E>): Response | Promise<Response>

(err,

(local var) err: unknown

c)          

const c: Context<any, any, {}>

} return res instanceof

let res: any

Promise          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

? res          

let res: Promise<any>

.then(          

(method) Promise<any>.then<Response, never>(onfulfilled?: ((value: any) => Response | PromiseLike<Response>) | null | undefined, onrejected?: ((reason: any) => PromiseLike<never>) | null | undefined): Promise<...> Attaches callbacks for the resolution and/or rejection of the Promise.

@param onfulfilled — The callback to execute when the Promise is resolved.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of which ever callback is executed.

(resolved:

(parameter) resolved: Response | undefined

Response | undefined) =>          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

resolved ||

(parameter) resolved: Response | undefined

(c

const c: Context<any, any, {}>

.finalized ?

(property) Context<any, any, {}>.finalized: boolean

c

const c: Context<any, any, {}>

.res : this

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.notFoundHandler

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.notFoundHandler: (c: Context<any, any, {}>) => Response | Promise<Response>

(c))          

const c: Context<any, any, {}>

) .catch(

(method) Promise<Response>.catch<Response>(onrejected?: ((reason: any) => Response | PromiseLike<Response>) | null | undefined): Promise<Response> Attaches a callback for only the rejection of the Promise.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of the callback.

(err:

(parameter) err: Error

Error) => this

interface Error

.handleError

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.handleError(err: unknown, c: Context<E>): Response | Promise<Response>

(err,

(parameter) err: Error

c))          

const c: Context<any, any, {}>

: res ?? this

let res: any

.notFoundHandler

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.notFoundHandler: (c: Context<any, any, {}>) => Response | Promise<Response>

(c)          

const c: Context<any, any, {}>

} const composed =

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

compose

(alias) compose<Context<any, any, {}>, Env>(middleware: [[Function, unknown], ParamIndexMap | Params][], onError?: ErrorHandler<Env> | undefined, onNotFound?: NotFoundHandler<...> | undefined): (context: Context<...>, next?: Function) => Promise<...> import compose Compose middleware functions into a single function based on koa-compose package.

@template C — The context type.

@template E — The environment type.

@param middleware — An array of middleware functions and their corresponding parameters.

@param onError — An optional error handler function.

@param onNotFound — An optional not-found handler function.

@returns — - A composed middleware function.

<Context>

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

(matchResult[0], this

const matchResult: Result<[H, RouterRoute]>

.errorHandler, this

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.errorHandler: ErrorHandler

.notFoundHandler)          

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.notFoundHandler: NotFoundHandler

return (async () => { try { const context = await

const context: Context<any, any, {}>

composed

const composed: (context: Context<any, any, {}>, next?: Function) => Promise<Context<any, any, {}>>

(c)          

const c: Context<any, any, {}>

if (!context

const context: Context<any, any, {}>

.finalized) {          

(property) Context<any, any, {}>.finalized: boolean

throw new Error(          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

'Context is not finalized. Did you forget to return a Response object or `await next()`?' ) } return context

const context: Context<any, any, {}>

.res          

(property) Context<any, any, {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

} catch (err) {          

(local var) err: unknown

return this.handleError

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.handleError(err: unknown, c: Context<E>): Response | Promise<Response>

(err,

(local var) err: unknown

c)          

const c: Context<any, any, {}>

} })() } /** * `.fetch()` will be entry point of your app. * * @see {@link https://hono.dev/docs/api/hono#fetch} * * @param {Request} request - request Object of request * @param {Env} Env - env Object * @param {ExecutionContext} - context of execution * @returns {Response | Promise} response of request * */ fetch: (          

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.fetch: (request: Request, Env?: E["Bindings"] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response> .fetch() will be entry point of your app.

@see — https://hono.dev/docs/api/hono#fetch

@param request — request Object of request

@param Env — env Object

@param — - context of execution

@returns — response of request

request:

(parameter) request: Request - request Object of request

@param request — request Object of request

Request,          

interface Request This Fetch API interface represents a resource request.

MDN Reference

Env?:

(parameter) Env: {} | E["Bindings"] | undefined - env Object

@param Env — env Object

E['Bindings'] | {},          

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

executionCtx?:

(parameter) executionCtx: ExecutionContext | undefined

ExecutionContext          

(alias) interface ExecutionContext import ExecutionContext Interface for the execution context in a web worker or similar environment.

) => Response |

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response> =

interface Response This Fetch API interface represents the response to a request.

MDN Reference

(request, ..

(parameter) request: Request - request Object of request

@param request — request Object of request

.rest) => {          

(parameter) rest: [Env?: {} | E["Bindings"] | undefined, executionCtx?: ExecutionContext | undefined]

return this.dispatch

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.dispatch(request: Request, executionCtx: ExecutionContext | FetchEventLike | undefined, env: E["Bindings"], method: string): Response | Promise<Response>

(request,

(parameter) request: Request - request Object of request

@param request — request Object of request

rest[1],

(parameter) rest: [Env?: {} | E["Bindings"] | undefined, executionCtx?: ExecutionContext | undefined]

rest[0],

(parameter) rest: [Env?: {} | E["Bindings"] | undefined, executionCtx?: ExecutionContext | undefined]

request

(parameter) request: Request - request Object of request

@param request — request Object of request

.method)          

(property) Request.method: string Returns request's HTTP method, which is "GET" by default.

MDN Reference

} /** * `.request()` is a useful method for testing. * You can pass a URL or pathname to send a GET request. * app will return a Response object. * ```ts * test('GET /hello is ok', async () => { * const res = await app.request('/hello') * expect(res.status).toBe(200) * }) * ``` * @see https://hono.dev/docs/api/hono#request */ request = (          

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: E["Bindings"] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

input:

(parameter) input: RequestInfo | URL

RequestInfo |

type RequestInfo = string | Request

URL,          

interface URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

requestInit?:

(parameter) requestInit: RequestInit | undefined

RequestInit,          

interface RequestInit

Env?:

(parameter) Env: {} | E["Bindings"] | undefined

E['Bindings'] | {},          

(type parameter) E in Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

executionCtx?:

(parameter) executionCtx: ExecutionContext | undefined

ExecutionContext          

(alias) interface ExecutionContext import ExecutionContext Interface for the execution context in a web worker or similar environment.

): Response |

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response> => {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

if (input instanceof

(parameter) input: RequestInfo | URL

Request) {          

var Request: { new (input: RequestInfo | URL, init?: RequestInit): Request; prototype: Request; } This Fetch API interface represents a resource request.

MDN Reference

if (requestInit !== undefined) {          

(parameter) requestInit: RequestInit | undefined

input = new

(parameter) input: RequestInfo | URL

Request

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

(input,

(parameter) input: Request

requestInit)          

(parameter) requestInit: RequestInit

} return this.fetch

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.fetch: (request: Request, Env?: E["Bindings"] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response> .fetch() will be entry point of your app.

@see — https://hono.dev/docs/api/hono#fetch

@param request — request Object of request

@param Env — env Object

@param — - context of execution

@returns — response of request

(input,

(parameter) input: Request

Env,

(parameter) Env: {} | E["Bindings"] | undefined

executionCtx)          

(parameter) executionCtx: ExecutionContext | undefined

} input =

(parameter) input: RequestInfo | URL

input

(parameter) input: string | URL

.toString()          

(method) toString(): string Returns a string representation of a string.

const path = /^https?:\/\//

const path: string

.test

(method) RegExp.test(string: string): boolean Returns a Boolean value that indicates whether or not a pattern exists in a searched string.

@param string — String on which to perform the search.

(input) ?

(parameter) input: string

input : `http://localhost$

(parameter) input: string

{mergePath('/',

(alias) mergePath(...paths: string[]): string import mergePath

input)}`          

(parameter) input: string

const req = new

const req: Request

Request

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

(path,

const path: string

requestInit)          

(parameter) requestInit: RequestInit | undefined

return this.fetch

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.fetch: (request: Request, Env?: E["Bindings"] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response> .fetch() will be entry point of your app.

@see — https://hono.dev/docs/api/hono#fetch

@param request — request Object of request

@param Env — env Object

@param — - context of execution

@returns — response of request

(req,

const req: Request

Env,

(parameter) Env: {} | E["Bindings"] | undefined

executionCtx)          

(parameter) executionCtx: ExecutionContext | undefined

} /** * `.fire()` automatically adds a global fetch event listener. * This can be useful for environments that adhere to the Service Worker API, such as non-ES module Cloudflare Workers. * @see https://hono.dev/docs/api/hono#fire * @see https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API * @see https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/ */ fire = (): void => {          

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.fire: () => void .fire() automatically adds a global fetch event listener. This can be useful for environments that adhere to the Service Worker API, such as non-ES module Cloudflare Workers.

@see — https://hono.dev/docs/api/hono#fire

@see — https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API

@see — https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/

// eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore addEventListener('fetch',

function addEventListener<keyof WindowEventMap>(type: keyof WindowEventMap, listener: (this: Window, ev: ErrorEvent | Event | DeviceMotionEvent | ... 25 more ... | StorageEvent) => any, options?: boolean | AddEventListenerOptions): void (+1 overload)

(event:

(parameter) event: FetchEventLike

FetchEventLike): void => {          

(alias) class FetchEventLike import FetchEventLike

event

(parameter) event: FetchEventLike

.respondWith(this

(method) FetchEventLike.respondWith(promise: Response | Promise<Response>): void

.dispatch

(method) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.dispatch(request: Request, executionCtx: ExecutionContext | FetchEventLike | undefined, env: E["Bindings"], method: string): Response | Promise<Response>

(event

(parameter) event: FetchEventLike

.request,

(property) FetchEventLike.request: Request

event, undefined,

(parameter) event: FetchEventLike

event

(parameter) event: FetchEventLike

.request

(property) FetchEventLike.request: Request

.method))          

(property) Request.method: string Returns request's HTTP method, which is "GET" by default.

MDN Reference

}) } } export { Hono as

class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">

HonoBase }          

(alias) class HonoBase<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/"> export HonoBase

src/hono.test.ts
            
                /* eslint-disable @typescript-eslint/no-unused-vars */
                /* eslint-disable @typescript-eslint/ban-ts-comment */
                import { expectTypeOf } from 'vitest'
                import { hc } from './client'
                import type { Context, ExecutionContext } from './context'
                import { Hono } from './hono'
                import { HTTPException } from './http-exception'
                import { logger } from './middleware/logger'
                import { poweredBy } from './middleware/powered-by'
                import { RegExpRouter } from './router/reg-exp-router'
                import { SmartRouter } from './router/smart-router'
                import { TrieRouter } from './router/trie-router'
                import type { Handler, MiddlewareHandler, Next } from './types'
                import type { Equal, Expect } from './utils/types'
                import { getPath } from './utils/url'
                
                // https://stackoverflow.com/a/65666402
                function throwExpression

function throwExpression(errorMessage: string): never

(errorMessage: string): never {          

(parameter) errorMessage: string

throw new Error

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

(errorMessage)          

(parameter) errorMessage: string

} type Env = {          

type Env = { Bindings: { _: string; }; }

Bindings: {          

(property) Bindings: { _: string; }

_: string          

(property) _: string

} } describe('GET Request', () => { describe('without middleware', () => { // In other words, this is a test for cases that do not use `compose()` const app = new

const app: Hono<Env, BlankSchema, "/">

Hono

(alias) new Hono<Env, BlankSchema, "/">(options?: HonoOptions<Env>): Hono<Env, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

<Env>()          

type Env = { Bindings: { _: string; }; }

app

const app: Hono<Env, BlankSchema, "/">

.get('/hello', async () => {          

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/hello", "/hello", Promise<Response>, BlankInput, Env>(path: "/hello", handler: H<Env, "/hello", BlankInput, Promise<Response>>) => Hono<...> (+22 overloads)

return new Response('hello', {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 200,          

(property) ResponseInit.status?: number | undefined

statusText: 'Hono is OK',          

(property) ResponseInit.statusText?: string | undefined

}) }) app

const app: Hono<Env, BlankSchema, "/">

.get('/hello-with-shortcuts',

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/hello-with-shortcuts", "/hello-with-shortcuts", Response, BlankInput, Env>(path: "/hello-with-shortcuts", handler: H<Env, "/hello-with-shortcuts", BlankInput, Response>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<Env, "/hello-with-shortcuts", BlankInput>

c

(parameter) c: Context<Env, "/hello-with-shortcuts", BlankInput>

.header('X-Custom', 'This is Hono')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

(parameter) c: Context<Env, "/hello-with-shortcuts", BlankInput>

.status(201)          

(property) Context<Env, "/hello-with-shortcuts", BlankInput>.status: (status: StatusCode) => void

return c

(parameter) c: Context<Env, "/hello-with-shortcuts", BlankInput>

.html('

Hono!!!

')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.html: HTMLRespond <"<h1>Hono!!!</h1>">(html: "<h1>Hono!!!</h1>", status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

}) app

const app: Hono<Env, BlankSchema, "/">

.get('/hello-env',

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/hello-env", "/hello-env", JSONRespondReturn<{ _: string; }, StatusCode>, BlankInput, Env>(path: "/hello-env", handler: H<Env, "/hello-env", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<Env, "/hello-env", BlankInput>

return c

(parameter) c: Context<Env, "/hello-env", BlankInput>

.json

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ _: string; }, StatusCode>(object: { _: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ _: string; }, StatusCode> (+1 overload)

(c

(parameter) c: Context<Env, "/hello-env", BlankInput>

.env)          

(property) Context<Env, "/hello-env", BlankInput>.env: { _: string; } .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

}) app

const app: Hono<Env, BlankSchema, "/">

.get(          

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/proxy-object", "/proxy-object", Response, BlankInput, Env>(path: "/proxy-object", handler: H<Env, "/proxy-object", BlankInput, Response>) => Hono<...> (+22 overloads)

'/proxy-object', () => new Proxy(new

var Proxy: ProxyConstructor new <Response>(target: Response, handler: ProxyHandler<Response>) => Response Creates a Proxy object. The Proxy object allows you to create an object that can be used in place of the original object, but which may redefine fundamental Object operations like getting, setting, and defining properties. Proxy objects are commonly used to log property accesses, validate, format, or sanitize inputs.

@param target — A target object to wrap with Proxy.

@param handler — An object whose properties define the behavior of Proxy when an operation is attempted on it.

Response('proxy'), {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

get

(method) ProxyHandler<Response>.get?(target: Response, p: string | symbol, receiver: any): any A trap for getting a property value.

@param target — The original object which is being proxied.

@param p — The name or Symbol of the property to get.

@param receiver — The proxy or an object that inherits from the proxy.

(target,

(parameter) target: Response

prop: keyof

(parameter) prop: keyof Response

Response) {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

return target

(parameter) target: Response

[prop]          

(parameter) prop: keyof Response

}, }) ) app

const app: Hono<Env, BlankSchema, "/">

.get(          

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/async-proxy-object", "/async-proxy-object", Promise<Response>, BlankInput, Env>(path: "/async-proxy-object", handler: H<Env, "/async-proxy-object", BlankInput, Promise<...>>) => Hono<...> (+22 overloads)

'/async-proxy-object', async () => new Proxy(new

var Proxy: ProxyConstructor new <Response>(target: Response, handler: ProxyHandler<Response>) => Response Creates a Proxy object. The Proxy object allows you to create an object that can be used in place of the original object, but which may redefine fundamental Object operations like getting, setting, and defining properties. Proxy objects are commonly used to log property accesses, validate, format, or sanitize inputs.

@param target — A target object to wrap with Proxy.

@param handler — An object whose properties define the behavior of Proxy when an operation is attempted on it.

Response('proxy'), {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

get

(method) ProxyHandler<Response>.get?(target: Response, p: string | symbol, receiver: any): any A trap for getting a property value.

@param target — The original object which is being proxied.

@param p — The name or Symbol of the property to get.

@param receiver — The proxy or an object that inherits from the proxy.

(target,

(parameter) target: Response

prop: keyof

(parameter) prop: keyof Response

Response) {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

return target

(parameter) target: Response

[prop]          

(parameter) prop: keyof Response

}, }) ) it('GET http://localhost/hello is ok', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('http://localhost/hello')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.statusText).toBe('Hono is OK')          

(property) Response.statusText: string MDN Reference

expect(await res

const res: Response

.text()).toBe('hello')          

(method) Body.text(): Promise<string> MDN Reference

}) it('GET httphello is ng', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('httphello')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) it('GET /hello is ok', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('/hello')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.statusText).toBe('Hono is OK')          

(property) Response.statusText: string MDN Reference

expect(await res

const res: Response

.text()).toBe('hello')          

(method) Body.text(): Promise<string> MDN Reference

}) it('GET hello is ok', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('hello')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.statusText).toBe('Hono is OK')          

(property) Response.statusText: string MDN Reference

expect(await res

const res: Response

.text()).toBe('hello')          

(method) Body.text(): Promise<string> MDN Reference

}) it('GET /hello-with-shortcuts is ok', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('http://localhost/hello-with-shortcuts')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(201)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Custom')).toBe('This is Hono')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toMatch(/text\/html/)          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('

Hono!!!

')          

(method) Body.text(): Promise<string> MDN Reference

}) it('GET / is not found', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('http://localhost/')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) it('GET /hello-env is ok', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('/hello-env', undefined, {

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

HELLO: 'world' })          

(property) HELLO: string

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({

(method) Body.json(): Promise<any> MDN Reference

HELLO: 'world' })          

(property) HELLO: string

}) it('GET /proxy-object is ok', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('/proxy-object')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('proxy')          

(method) Body.text(): Promise<string> MDN Reference

}) it('GET /async-proxy-object is ok', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('/proxy-object')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('proxy')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('with middleware', () => { // when using `compose()` const app = new

const app: Hono<Env, BlankSchema, "/">

Hono

(alias) new Hono<Env, BlankSchema, "/">(options?: HonoOptions<Env>): Hono<Env, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

<Env>()          

type Env = { Bindings: { _: string; }; }

app

const app: Hono<Env, BlankSchema, "/">

.use('*', async

(property) Hono<Env, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", Env>(path: "*", handler: MiddlewareHandler<Env, "*", {}>) => Hono<Env, { "*": {}; }, "/"> (+20 overloads)

(ctx,

(parameter) ctx: Context<Env, "*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

}) app

const app: Hono<Env, BlankSchema, "/">

.get('/hello', async () => {          

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/hello", "/hello", Promise<Response>, BlankInput, Env>(path: "/hello", handler: H<Env, "/hello", BlankInput, Promise<Response>>) => Hono<...> (+22 overloads)

return new Response('hello', {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 200,          

(property) ResponseInit.status?: number | undefined

statusText: 'Hono is OK',          

(property) ResponseInit.statusText?: string | undefined

}) }) app

const app: Hono<Env, BlankSchema, "/">

.get('/hello-with-shortcuts',

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/hello-with-shortcuts", "/hello-with-shortcuts", Response, BlankInput, Env>(path: "/hello-with-shortcuts", handler: H<Env, "/hello-with-shortcuts", BlankInput, Response>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<Env, "/hello-with-shortcuts", BlankInput>

c

(parameter) c: Context<Env, "/hello-with-shortcuts", BlankInput>

.header('X-Custom', 'This is Hono')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

(parameter) c: Context<Env, "/hello-with-shortcuts", BlankInput>

.status(201)          

(property) Context<Env, "/hello-with-shortcuts", BlankInput>.status: (status: StatusCode) => void

return c

(parameter) c: Context<Env, "/hello-with-shortcuts", BlankInput>

.html('

Hono!!!

')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.html: HTMLRespond <"<h1>Hono!!!</h1>">(html: "<h1>Hono!!!</h1>", status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

}) app

const app: Hono<Env, BlankSchema, "/">

.get('/hello-env',

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/hello-env", "/hello-env", JSONRespondReturn<{ _: string; }, StatusCode>, BlankInput, Env>(path: "/hello-env", handler: H<Env, "/hello-env", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<Env, "/hello-env", BlankInput>

return c

(parameter) c: Context<Env, "/hello-env", BlankInput>

.json

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ _: string; }, StatusCode>(object: { _: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ _: string; }, StatusCode> (+1 overload)

(c

(parameter) c: Context<Env, "/hello-env", BlankInput>

.env)          

(property) Context<Env, "/hello-env", BlankInput>.env: { _: string; } .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

}) app

const app: Hono<Env, BlankSchema, "/">

.get(          

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/proxy-object", "/proxy-object", Response, BlankInput, Env>(path: "/proxy-object", handler: H<Env, "/proxy-object", BlankInput, Response>) => Hono<...> (+22 overloads)

'/proxy-object', () => new Proxy(new

var Proxy: ProxyConstructor new <Response>(target: Response, handler: ProxyHandler<Response>) => Response Creates a Proxy object. The Proxy object allows you to create an object that can be used in place of the original object, but which may redefine fundamental Object operations like getting, setting, and defining properties. Proxy objects are commonly used to log property accesses, validate, format, or sanitize inputs.

@param target — A target object to wrap with Proxy.

@param handler — An object whose properties define the behavior of Proxy when an operation is attempted on it.

Response('proxy'), {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

get

(method) ProxyHandler<Response>.get?(target: Response, p: string | symbol, receiver: any): any A trap for getting a property value.

@param target — The original object which is being proxied.

@param p — The name or Symbol of the property to get.

@param receiver — The proxy or an object that inherits from the proxy.

(target,

(parameter) target: Response

prop: keyof

(parameter) prop: keyof Response

Response) {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

return target

(parameter) target: Response

[prop]          

(parameter) prop: keyof Response

}, }) ) app

const app: Hono<Env, BlankSchema, "/">

.get(          

(property) Hono<Env, BlankSchema, "/">.get: HandlerInterface <"/async-proxy-object", "/async-proxy-object", Promise<Response>, BlankInput, Env>(path: "/async-proxy-object", handler: H<Env, "/async-proxy-object", BlankInput, Promise<...>>) => Hono<...> (+22 overloads)

'/async-proxy-object', async () => new Proxy(new

var Proxy: ProxyConstructor new <Response>(target: Response, handler: ProxyHandler<Response>) => Response Creates a Proxy object. The Proxy object allows you to create an object that can be used in place of the original object, but which may redefine fundamental Object operations like getting, setting, and defining properties. Proxy objects are commonly used to log property accesses, validate, format, or sanitize inputs.

@param target — A target object to wrap with Proxy.

@param handler — An object whose properties define the behavior of Proxy when an operation is attempted on it.

Response('proxy'), {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

get

(method) ProxyHandler<Response>.get?(target: Response, p: string | symbol, receiver: any): any A trap for getting a property value.

@param target — The original object which is being proxied.

@param p — The name or Symbol of the property to get.

@param receiver — The proxy or an object that inherits from the proxy.

(target,

(parameter) target: Response

prop: keyof

(parameter) prop: keyof Response

Response) {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

return target

(parameter) target: Response

[prop]          

(parameter) prop: keyof Response

}, }) ) it('GET http://localhost/hello is ok', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('http://localhost/hello')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.statusText).toBe('Hono is OK')          

(property) Response.statusText: string MDN Reference

expect(await res

const res: Response

.text()).toBe('hello')          

(method) Body.text(): Promise<string> MDN Reference

}) it('GET httphello is ng', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('httphello')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) it('GET /hello is ok', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('/hello')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.statusText).toBe('Hono is OK')          

(property) Response.statusText: string MDN Reference

expect(await res

const res: Response

.text()).toBe('hello')          

(method) Body.text(): Promise<string> MDN Reference

}) it('GET hello is ok', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('hello')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.statusText).toBe('Hono is OK')          

(property) Response.statusText: string MDN Reference

expect(await res

const res: Response

.text()).toBe('hello')          

(method) Body.text(): Promise<string> MDN Reference

}) it('GET /hello-with-shortcuts is ok', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('http://localhost/hello-with-shortcuts')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(201)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Custom')).toBe('This is Hono')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toMatch(/text\/html/)          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('

Hono!!!

')          

(method) Body.text(): Promise<string> MDN Reference

}) it('GET / is not found', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('http://localhost/')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) it('GET /hello-env is ok', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('/hello-env', undefined, {

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

HELLO: 'world' })          

(property) HELLO: string

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({

(method) Body.json(): Promise<any> MDN Reference

HELLO: 'world' })          

(property) HELLO: string

}) it('GET /proxy-object is ok', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('/proxy-object')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('proxy')          

(method) Body.text(): Promise<string> MDN Reference

}) it('GET /async-proxy-object is ok', async () => { const res = await

const res: Response

app

const app: Hono<Env, BlankSchema, "/">

.request('/proxy-object')          

(property) Hono<Env, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { _: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('proxy')          

(method) Body.text(): Promise<string> MDN Reference

}) }) }) describe('Register handlers without a path', () => { describe('No basePath', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get(

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", BlankInput, Response & TypedResponse<"Hello", StatusCode, "text">, BlankEnv>(handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text('Hello')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Hello", StatusCode>(text: "Hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('GET http://localhost/ is ok', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Hello')          

(method) Body.text(): Promise<string> MDN Reference

}) it('GET http://localhost/anything is ok', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Hello')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('With specifying basePath', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/about">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.basePath('/about')          

(method) Hono<BlankEnv, BlankSchema, "/">.basePath<"/about">(path: "/about"): Hono<BlankEnv, BlankSchema, "/about"> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

app

const app: Hono<BlankEnv, BlankSchema, "/about">

.get(

(property) Hono<BlankEnv, BlankSchema, "/about">.get: HandlerInterface <"/about", BlankInput, Response & TypedResponse<"About", StatusCode, "text">, BlankEnv>(handler: H<BlankEnv, "/about", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/about", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/about", BlankInput>

.text('About')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"About", StatusCode>(text: "About", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('GET http://localhost/about is ok', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/about">

.request('/about')          

(property) Hono<BlankEnv, BlankSchema, "/about">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('About')          

(method) Body.text(): Promise<string> MDN Reference

}) it('GET http://localhost/ is not found', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/about">

.request('/')          

(property) Hono<BlankEnv, BlankSchema, "/about">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) }) describe('With chaining', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.post('/books')

(property) Hono<BlankEnv, BlankSchema, "/">.post: HandlerInterface <"/books", BlankInput, any>(path: "/books", ...handlers: H<BlankEnv, "/books", BlankInput, any>[]) => Hono<BlankEnv, { "/books": { $post: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; }, "/"> (+22 overloads)

.get(

(property) Hono<BlankEnv, { "/books": { $post: { input: {}; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; }, "/">.get: HandlerInterface <"/books", BlankInput, Response & TypedResponse<"Books", StatusCode, "text">, BlankEnv>(handler: H<BlankEnv, "/books", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/books", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/books", BlankInput>

.text('Books')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Books", StatusCode>(text: "Books", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('GET http://localhost/books is ok', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/books')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Books')          

(method) Body.text(): Promise<string> MDN Reference

}) it('GET http://localhost/ is not found', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) }) }) describe('router option', () => { it('Should be SmartRouter', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

expect(app

const app: Hono<BlankEnv, BlankSchema, "/">

.router instanceof

(property) Hono<BlankEnv, BlankSchema, "/">.router: Router<[H, RouterRoute]>

SmartRouter).toBe(true)          

(alias) class SmartRouter<T> import SmartRouter

}) it('Should be RegExpRouter', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono({          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

router: new

(property) router?: Router<[H, RouterRoute]> | undefined router option specifices which router to use.

@see — https://hono.dev/docs/api/hono#router-option

@example
ts const app = new Hono({ router: new RegExpRouter() })

RegExpRouter(),          

(alias) new RegExpRouter<[H, RouterRoute]>(): RegExpRouter<[H, RouterRoute]> import RegExpRouter

}) expect(app

const app: Hono<BlankEnv, BlankSchema, "/">

.router instanceof

(property) Hono<BlankEnv, BlankSchema, "/">.router: Router<[H, RouterRoute]>

RegExpRouter).toBe(true)          

(alias) class RegExpRouter<T> import RegExpRouter

}) }) describe('strict parameter', () => { describe('strict is true with not slash', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/hello',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hello", "/hello", Response & TypedResponse<"/hello", StatusCode, "text">, BlankInput, BlankEnv>(path: "/hello", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/hello", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/hello", BlankInput>

.text('/hello')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"/hello", StatusCode>(text: "/hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('/hello/ is not found', async () => { let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/hello')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/hello/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) }) describe('strict is true with slash', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/hello/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hello/", "/hello/", Response & TypedResponse<"/hello/", StatusCode, "text">, BlankInput, BlankEnv>(path: "/hello/", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/hello/", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/hello/", BlankInput>

.text('/hello/')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"/hello/", StatusCode>(text: "/hello/", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('/hello is not found', async () => { let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/hello/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/hello')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) }) describe('strict is false', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono({

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

strict: false })          

(property) strict?: boolean | undefined strict option specifies whether to distinguish whether the last path is a directory or not.

@see — https://hono.dev/docs/api/hono#strict-mode

@default
true

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/hello',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hello", "/hello", Response & TypedResponse<"/hello", StatusCode, "text">, BlankInput, BlankEnv>(path: "/hello", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/hello", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/hello", BlankInput>

.text('/hello')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"/hello", StatusCode>(text: "/hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('/hello and /hello/ are treated as the same', async () => { let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/hello')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/hello/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

}) }) describe('strict is false with `getPath` option', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono({          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

strict: false,          

(property) strict?: boolean | undefined strict option specifies whether to distinguish whether the last path is a directory or not.

@see — https://hono.dev/docs/api/hono#strict-mode

@default
true

getPath:

(property) getPath?: GetPath<BlankEnv> | undefined getPath can handle the host header value.

@see — https://hono.dev/docs/api/routing#routing-with-host-header-value

@example
```ts const app = new Hono({ getPath: (req) => '/' + req.headers.get('host') + req.url.replace(/^https?:\/\/[^/]+(\/[^?]*)/, '$1'), })

app.get('/www1.example.com/hello', () => c.text('hello www1'))

// A following request will match the route: // new Request('http://www1.example.com/hello', { // headers: { host: 'www1.example.com' }, // }) ```

getPath,          

(alias) const getPath: (request: Request) => string import getPath

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/hello',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hello", "/hello", Response & TypedResponse<"/hello", StatusCode, "text">, BlankInput, BlankEnv>(path: "/hello", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/hello", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/hello", BlankInput>

.text('/hello')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"/hello", StatusCode>(text: "/hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('/hello and /hello/ are treated as the same', async () => { let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/hello')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/hello/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

}) }) }) describe('Destruct functions in context', () => { it('Should return 200 response - text', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/text', ({

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/text", "/text", Response & TypedResponse<"foo", StatusCode, "text">, BlankInput, BlankEnv>(path: "/text", handler: H<BlankEnv, "/text", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

text }) =>

(parameter) text: TextRespond .text() can render text as Content-Type:text/plain.

text('foo'))          

(parameter) text: TextRespond <"foo", StatusCode>(text: "foo", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"foo", StatusCode, "text"> (+1 overload) .text() can render text as Content-Type:text/plain.

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/text')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

}) it('Should return 200 response - json', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/json', ({

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/json", "/json", JSONRespondReturn<{ foo: string; }, StatusCode>, BlankInput, BlankEnv>(path: "/json", handler: H<BlankEnv, "/json", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

json }) =>

(parameter) json: JSONRespond .json() can render JSON as Content-Type:application/json.

json({

(parameter) json: JSONRespond <{ foo: string; }, StatusCode>(object: { foo: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ foo: string; }, StatusCode> (+1 overload) .json() can render JSON as Content-Type:application/json.

foo: 'bar' }))          

(property) foo: string

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/json')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

}) }) describe('Routing', () => { it('Return it self', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const app2 =

const app2: Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: string; status: StatusCode; }; }; }, "/">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/', () => new

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response>) => Hono<BlankEnv, { ...; }, "/"> (+22 overloads)

Response('get /'))          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

expect(app2).not.toBeUndefined()          

const app2: Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: string; status: StatusCode; }; }; }, "/">

app2

const app2: Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: string; status: StatusCode; }; }; }, "/">

.delete('/', () => new

(property) Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: string; status: StatusCode; }; }; }, "/">.delete: HandlerInterface <"/", "/", Response, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response>) => Hono<BlankEnv, { ...; } & { ...; }, "/"> (+22 overloads)

Response('delete /'))          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

let res = await

let res: Response

app2

const app2: Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: string; status: StatusCode; }; }; }, "/">

.request('http://localhost/', {

(property) Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: string; status: StatusCode; }; }; }, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('get /')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app2

const app2: Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: string; status: StatusCode; }; }; }, "/">

.request('http://localhost/', {

(property) Hono<BlankEnv, { "/": { $get: { input: {}; output: {}; outputFormat: string; status: StatusCode; }; }; }, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'DELETE' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('delete /')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Nested route', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const book =

const book: Hono<BlankEnv, BlankSchema, "/book">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.basePath('/book')          

(method) Hono<BlankEnv, BlankSchema, "/">.basePath<"/book">(path: "/book"): Hono<BlankEnv, BlankSchema, "/book"> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

book

const book: Hono<BlankEnv, BlankSchema, "/book">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/book">.get: HandlerInterface <"/", "/book", Response & TypedResponse<"get /book", StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/book", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/book", BlankInput>

c

(parameter) c: Context<BlankEnv, "/book", BlankInput>

.text('get /book'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"get /book", StatusCode>(text: "get /book", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

book

const book: Hono<BlankEnv, BlankSchema, "/book">

.get('/:id',

(property) Hono<BlankEnv, BlankSchema, "/book">.get: HandlerInterface <"/:id", "/book/:id", Response & TypedResponse<string, StatusCode, "text">, BlankInput, BlankEnv>(path: "/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/book/:id", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/book/:id", BlankInput>

.text('get /book/' +

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<BlankEnv, "/book/:id", BlankInput>

.req

(property) Context<BlankEnv, "/book/:id", BlankInput>.req: HonoRequest<"/book/:id", unknown> .req is the instance of HonoRequest.

.param('id'))          

(method) HonoRequest<"/book/:id", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

}) book

const book: Hono<BlankEnv, BlankSchema, "/book">

.post('/',

(property) Hono<BlankEnv, BlankSchema, "/book">.post: HandlerInterface <"/", "/book", Response & TypedResponse<"post /book", StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/book", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/book", BlankInput>

c

(parameter) c: Context<BlankEnv, "/book", BlankInput>

.text('post /book'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"post /book", StatusCode>(text: "post /book", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

const user =

const user: Hono<BlankEnv, BlankSchema, "/user">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.basePath('/user')          

(method) Hono<BlankEnv, BlankSchema, "/">.basePath<"/user">(path: "/user"): Hono<BlankEnv, BlankSchema, "/user"> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

user

const user: Hono<BlankEnv, BlankSchema, "/user">

.get('/login',

(property) Hono<BlankEnv, BlankSchema, "/user">.get: HandlerInterface <"/login", "/user/login", Response & TypedResponse<"get /user/login", StatusCode, "text">, BlankInput, BlankEnv>(path: "/login", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/user/login", BlankInput>

c

(parameter) c: Context<BlankEnv, "/user/login", BlankInput>

.text('get /user/login'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"get /user/login", StatusCode>(text: "get /user/login", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

user

const user: Hono<BlankEnv, BlankSchema, "/user">

.post('/register',

(property) Hono<BlankEnv, BlankSchema, "/user">.post: HandlerInterface <"/register", "/user/register", Response & TypedResponse<"post /user/register", StatusCode, "text">, BlankInput, BlankEnv>(path: "/register", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/user/register", BlankInput>

c

(parameter) c: Context<BlankEnv, "/user/register", BlankInput>

.text('post /user/register'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"post /user/register", StatusCode>(text: "post /user/register", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

const appForEachUser =

const appForEachUser: Hono<BlankEnv, BlankSchema, "/user/:id">

user

const user: Hono<BlankEnv, BlankSchema, "/user">

.basePath(':id')          

(method) Hono<BlankEnv, BlankSchema, "/user">.basePath<":id">(path: ":id"): Hono<BlankEnv, BlankSchema, "/user/:id"> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

appForEachUser

const appForEachUser: Hono<BlankEnv, BlankSchema, "/user/:id">

.get('/profile',

(property) Hono<BlankEnv, BlankSchema, "/user/:id">.get: HandlerInterface <"/profile", "/user/:id/profile", Response & TypedResponse<string, StatusCode, "text">, BlankInput, BlankEnv>(path: "/profile", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/user/:id/profile", BlankInput>

c

(parameter) c: Context<BlankEnv, "/user/:id/profile", BlankInput>

.text('get /user/' +

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<BlankEnv, "/user/:id/profile", BlankInput>

.req

(property) Context<BlankEnv, "/user/:id/profile", BlankInput>.req: HonoRequest<"/user/:id/profile", unknown> .req is the instance of HonoRequest.

.param('id') + '/profile'))          

(method) HonoRequest<"/user/:id/profile", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/add-path-after-route-call',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/add-path-after-route-call", "/add-path-after-route-call", Response & TypedResponse<"get /add-path-after-route-call", StatusCode, "text">, BlankInput, BlankEnv>(path: "/add-path-after-route-call", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/add-path-after-route-call", BlankInput>

c

(parameter) c: Context<BlankEnv, "/add-path-after-route-call", BlankInput>

.text('get /add-path-after-route-call'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"get /add-path-after-route-call", StatusCode>(text: "get /add-path-after-route-call", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/book', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('get /book')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/book/123', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('get /book/123')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/book', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'POST' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('post /book')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/book/', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

let res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/user/login', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('get /user/login')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/user/register', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'POST' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('post /user/register')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/user/123/profile', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('get /user/123/profile')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/add-path-after-route-call', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('get /add-path-after-route-call')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Nested route - subApp with basePath', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const book = new

const book: Hono<BlankEnv, BlankSchema, "/book">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.basePath('/book')          

(method) Hono<BlankEnv, BlankSchema, "/">.basePath<"/book">(path: "/book"): Hono<BlankEnv, BlankSchema, "/book"> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

book

const book: Hono<BlankEnv, BlankSchema, "/book">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/book">.get: HandlerInterface <"/", "/book", Response & TypedResponse<"get /book", StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/book", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/book", BlankInput>

c

(parameter) c: Context<BlankEnv, "/book", BlankInput>

.text('get /book'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"get /book", StatusCode>(text: "get /book", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/api',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/api", BlankEnv, BlankSchema, "/book">(path: "/api", app: Hono<BlankEnv, BlankSchema, "/book">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

book)          

const book: Hono<BlankEnv, BlankSchema, "/book">

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/api/book', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('get /book')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Multiple route', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const book = new

const book: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

book

const book: Hono<BlankEnv, BlankSchema, "/">

.get('/hello',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hello", "/hello", Response & TypedResponse<"get /book/hello", StatusCode, "text">, BlankInput, BlankEnv>(path: "/hello", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/hello", BlankInput>

c

(parameter) c: Context<BlankEnv, "/hello", BlankInput>

.text('get /book/hello'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"get /book/hello", StatusCode>(text: "get /book/hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

const user = new

const user: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

user

const user: Hono<BlankEnv, BlankSchema, "/">

.get('/hello',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hello", "/hello", Response & TypedResponse<"get /user/hello", StatusCode, "text">, BlankInput, BlankEnv>(path: "/hello", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/hello", BlankInput>

c

(parameter) c: Context<BlankEnv, "/hello", BlankInput>

.text('get /user/hello'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"get /user/hello", StatusCode>(text: "get /user/hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/book',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/book", BlankEnv, BlankSchema, "/">(path: "/book", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

book)

const book: Hono<BlankEnv, BlankSchema, "/">

.route('/user',

(method) Hono<BlankEnv, {}, "/">.route<"/user", BlankEnv, BlankSchema, "/">(path: "/user", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {} & {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

user)          

const user: Hono<BlankEnv, BlankSchema, "/">

let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/book/hello', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('get /book/hello')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/user/hello', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('get /user/hello')          

(method) Body.text(): Promise<string> MDN Reference

}) describe('Nested route with middleware', () => { const api = new

const api: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const api2 =

const api2: Hono<{}, { "*": {}; }, "/">

api

const api: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(_c,

(parameter) _c: Context<BlankEnv, "*", {}>

next) => await

(parameter) next: Next

next())          

(parameter) next: () => Promise<void>

it('Should mount routes with no type errors', () => { const app = new

const app: Hono<BlankEnv, { "/api/*": {}; }, "/">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.route('/api',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/api", {}, { "*": {}; }, "/">(path: "/api", app: Hono<{}, { "*": {}; }, "/">): Hono<BlankEnv, { "/api/*": {}; }, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

api2)          

const api2: Hono<{}, { "*": {}; }, "/">

}) }) describe('Grouped route', () => { let one:

let one: Hono<BlankEnv, BlankSchema, "/">

Hono,

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

two:

let two: Hono<BlankEnv, BlankSchema, "/">

Hono,

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

three:

let three: Hono<BlankEnv, BlankSchema, "/">

Hono          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

beforeEach(() => { one = new

let one: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

two = new

let two: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

three = new

let three: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

}) it('only works with correct order', async () => { three

let three: Hono<BlankEnv, BlankSchema, "/">

.get('/hi',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hi", "/hi", Response & TypedResponse<"hi", StatusCode, "text">, BlankInput, BlankEnv>(path: "/hi", handler: H<BlankEnv, "/hi", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/hi", BlankInput>

c

(parameter) c: Context<BlankEnv, "/hi", BlankInput>

.text('hi'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hi", StatusCode>(text: "hi", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"hi", StatusCode, "text"> (+1 overload)

two

let two: Hono<BlankEnv, BlankSchema, "/">

.route('/three',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/three", BlankEnv, BlankSchema, "/">(path: "/three", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

three)          

let three: Hono<BlankEnv, BlankSchema, "/">

one

let one: Hono<BlankEnv, BlankSchema, "/">

.route('/two',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/two", BlankEnv, BlankSchema, "/">(path: "/two", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

two)          

let two: Hono<BlankEnv, BlankSchema, "/">

const { status } = await

const status: number MDN Reference

one

let one: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/two/three/hi', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(status).toBe(200)          

const status: number MDN Reference

}) it('fails with incorrect order 1', async () => { three

let three: Hono<BlankEnv, BlankSchema, "/">

.get('/hi',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hi", "/hi", Response & TypedResponse<"hi", StatusCode, "text">, BlankInput, BlankEnv>(path: "/hi", handler: H<BlankEnv, "/hi", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/hi", BlankInput>

c

(parameter) c: Context<BlankEnv, "/hi", BlankInput>

.text('hi'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hi", StatusCode>(text: "hi", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"hi", StatusCode, "text"> (+1 overload)

one

let one: Hono<BlankEnv, BlankSchema, "/">

.route('/two',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/two", BlankEnv, BlankSchema, "/">(path: "/two", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

two)          

let two: Hono<BlankEnv, BlankSchema, "/">

two

let two: Hono<BlankEnv, BlankSchema, "/">

.route('/three',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/three", BlankEnv, BlankSchema, "/">(path: "/three", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

three)          

let three: Hono<BlankEnv, BlankSchema, "/">

const { status } = await

const status: number MDN Reference

one

let one: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/two/three/hi', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(status).toBe(404)          

const status: number MDN Reference

}) it('fails with incorrect order 2', async () => { two

let two: Hono<BlankEnv, BlankSchema, "/">

.route('/three',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/three", BlankEnv, BlankSchema, "/">(path: "/three", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

three)          

let three: Hono<BlankEnv, BlankSchema, "/">

three

let three: Hono<BlankEnv, BlankSchema, "/">

.get('/hi',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hi", "/hi", Response & TypedResponse<"hi", StatusCode, "text">, BlankInput, BlankEnv>(path: "/hi", handler: H<BlankEnv, "/hi", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/hi", BlankInput>

c

(parameter) c: Context<BlankEnv, "/hi", BlankInput>

.text('hi'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hi", StatusCode>(text: "hi", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"hi", StatusCode, "text"> (+1 overload)

one

let one: Hono<BlankEnv, BlankSchema, "/">

.route('/two',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/two", BlankEnv, BlankSchema, "/">(path: "/two", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

two)          

let two: Hono<BlankEnv, BlankSchema, "/">

const { status } = await

const status: number MDN Reference

one

let one: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/two/three/hi', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(status).toBe(404)          

const status: number MDN Reference

}) it('fails with incorrect order 3', async () => { two

let two: Hono<BlankEnv, BlankSchema, "/">

.route('/three',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/three", BlankEnv, BlankSchema, "/">(path: "/three", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

three)          

let three: Hono<BlankEnv, BlankSchema, "/">

one

let one: Hono<BlankEnv, BlankSchema, "/">

.route('/two',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/two", BlankEnv, BlankSchema, "/">(path: "/two", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

two)          

let two: Hono<BlankEnv, BlankSchema, "/">

three

let three: Hono<BlankEnv, BlankSchema, "/">

.get('/hi',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hi", "/hi", Response & TypedResponse<"hi", StatusCode, "text">, BlankInput, BlankEnv>(path: "/hi", handler: H<BlankEnv, "/hi", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/hi", BlankInput>

c

(parameter) c: Context<BlankEnv, "/hi", BlankInput>

.text('hi'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hi", StatusCode>(text: "hi", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"hi", StatusCode, "text"> (+1 overload)

const { status } = await

const status: number MDN Reference

one

let one: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/two/three/hi', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(status).toBe(404)          

const status: number MDN Reference

}) it('fails with incorrect order 4', async () => { one

let one: Hono<BlankEnv, BlankSchema, "/">

.route('/two',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/two", BlankEnv, BlankSchema, "/">(path: "/two", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

two)          

let two: Hono<BlankEnv, BlankSchema, "/">

three

let three: Hono<BlankEnv, BlankSchema, "/">

.get('/hi',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hi", "/hi", Response & TypedResponse<"hi", StatusCode, "text">, BlankInput, BlankEnv>(path: "/hi", handler: H<BlankEnv, "/hi", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/hi", BlankInput>

c

(parameter) c: Context<BlankEnv, "/hi", BlankInput>

.text('hi'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hi", StatusCode>(text: "hi", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"hi", StatusCode, "text"> (+1 overload)

two

let two: Hono<BlankEnv, BlankSchema, "/">

.route('/three',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/three", BlankEnv, BlankSchema, "/">(path: "/three", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

three)          

let three: Hono<BlankEnv, BlankSchema, "/">

const { status } = await

const status: number MDN Reference

one

let one: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/two/three/hi', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(status).toBe(404)          

const status: number MDN Reference

}) it('fails with incorrect order 5', async () => { one

let one: Hono<BlankEnv, BlankSchema, "/">

.route('/two',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/two", BlankEnv, BlankSchema, "/">(path: "/two", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

two)          

let two: Hono<BlankEnv, BlankSchema, "/">

two

let two: Hono<BlankEnv, BlankSchema, "/">

.route('/three',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/three", BlankEnv, BlankSchema, "/">(path: "/three", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

three)          

let three: Hono<BlankEnv, BlankSchema, "/">

three

let three: Hono<BlankEnv, BlankSchema, "/">

.get('/hi',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hi", "/hi", Response & TypedResponse<"hi", StatusCode, "text">, BlankInput, BlankEnv>(path: "/hi", handler: H<BlankEnv, "/hi", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/hi", BlankInput>

c

(parameter) c: Context<BlankEnv, "/hi", BlankInput>

.text('hi'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hi", StatusCode>(text: "hi", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"hi", StatusCode, "text"> (+1 overload)

const { status } = await

const status: number MDN Reference

one

let one: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/two/three/hi', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(status).toBe(404)          

const status: number MDN Reference

}) }) it('routing with hostname', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono({          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

getPath:

(property) getPath?: GetPath<BlankEnv> | undefined getPath can handle the host header value.

@see — https://hono.dev/docs/api/routing#routing-with-host-header-value

@example
```ts const app = new Hono({ getPath: (req) => '/' + req.headers.get('host') + req.url.replace(/^https?:\/\/[^/]+(\/[^?]*)/, '$1'), })

app.get('/www1.example.com/hello', () => c.text('hello www1'))

// A following request will match the route: // new Request('http://www1.example.com/hello', { // headers: { host: 'www1.example.com' }, // }) ```

(req) =>

(parameter) req: Request

req

(parameter) req: Request

.url

(property) Request.url: string Returns the URL of request as a string.

MDN Reference

.replace(/^https?:\/(.+?)$/, '$1'),          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

}) const sub = new

const sub: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"hello sub", StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text('hello sub'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hello sub", StatusCode>(text: "hello sub", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.get('/foo',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/foo", "/foo", Response & TypedResponse<"hello sub foo", StatusCode, "text">, BlankInput, BlankEnv>(path: "/foo", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

c

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

.text('hello sub foo'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hello sub foo", StatusCode>(text: "hello sub foo", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/www1.example.com/hello', () => new

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/www1.example.com/hello", "/www1.example.com/hello", Response, BlankInput, BlankEnv>(path: "/www1.example.com/hello", handler: H<BlankEnv, "/www1.example.com/hello", BlankInput, Response>) => Hono<...> (+22 overloads)

Response('hello www1'))          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/www2.example.com/hello', () => new

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/www2.example.com/hello", "/www2.example.com/hello", Response, BlankInput, BlankEnv>(path: "/www2.example.com/hello", handler: H<BlankEnv, "/www2.example.com/hello", BlankInput, Response>) => Hono<...> (+22 overloads)

Response('hello www2'))          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/www1.example.com/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/www1.example.com/", "/www1.example.com/", Response & TypedResponse<"hello www1 root", StatusCode, "text">, BlankInput, BlankEnv>(path: "/www1.example.com/", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/www1.example.com/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/www1.example.com/", BlankInput>

.text('hello www1 root'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hello www1 root", StatusCode>(text: "hello www1 root", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/www1.example.com/sub',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/www1.example.com/sub", BlankEnv, BlankSchema, "/">(path: "/www1.example.com/sub", app: Hono<BlankEnv, BlankSchema, "/">): Hono<...> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

sub)          

const sub: Hono<BlankEnv, BlankSchema, "/">

let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://www1.example.com/hello')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello www1')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://www2.example.com/hello')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello www2')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://www1.example.com/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello www1 root')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://www1.example.com/sub')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello sub')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://www1.example.com/sub/foo')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello sub foo')          

(method) Body.text(): Promise<string> MDN Reference

}) it('routing with request header', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono({          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

getPath:

(property) getPath?: GetPath<BlankEnv> | undefined getPath can handle the host header value.

@see — https://hono.dev/docs/api/routing#routing-with-host-header-value

@example
```ts const app = new Hono({ getPath: (req) => '/' + req.headers.get('host') + req.url.replace(/^https?:\/\/[^/]+(\/[^?]*)/, '$1'), })

app.get('/www1.example.com/hello', () => c.text('hello www1'))

// A following request will match the route: // new Request('http://www1.example.com/hello', { // headers: { host: 'www1.example.com' }, // }) ```

(req) =>          

(parameter) req: Request

'/' + req

(parameter) req: Request

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.get('host') +

(method) Headers.get(name: string): string | null MDN Reference

req

(parameter) req: Request

.url

(property) Request.url: string Returns the URL of request as a string.

MDN Reference

.replace(/^https?:\/\/[^/]+(\/[^?]*)/, '$1'),          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

}) const sub = new

const sub: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"hello sub", StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text('hello sub'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hello sub", StatusCode>(text: "hello sub", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.get('/foo',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/foo", "/foo", Response & TypedResponse<"hello sub foo", StatusCode, "text">, BlankInput, BlankEnv>(path: "/foo", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

c

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

.text('hello sub foo'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hello sub foo", StatusCode>(text: "hello sub foo", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/www1.example.com/hello', () => new

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/www1.example.com/hello", "/www1.example.com/hello", Response, BlankInput, BlankEnv>(path: "/www1.example.com/hello", handler: H<BlankEnv, "/www1.example.com/hello", BlankInput, Response>) => Hono<...> (+22 overloads)

Response('hello www1'))          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/www2.example.com/hello', () => new

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/www2.example.com/hello", "/www2.example.com/hello", Response, BlankInput, BlankEnv>(path: "/www2.example.com/hello", handler: H<BlankEnv, "/www2.example.com/hello", BlankInput, Response>) => Hono<...> (+22 overloads)

Response('hello www2'))          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/www1.example.com/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/www1.example.com/", "/www1.example.com/", Response & TypedResponse<"hello www1 root", StatusCode, "text">, BlankInput, BlankEnv>(path: "/www1.example.com/", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/www1.example.com/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/www1.example.com/", BlankInput>

.text('hello www1 root'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hello www1 root", StatusCode>(text: "hello www1 root", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/www1.example.com/sub',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/www1.example.com/sub", BlankEnv, BlankSchema, "/">(path: "/www1.example.com/sub", app: Hono<BlankEnv, BlankSchema, "/">): Hono<...> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

sub)          

const sub: Hono<BlankEnv, BlankSchema, "/">

let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://www1.example.com/hello', {          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

host: 'www1.example.com',          

(property) host: string

}, }) expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello www1')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://www2.example.com/hello', {          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

host: 'www2.example.com',          

(property) host: string

}, }) expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello www2')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://www1.example.com/', {          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

host: 'www1.example.com',          

(property) host: string

}, }) expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello www1 root')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://www1.example.com/sub', {          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

host: 'www1.example.com',          

(property) host: string

}, }) expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello sub')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://www1.example.com/sub/foo', {          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

host: 'www1.example.com',          

(property) host: string

}, }) expect(res).not.toBeNull()          

let res: Response

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello sub foo')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

}) describe('routing with the bindings value', () => { const app = new

const app: Hono<{ Bindings: { host: string; }; }, BlankSchema, "/">

Hono<{

(alias) new Hono<{ Bindings: { host: string; }; }, BlankSchema, "/">(options?: HonoOptions<{ Bindings: { host: string; }; }>): Hono<{ Bindings: { host: string; }; }, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

Bindings: {

(property) Bindings: { host: string; }

host: string } }>({          

(property) host: string

getPath:

(property) getPath?: GetPath<{ Bindings: { host: string; }; }> | undefined getPath can handle the host header value.

@see — https://hono.dev/docs/api/routing#routing-with-host-header-value

@example
```ts const app = new Hono({ getPath: (req) => '/' + req.headers.get('host') + req.url.replace(/^https?:\/\/[^/]+(\/[^?]*)/, '$1'), })

app.get('/www1.example.com/hello', () => c.text('hello www1'))

// A following request will match the route: // new Request('http://www1.example.com/hello', { // headers: { host: 'www1.example.com' }, // }) ```

(req,

(parameter) req: Request

options) => {          

(parameter) options: { env?: { host: string; } | undefined; } | undefined

const url = new

const url: URL

URL

var URL: new (url: string | URL, base?: string | URL) => URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

(req

(parameter) req: Request

.url)          

(property) Request.url: string Returns the URL of request as a string.

MDN Reference

const host =

const host: string | undefined

options?

(parameter) options: { env?: { host: string; } | undefined; } | undefined

.env?

(property) env?: { host: string; } | undefined

.host          

(property) host: string | undefined

const prefix =

const prefix: "" | "/FOO"

url

const url: URL

.host ===

(property) URL.host: string MDN Reference

host ? '/FOO' : ''          

const host: string | undefined

return url

const url: URL

.pathname === '/' ?

(property) URL.pathname: string MDN Reference

prefix : `$

const prefix: "" | "/FOO"

{prefix}$

const prefix: "" | "/FOO"

{url

const url: URL

.pathname}`          

(property) URL.pathname: string MDN Reference

}, }) app

const app: Hono<{ Bindings: { host: string; }; }, BlankSchema, "/">

.get('/about',

(property) Hono<{ Bindings: { host: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/about", "/about", Response & TypedResponse<"About root", StatusCode, "text">, BlankInput, { Bindings: { host: string; }; }>(path: "/about", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<{ Bindings: { host: string; }; }, "/about", BlankInput>

c

(parameter) c: Context<{ Bindings: { host: string; }; }, "/about", BlankInput>

.text('About root'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"About root", StatusCode>(text: "About root", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

app

const app: Hono<{ Bindings: { host: string; }; }, BlankSchema, "/">

.get('/FOO/about',

(property) Hono<{ Bindings: { host: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/FOO/about", "/FOO/about", Response & TypedResponse<"About FOO", StatusCode, "text">, BlankInput, { Bindings: { host: string; }; }>(path: "/FOO/about", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<{ Bindings: { host: string; }; }, "/FOO/about", BlankInput>

c

(parameter) c: Context<{ Bindings: { host: string; }; }, "/FOO/about", BlankInput>

.text('About FOO'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"About FOO", StatusCode>(text: "About FOO", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

it('Should return 200 without specifying a hostname', async () => { const res = await

const res: Response

app

const app: Hono<{ Bindings: { host: string; }; }, BlankSchema, "/">

.request('/about')          

(property) Hono<{ Bindings: { host: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { host: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('About root')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return 200 with specifying the hostname in env', async () => { const req = new

const req: Request

Request('http://foo.localhost/about')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const res = await

const res: Response

app

const app: Hono<{ Bindings: { host: string; }; }, BlankSchema, "/">

.fetch

(property) Hono<{ Bindings: { host: string; }; }, BlankSchema, "/">.fetch: (request: Request, Env?: {} | { host: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .fetch() will be entry point of your app.

@see — https://hono.dev/docs/api/hono#fetch

@param request — request Object of request

@param Env — env Object

@param — - context of execution

@returns — response of request

(req, {

const req: Request

host: 'foo.localhost' })          

(property) host: string

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('About FOO')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('Chained route', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app          

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/chained/:abc',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/chained/:abc", "/chained/:abc", Response & TypedResponse<`GET for ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/chained/:abc", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/chained/:abc", BlankInput>

const abc =

const abc: string

c

(parameter) c: Context<BlankEnv, "/chained/:abc", BlankInput>

.req

(property) Context<BlankEnv, "/chained/:abc", BlankInput>.req: HonoRequest<"/chained/:abc", unknown> .req is the instance of HonoRequest.

.param('abc')          

(method) HonoRequest<"/chained/:abc", unknown>.param<"abc">(key: "abc"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

return c

(parameter) c: Context<BlankEnv, "/chained/:abc", BlankInput>

.text(`GET for $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`GET for ${string}`, StatusCode>(text: `GET for ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{abc}`)          

const abc: string

}) .post(

(property) Hono<BlankEnv, { "/chained/:abc": { $get: { input: { param: { abc: string; }; }; output: `GET for ${string}`; outputFormat: "text"; status: StatusCode; }; }; }, "/">.post: HandlerInterface <"/chained/:abc", BlankInput, Response & TypedResponse<`POST for ${string}`, StatusCode, "text">, BlankEnv>(handler: H<BlankEnv, "/chained/:abc", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/chained/:abc", BlankInput>

const abc =

const abc: string

c

(parameter) c: Context<BlankEnv, "/chained/:abc", BlankInput>

.req

(property) Context<BlankEnv, "/chained/:abc", BlankInput>.req: HonoRequest<"/chained/:abc", unknown> .req is the instance of HonoRequest.

.param('abc')          

(method) HonoRequest<"/chained/:abc", unknown>.param<"abc">(key: "abc"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

return c

(parameter) c: Context<BlankEnv, "/chained/:abc", BlankInput>

.text(`POST for $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`POST for ${string}`, StatusCode>(text: `POST for ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{abc}`)          

const abc: string

}) it('Should return 200 response from GET request', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/chained/abc', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'GET' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('GET for abc')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return 200 response from POST request', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/chained/abc', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'POST' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('POST for abc')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return 404 response from PUT request', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/chained/abc', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'PUT' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) }) describe('Encoded path', () => { let app:

let app: Hono<BlankEnv, BlankSchema, "/">

Hono          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

beforeEach(() => { app = new

let app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

}) it('should decode path parameter', async () => { app

let app: Hono<BlankEnv, BlankSchema, "/">

.get('/users/:id',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/users/:id", "/users/:id", Response & TypedResponse<`id is ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/users/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/users/:id", BlankInput>

c

(parameter) c: Context<BlankEnv, "/users/:id", BlankInput>

.text(`id is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`id is ${string}`, StatusCode>(text: `id is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/users/:id", BlankInput>

.req

(property) Context<BlankEnv, "/users/:id", BlankInput>.req: HonoRequest<"/users/:id", unknown> .req is the instance of HonoRequest.

.param('id')}`))          

(method) HonoRequest<"/users/:id", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

const res = await

const res: Response

app

let app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/users/%C3%A7awa%20y%C3%AE%3F')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('id is çawa yî?')          

(method) Body.text(): Promise<string> MDN Reference

}) it('should decode "/"', async () => { app

let app: Hono<BlankEnv, BlankSchema, "/">

.get('/users/:id',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/users/:id", "/users/:id", Response & TypedResponse<`id is ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/users/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/users/:id", BlankInput>

c

(parameter) c: Context<BlankEnv, "/users/:id", BlankInput>

.text(`id is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`id is ${string}`, StatusCode>(text: `id is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/users/:id", BlankInput>

.req

(property) Context<BlankEnv, "/users/:id", BlankInput>.req: HonoRequest<"/users/:id", unknown> .req is the instance of HonoRequest.

.param('id')}`))          

(method) HonoRequest<"/users/:id", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

const res = await

const res: Response

app

let app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/users/hono%2Fposts') // %2F is '/'          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('id is hono/posts')          

(method) Body.text(): Promise<string> MDN Reference

}) it('should decode alphabets', async () => { app

let app: Hono<BlankEnv, BlankSchema, "/">

.get('/users/static',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/users/static", "/users/static", Response & TypedResponse<"static", StatusCode, "text">, BlankInput, BlankEnv>(path: "/users/static", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/users/static", BlankInput>

c

(parameter) c: Context<BlankEnv, "/users/static", BlankInput>

.text('static'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"static", StatusCode>(text: "static", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

const res = await

const res: Response

app

let app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/users/%73tatic') // %73 is 's'          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('static')          

(method) Body.text(): Promise<string> MDN Reference

}) it('should decode alphabets with invalid UTF-8 sequence', async () => { app

let app: Hono<BlankEnv, BlankSchema, "/">

.get('/static/:path',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/static/:path", "/static/:path", (Response & TypedResponse<`by c.req.param: ${string}`, StatusCode, "text">) | (Response & TypedResponse<`by c.req.url: ${string}`, StatusCode, "text">), BlankInput, BlankEnv>(path: "/static/:path", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/static/:path", BlankInput>

try { return c

(parameter) c: Context<BlankEnv, "/static/:path", BlankInput>

.text(`by c.req.param: $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`by c.req.param: ${string}`, StatusCode>(text: `by c.req.param: ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/static/:path", BlankInput>

.req

(property) Context<BlankEnv, "/static/:path", BlankInput>.req: HonoRequest<"/static/:path", unknown> .req is the instance of HonoRequest.

.param('path')}`) // this should throw an error          

(method) HonoRequest<"/static/:path", unknown>.param<"path">(key: "path"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

} catch (e) {          

(local var) e: unknown

return c

(parameter) c: Context<BlankEnv, "/static/:path", BlankInput>

.text(`by c.req.url: $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`by c.req.url: ${string}`, StatusCode>(text: `by c.req.url: ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/static/:path", BlankInput>

.req

(property) Context<BlankEnv, "/static/:path", BlankInput>.req: HonoRequest<"/static/:path", unknown> .req is the instance of HonoRequest.

.url

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.url: string .url() can get the request url strings.

@see — https://hono.dev/docs/api/request#url

@example
ts app.get('/about/me', (c) => { const url = c.req.url // `http://localhost:8787/about/me` ... })

.replace(/.*\//, '')}`)          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

} }) const res = await

const res: Response

app

let app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/%73tatic/%A4%A2') // %73 is 's', %A4%A2 is invalid UTF-8 sequence          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('by c.req.url: %A4%A2')          

(method) Body.text(): Promise<string> MDN Reference

}) it('should decode alphabets with invalid percent encoding', async () => { app

let app: Hono<BlankEnv, BlankSchema, "/">

.get('/static/:path',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/static/:path", "/static/:path", (Response & TypedResponse<`by c.req.param: ${string}`, StatusCode, "text">) | (Response & TypedResponse<`by c.req.url: ${string}`, StatusCode, "text">), BlankInput, BlankEnv>(path: "/static/:path", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/static/:path", BlankInput>

try { return c

(parameter) c: Context<BlankEnv, "/static/:path", BlankInput>

.text(`by c.req.param: $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`by c.req.param: ${string}`, StatusCode>(text: `by c.req.param: ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/static/:path", BlankInput>

.req

(property) Context<BlankEnv, "/static/:path", BlankInput>.req: HonoRequest<"/static/:path", unknown> .req is the instance of HonoRequest.

.param('path')}`) // this should throw an error          

(method) HonoRequest<"/static/:path", unknown>.param<"path">(key: "path"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

} catch (e) {          

(local var) e: unknown

return c

(parameter) c: Context<BlankEnv, "/static/:path", BlankInput>

.text(`by c.req.url: $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`by c.req.url: ${string}`, StatusCode>(text: `by c.req.url: ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/static/:path", BlankInput>

.req

(property) Context<BlankEnv, "/static/:path", BlankInput>.req: HonoRequest<"/static/:path", unknown> .req is the instance of HonoRequest.

.url

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.url: string .url() can get the request url strings.

@see — https://hono.dev/docs/api/request#url

@example
ts app.get('/about/me', (c) => { const url = c.req.url // `http://localhost:8787/about/me` ... })

.replace(/.*\//, '')}`)          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

} }) const res = await

const res: Response

app

let app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/%73tatic/%a') // %73 is 's', %a is invalid percent encoding          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('by c.req.url: %a')          

(method) Body.text(): Promise<string> MDN Reference

}) it('should be able to catch URIError', async () => { app

let app: Hono<BlankEnv, BlankSchema, "/">

.onError(

(property) Hono<BlankEnv, BlankSchema, "/">.onError: (handler: ErrorHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .onError() handles an error and returns a customized Response.

@see — https://hono.dev/docs/api/hono#error-handling

@param handler — request Handler for error

@returns — changed Hono instance

@example
ts app.onError((err, c) => { console.error(`${err}`) return c.text('Custom Error Message', 500) })

(err,

(parameter) err: Error | HTTPResponseError

c) => {          

(parameter) c: Context<BlankEnv, any, {}>

if (err instanceof

(parameter) err: Error | HTTPResponseError

URIError) {          

var URIError: URIErrorConstructor

return c

(parameter) c: Context<BlankEnv, any, {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, 400>(text: string, status?: 400 | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, 400, "text"> (+1 overload)

(err

(parameter) err: URIError

.message, 400)          

(property) Error.message: string

} throw err          

(parameter) err: Error | HTTPResponseError

}) app

let app: Hono<BlankEnv, BlankSchema, "/">

.get('/static/:path',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/static/:path", "/static/:path", Response & TypedResponse<`by c.req.param: ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/static/:path", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/static/:path", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/static/:path", BlankInput>

.text(`by c.req.param: $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`by c.req.param: ${string}`, StatusCode>(text: `by c.req.param: ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/static/:path", BlankInput>

.req

(property) Context<BlankEnv, "/static/:path", BlankInput>.req: HonoRequest<"/static/:path", unknown> .req is the instance of HonoRequest.

.param('path')}`) // this should throw an error          

(method) HonoRequest<"/static/:path", unknown>.param<"path">(key: "path"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

}) const res = await

const res: Response

app

let app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/%73tatic/%a') // %73 is 's', %a is invalid percent encoding          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(400)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('URI malformed')          

(method) Body.text(): Promise<string> MDN Reference

}) it('should not double decode', async () => { app

let app: Hono<BlankEnv, BlankSchema, "/">

.get('/users/:id',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/users/:id", "/users/:id", Response & TypedResponse<`posts of ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/users/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/users/:id", BlankInput>

c

(parameter) c: Context<BlankEnv, "/users/:id", BlankInput>

.text(`posts of $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`posts of ${string}`, StatusCode>(text: `posts of ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/users/:id", BlankInput>

.req

(property) Context<BlankEnv, "/users/:id", BlankInput>.req: HonoRequest<"/users/:id", unknown> .req is the instance of HonoRequest.

.param('id')}`))          

(method) HonoRequest<"/users/:id", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

const res = await

const res: Response

app

let app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/users/%2525') // %25 is '%'          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('posts of %25')          

(method) Body.text(): Promise<string> MDN Reference

}) }) }) describe('param and query', () => { const apps:

const apps: Record<string, Hono<BlankEnv, BlankSchema, "/">>

Record

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

Hono> = {}          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

apps['get by name'] = (() => {          

const apps: Record<string, Hono<BlankEnv, BlankSchema, "/">>

const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/entry/:id',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/entry/:id", "/entry/:id", Response & TypedResponse<`id is ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/entry/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/entry/:id", BlankInput>

const id =

const id: string

c

(parameter) c: Context<BlankEnv, "/entry/:id", BlankInput>

.req

(property) Context<BlankEnv, "/entry/:id", BlankInput>.req: HonoRequest<"/entry/:id", unknown> .req is the instance of HonoRequest.

.param('id')          

(method) HonoRequest<"/entry/:id", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

return c

(parameter) c: Context<BlankEnv, "/entry/:id", BlankInput>

.text(`id is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`id is ${string}`, StatusCode>(text: `id is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{id}`)          

const id: string

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/date/:date{[0-9]+}',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/date/:date{[0-9]+}", "/date/:date{[0-9]+}", Response & TypedResponse<`date is ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/date/:date{[0-9]+}", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/date/:date{[0-9]+}", BlankInput>

const date =

const date: string

c

(parameter) c: Context<BlankEnv, "/date/:date{[0-9]+}", BlankInput>

.req

(property) Context<BlankEnv, "/date/:date{[0-9]+}", BlankInput>.req: HonoRequest<"/date/:date{[0-9]+}", unknown> .req is the instance of HonoRequest.

.param('date')          

(method) HonoRequest<"/date/:date{[0-9]+}", unknown>.param<"date">(key: "date"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

return c

(parameter) c: Context<BlankEnv, "/date/:date{[0-9]+}", BlankInput>

.text(`date is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`date is ${string}`, StatusCode>(text: `date is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{date}`)          

const date: string

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/search',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/search", "/search", Response & TypedResponse<`name is ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/search", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/search", BlankInput>

const name =

const name: string | undefined

c

(parameter) c: Context<BlankEnv, "/search", BlankInput>

.req

(property) Context<BlankEnv, "/search", BlankInput>.req: HonoRequest<"/search", unknown> .req is the instance of HonoRequest.

.query('name')          

(method) HonoRequest<"/search", unknown>.query(key: string): string | undefined (+1 overload) .query() can get querystring parameters.

@see — https://hono.dev/docs/api/request#query

@example
```ts // Query params app.get('/search', (c) => { const query = c.req.query('q') })

// Get all params at once app.get('/search', (c) => { const { q, limit, offset } = c.req.query() }) ```

return c

(parameter) c: Context<BlankEnv, "/search", BlankInput>

.text(`name is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`name is ${string}`, StatusCode>(text: `name is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{name}`)          

const name: string | undefined

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/multiple-values',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/multiple-values", "/multiple-values", Response & TypedResponse<`q is ${string} and ${string}, limit is ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/multiple-values", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/multiple-values", BlankInput>

const queries =

const queries: string[]

c

(parameter) c: Context<BlankEnv, "/multiple-values", BlankInput>

.req

(property) Context<BlankEnv, "/multiple-values", BlankInput>.req: HonoRequest<"/multiple-values", unknown> .req is the instance of HonoRequest.

.queries('q') ??

(method) HonoRequest<"/multiple-values", unknown>.queries(key: string): string[] | undefined (+1 overload) .queries() can get multiple querystring parameter values, e.g. /search?tags=A&tags=B

@see — https://hono.dev/docs/api/request#queries

@example
ts app.get('/search', (c) => { // tags will be string[] const tags = c.req.queries('tags') })

throwExpression('missing query values')          

function throwExpression(errorMessage: string): never

const limit =

const limit: string[]

c

(parameter) c: Context<BlankEnv, "/multiple-values", BlankInput>

.req

(property) Context<BlankEnv, "/multiple-values", BlankInput>.req: HonoRequest<"/multiple-values", unknown> .req is the instance of HonoRequest.

.queries('limit') ??

(method) HonoRequest<"/multiple-values", unknown>.queries(key: string): string[] | undefined (+1 overload) .queries() can get multiple querystring parameter values, e.g. /search?tags=A&tags=B

@see — https://hono.dev/docs/api/request#queries

@example
ts app.get('/search', (c) => { // tags will be string[] const tags = c.req.queries('tags') })

throwExpression('missing query values')          

function throwExpression(errorMessage: string): never

return c

(parameter) c: Context<BlankEnv, "/multiple-values", BlankInput>

.text(`q is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`q is ${string} and ${string}, limit is ${string}`, StatusCode>(text: `q is ${string} and ${string}, limit is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{queries[0]} and $

const queries: string[]

{queries[1]}, limit is $

const queries: string[]

{limit[0]}`)          

const limit: string[]

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/add-header',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/add-header", "/add-header", Response & TypedResponse<`foo is ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/add-header", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/add-header", BlankInput>

const bar =

const bar: string | undefined

c

(parameter) c: Context<BlankEnv, "/add-header", BlankInput>

.req

(property) Context<BlankEnv, "/add-header", BlankInput>.req: HonoRequest<"/add-header", unknown> .req is the instance of HonoRequest.

.header('X-Foo')          

(method) HonoRequest<"/add-header", unknown>.header(name: string): string | undefined (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

return c

(parameter) c: Context<BlankEnv, "/add-header", BlankInput>

.text(`foo is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`foo is ${string}`, StatusCode>(text: `foo is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{bar}`)          

const bar: string | undefined

}) return app          

const app: Hono<BlankEnv, BlankSchema, "/">

})() apps['get all as an object'] = (() => {          

const apps: Record<string, Hono<BlankEnv, BlankSchema, "/">>

const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/entry/:id',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/entry/:id", "/entry/:id", Response & TypedResponse<`id is ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/entry/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/entry/:id", BlankInput>

const { id } =

const id: string

c

(parameter) c: Context<BlankEnv, "/entry/:id", BlankInput>

.req

(property) Context<BlankEnv, "/entry/:id", BlankInput>.req: HonoRequest<"/entry/:id", unknown> .req is the instance of HonoRequest.

.param()          

(method) HonoRequest<"/entry/:id", unknown>.param<"/entry/:id">(): { id: string; } (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

return c

(parameter) c: Context<BlankEnv, "/entry/:id", BlankInput>

.text(`id is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`id is ${string}`, StatusCode>(text: `id is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{id}`)          

const id: string

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/date/:date{[0-9]+}',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/date/:date{[0-9]+}", "/date/:date{[0-9]+}", Response & TypedResponse<`date is ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/date/:date{[0-9]+}", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/date/:date{[0-9]+}", BlankInput>

const { date } =

const date: string

c

(parameter) c: Context<BlankEnv, "/date/:date{[0-9]+}", BlankInput>

.req

(property) Context<BlankEnv, "/date/:date{[0-9]+}", BlankInput>.req: HonoRequest<"/date/:date{[0-9]+}", unknown> .req is the instance of HonoRequest.

.param()          

(method) HonoRequest<"/date/:date{[0-9]+}", unknown>.param<"/date/:date{[0-9]+}">(): { date: string; } (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

return c

(parameter) c: Context<BlankEnv, "/date/:date{[0-9]+}", BlankInput>

.text(`date is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`date is ${string}`, StatusCode>(text: `date is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{date}`)          

const date: string

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/search',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/search", "/search", Response & TypedResponse<`name is ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/search", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/search", BlankInput>

const { name } =

const name: string

c

(parameter) c: Context<BlankEnv, "/search", BlankInput>

.req

(property) Context<BlankEnv, "/search", BlankInput>.req: HonoRequest<"/search", unknown> .req is the instance of HonoRequest.

.query()          

(method) HonoRequest<"/search", unknown>.query(): Record<string, string> (+1 overload) .query() can get querystring parameters.

@see — https://hono.dev/docs/api/request#query

@example
```ts // Query params app.get('/search', (c) => { const query = c.req.query('q') })

// Get all params at once app.get('/search', (c) => { const { q, limit, offset } = c.req.query() }) ```

return c

(parameter) c: Context<BlankEnv, "/search", BlankInput>

.text(`name is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`name is ${string}`, StatusCode>(text: `name is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{name}`)          

const name: string

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/multiple-values',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/multiple-values", "/multiple-values", Response & TypedResponse<`q is ${string} and ${string}, limit is ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/multiple-values", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/multiple-values", BlankInput>

const { q,

const q: string[]

limit } =

const limit: string[]

c

(parameter) c: Context<BlankEnv, "/multiple-values", BlankInput>

.req

(property) Context<BlankEnv, "/multiple-values", BlankInput>.req: HonoRequest<"/multiple-values", unknown> .req is the instance of HonoRequest.

.queries()          

(method) HonoRequest<"/multiple-values", unknown>.queries(): Record<string, string[]> (+1 overload) .queries() can get multiple querystring parameter values, e.g. /search?tags=A&tags=B

@see — https://hono.dev/docs/api/request#queries

@example
ts app.get('/search', (c) => { // tags will be string[] const tags = c.req.queries('tags') })

return c

(parameter) c: Context<BlankEnv, "/multiple-values", BlankInput>

.text(`q is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`q is ${string} and ${string}, limit is ${string}`, StatusCode>(text: `q is ${string} and ${string}, limit is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{q[0]} and $

const q: string[]

{q[1]}, limit is $

const q: string[]

{limit[0]}`)          

const limit: string[]

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/add-header',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/add-header", "/add-header", Response & TypedResponse<`foo is ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/add-header", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/add-header", BlankInput>

const { 'x-foo': bar } =

const bar: string

c

(parameter) c: Context<BlankEnv, "/add-header", BlankInput>

.req

(property) Context<BlankEnv, "/add-header", BlankInput>.req: HonoRequest<"/add-header", unknown> .req is the instance of HonoRequest.

.header()          

(method) HonoRequest<"/add-header", unknown>.header(): Record<string, string> (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

return c

(parameter) c: Context<BlankEnv, "/add-header", BlankInput>

.text(`foo is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`foo is ${string}`, StatusCode>(text: `foo is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{bar}`)          

const bar: string

}) return app          

const app: Hono<BlankEnv, BlankSchema, "/">

})() describe.each(Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.keys

(method) ObjectConstructor.keys(o: {}): string[] (+1 overload) Returns the names of the enumerable string properties and methods of an object.

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(apps))('%s',

const apps: Record<string, Hono<BlankEnv, BlankSchema, "/">>

(name) => {          

(parameter) name: any

const app =

const app: Hono<BlankEnv, BlankSchema, "/">

apps

const apps: Record<string, Hono<BlankEnv, BlankSchema, "/">>

[name]          

(parameter) name: any

it('param of /entry/:id is found', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/entry/123')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('id is 123')          

(method) Body.text(): Promise<string> MDN Reference

}) it('param of /entry/:id is found, even for Array object method names', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/entry/key')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('id is key')          

(method) Body.text(): Promise<string> MDN Reference

}) it('param of /entry/:id is decoded', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/entry/%C3%A7awa%20y%C3%AE%3F')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('id is çawa yî?')          

(method) Body.text(): Promise<string> MDN Reference

}) it('param of /date/:date is found', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/date/0401')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('date is 0401')          

(method) Body.text(): Promise<string> MDN Reference

}) it('query of /search?name=sam is found', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/search?name=sam')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('name is sam')          

(method) Body.text(): Promise<string> MDN Reference

}) it('query of /search?name=sam&name=tom is found', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/search?name=sam&name=tom')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('name is sam')          

(method) Body.text(): Promise<string> MDN Reference

}) it('query of /multiple-values?q=foo&q=bar&limit=10 is found', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/multiple-values?q=foo&q=bar&limit=10')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('q is foo and bar, limit is 10')          

(method) Body.text(): Promise<string> MDN Reference

}) it('/add-header header - X-Foo is Bar', async () => { const req = new

const req: Request

Request('http://localhost/add-header')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

req

const req: Request

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.append('X-Foo', 'Bar')          

(method) Headers.append(name: string, value: string): void MDN Reference

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('foo is Bar')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('param with undefined', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/foo/:foo',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/foo/:foo", "/foo/:foo", JSONRespondReturn<{ foo: string | undefined; }, StatusCode>, BlankInput, BlankEnv>(path: "/foo/:foo", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/foo/:foo", BlankInput>

const bar =

const bar: string | undefined

c

(parameter) c: Context<BlankEnv, "/foo/:foo", BlankInput>

.req

(property) Context<BlankEnv, "/foo/:foo", BlankInput>.req: HonoRequest<"/foo/:foo", unknown> .req is the instance of HonoRequest.

.param('bar')          

(method) HonoRequest<"/foo/:foo", unknown>.param(key: string): string | undefined (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

return c

(parameter) c: Context<BlankEnv, "/foo/:foo", BlankInput>

.json({

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ foo: string | undefined; }, StatusCode>(object: { foo: string | undefined; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

foo:

(property) foo: string | undefined

bar })          

const bar: string | undefined

}) it('param of /foo/foo should return undefined not "undefined"', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/foo/foo')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({

(method) Body.json(): Promise<any> MDN Reference

foo: undefined })          

(property) foo: undefined

}) }) }) describe('c.req.path', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<string, StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.req

(property) Context<BlankEnv, "/", BlankInput>.req: HonoRequest<"/", unknown> .req is the instance of HonoRequest.

.path))          

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.path: string .path can get the pathname of the request.

@see — https://hono.dev/docs/api/request#path

@example
ts app.get('/about/me', (c) => { const pathname = c.req.path // `/about/me` })

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/search',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/search", "/search", Response & TypedResponse<string, StatusCode, "text">, BlankInput, BlankEnv>(path: "/search", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/search", BlankInput>

c

(parameter) c: Context<BlankEnv, "/search", BlankInput>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<BlankEnv, "/search", BlankInput>

.req

(property) Context<BlankEnv, "/search", BlankInput>.req: HonoRequest<"/search", unknown> .req is the instance of HonoRequest.

.path))          

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.path: string .path can get the pathname of the request.

@see — https://hono.dev/docs/api/request#path

@example
ts app.get('/about/me', (c) => { const pathname = c.req.path // `/about/me` })

it('Should get the path `/` correctly', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('/')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should get the path `/search` correctly with a query', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/search?query=hono')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('/search')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('Header', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/text',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/text", "/text", Response & TypedResponse<"Hello", StatusCode, "text">, BlankInput, BlankEnv>(path: "/text", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/text", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/text", BlankInput>

.text('Hello')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Hello", StatusCode>(text: "Hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/text-with-custom-header',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/text-with-custom-header", "/text-with-custom-header", Response & TypedResponse<"Hello", StatusCode, "text">, BlankInput, BlankEnv>(path: "/text-with-custom-header", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/text-with-custom-header", BlankInput>

c

(parameter) c: Context<BlankEnv, "/text-with-custom-header", BlankInput>

.header('X-Custom', 'Message')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

return c

(parameter) c: Context<BlankEnv, "/text-with-custom-header", BlankInput>

.text('Hello')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Hello", StatusCode>(text: "Hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Should return correct headers - /text', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/text')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('content-type')).toMatch(/^text\/plain/)          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('Hello')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return correct headers - /text-with-custom-header', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/text-with-custom-header')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-custom')).toBe('Message')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('content-type')).toMatch(/^text\/plain/)          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('Hello')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('Middleware', () => { describe('Basic', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

// Custom Logger app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "*", {}>

next) => {          

(parameter) next: Next

console

var console: Console

.log(`$

(method) Console.log(...data: any[]): void MDN Reference

{c

(parameter) c: Context<BlankEnv, "*", {}>

.req

(property) Context<BlankEnv, "*", {}>.req: HonoRequest<"*", unknown> .req is the instance of HonoRequest.

.method} : $

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.method: string .method() can get the method name of the request.

@see — https://hono.dev/docs/api/request#method

@example
ts app.get('/about/me', (c) => { const method = c.req.method // `GET` })

{c

(parameter) c: Context<BlankEnv, "*", {}>

.req

(property) Context<BlankEnv, "*", {}>.req: HonoRequest<"*", unknown> .req is the instance of HonoRequest.

.url}`)          

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.url: string .url() can get the request url strings.

@see — https://hono.dev/docs/api/request#url

@example
ts app.get('/about/me', (c) => { const url = c.req.url // `http://localhost:8787/about/me` ... })

await next()          

(parameter) next: () => Promise<void>

}) // Append Custom Header app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<BlankEnv, "*", {}>

.res

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.append('x-custom', 'root')          

(method) Headers.append(name: string, value: string): void MDN Reference

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/hello', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/hello", "/hello", BlankEnv>(path: "/hello", handler: MiddlewareHandler<BlankEnv, "/hello", {}>) => Hono<{}, { "/hello": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "/hello", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<BlankEnv, "/hello", {}>

.res

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.append('x-message', 'custom-header')          

(method) Headers.append(name: string, value: string): void MDN Reference

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/hello/*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/hello/*", "/hello/*", BlankEnv>(path: "/hello/*", handler: MiddlewareHandler<BlankEnv, "/hello/*", {}>) => Hono<{}, { "/hello/*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "/hello/*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<BlankEnv, "/hello/*", {}>

.res

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.append('x-message-2', 'custom-header-2')          

(method) Headers.append(name: string, value: string): void MDN Reference

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/hello',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hello", "/hello", Response & TypedResponse<"hello", StatusCode, "text">, BlankInput, BlankEnv>(path: "/hello", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/hello", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/hello", BlankInput>

.text('hello')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hello", StatusCode>(text: "hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/json/*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/json/*", "/json/*", BlankEnv>(path: "/json/*", handler: MiddlewareHandler<BlankEnv, "/json/*", {}>) => Hono<{}, { "/json/*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "/json/*", {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<BlankEnv, "/json/*", {}>

.res

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.append('foo', 'bar')          

(method) Headers.append(name: string, value: string): void MDN Reference

await next()          

(parameter) next: () => Promise<void>

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/json',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/json", "/json", Response, BlankInput, BlankEnv>(path: "/json", handler: H<BlankEnv, "/json", BlankInput, Response>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/json", BlankInput>

// With a raw response return new Response(          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

JSON

var JSON: JSON An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.

.stringify({          

(method) JSON.stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string (+1 overload) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.

@param value — A JavaScript value, usually an object or array, to be converted.

@param replacer — A function that transforms the results.

@param space — Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.

message: 'hello',          

(property) message: string

}), { headers: {          

(property) ResponseInit.headers?: HeadersInit | undefined

'content-type': 'application/json', }, } ) }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/hello/:message',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hello/:message", "/hello/:message", Response & TypedResponse<string, StatusCode, "text">, BlankInput, BlankEnv>(path: "/hello/:message", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/hello/:message", BlankInput>

const message =

const message: string

c

(parameter) c: Context<BlankEnv, "/hello/:message", BlankInput>

.req

(property) Context<BlankEnv, "/hello/:message", BlankInput>.req: HonoRequest<"/hello/:message", unknown> .req is the instance of HonoRequest.

.param('message')          

(method) HonoRequest<"/hello/:message", unknown>.param<"message">(key: "message"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

return c

(parameter) c: Context<BlankEnv, "/hello/:message", BlankInput>

.text(`$

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

{message}`)          

const message: string

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/error', () => {          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/error", "/error", never, BlankInput, BlankEnv>(path: "/error", handler: H<BlankEnv, "/error", BlankInput, never>) => Hono<BlankEnv, { ...; }, "/"> (+22 overloads)

throw new Error('Error!')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.notFound(

(property) Hono<BlankEnv, BlankSchema, "/">.notFound: (handler: NotFoundHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .notFound() allows you to customize a Not Found Response.

@see — https://hono.dev/docs/api/hono#not-found

@param handler — request handler for not-found

@returns — changed Hono instance

@example
ts app.notFound((c) => { return c.text('Custom 404 Message', 404) })

(c) => {          

(parameter) c: Context<BlankEnv, any, {}>

return c

(parameter) c: Context<BlankEnv, any, {}>

.text('Not Found Foo', 404)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Not Found Foo", 404>(text: "Not Found Foo", status?: 404 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Not Found Foo", 404, "text"> (+1 overload)

}) it('logging and custom header', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/hello')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('hello')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-custom')).toBe('root')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-message')).toBe('custom-header')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-message-2')).toBe('custom-header-2')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('logging and custom header with named param', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/hello/message')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('message')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-custom')).toBe('root')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-message-2')).toBe('custom-header-2')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('should return correct the content-type header', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/json')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('content-type')).toMatch(/^application\/json/)          

(method) Headers.get(name: string): string | null MDN Reference

}) it('not found', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/foo')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Not Found Foo')          

(method) Body.text(): Promise<string> MDN Reference

}) it('internal server error', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/error')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(500)          

(property) Response.status: number MDN Reference

console

var console: Console

.log(await

(method) Console.log(...data: any[]): void MDN Reference

res

const res: Response

.text())          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('Chained route', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app          

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/chained/*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/chained/*", "/chained/*", BlankEnv>(path: "/chained/*", handler: MiddlewareHandler<BlankEnv, "/chained/*", {}>) => Hono<{}, { "/chained/*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "/chained/*", {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<BlankEnv, "/chained/*", {}>

.req

(property) Context<BlankEnv, "/chained/*", {}>.req: HonoRequest<"/chained/*", unknown> .req is the instance of HonoRequest.

.raw

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.append('x-before', 'abc')          

(method) Headers.append(name: string, value: string): void MDN Reference

await next()          

(parameter) next: () => Promise<void>

}) .use(async

(property) Hono<{}, { "/chained/*": {}; }, "/">.use: MiddlewareHandlerInterface <{}>(...handlers: MiddlewareHandler<{}, "/chained/*", {}>[]) => Hono<{}, { "/chained/*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<{}, "/chained/*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<{}, "/chained/*", {}>

.header(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

'x-after', c

(parameter) c: Context<{}, "/chained/*", {}>

.req

(property) Context<{}, "/chained/*", {}>.req: HonoRequest<"/chained/*", unknown> .req is the instance of HonoRequest.

.header('x-before') ??

(method) HonoRequest<"/chained/*", unknown>.header(name: string): string | undefined (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

throwExpression('missing `x-before` header')          

function throwExpression(errorMessage: string): never

) }) .get('/chained/abc',

(property) Hono<{}, { "/chained/*": {}; }, "/">.get: HandlerInterface <"/chained/abc", "/chained/abc", Response & TypedResponse<"GET chained", StatusCode, "text">, BlankInput, {}>(path: "/chained/abc", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<{}, "/chained/abc", BlankInput>

return c

(parameter) c: Context<{}, "/chained/abc", BlankInput>

.text('GET chained')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"GET chained", StatusCode>(text: "GET chained", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('GET /chained/abc', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/chained/abc')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('GET chained')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-after')).toBe('abc')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('Multiple handler', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app          

const app: Hono<BlankEnv, BlankSchema, "/">

.use(          

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/multiple/*", "/multiple/*", BlankEnv, {}>(path: "/multiple/*", handlers_0: MiddlewareHandler<BlankEnv, "/multiple/*", {}>, handlers_1: MiddlewareHandler<{}, "/multiple/*", {}>) => Hono<...> (+20 overloads)

'/multiple/*', async (c,

(parameter) c: Context<BlankEnv, "/multiple/*", {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<BlankEnv, "/multiple/*", {}>

.req

(property) Context<BlankEnv, "/multiple/*", {}>.req: HonoRequest<"/multiple/*", unknown> .req is the instance of HonoRequest.

.raw

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.append('x-before', 'abc')          

(method) Headers.append(name: string, value: string): void MDN Reference

await next()          

(parameter) next: () => Promise<void>

}, async (c,

(parameter) c: Context<{}, "/multiple/*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<{}, "/multiple/*", {}>

.header(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

'x-after', c

(parameter) c: Context<{}, "/multiple/*", {}>

.req

(property) Context<{}, "/multiple/*", {}>.req: HonoRequest<"/multiple/*", unknown> .req is the instance of HonoRequest.

.header('x-before') ??

(method) HonoRequest<"/multiple/*", unknown>.header(name: string): string | undefined (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

throwExpression('missing `x-before` header')          

function throwExpression(errorMessage: string): never

) } ) .get('/multiple/abc',

(property) Hono<{}, { "/multiple/*": {}; }, "/">.get: HandlerInterface <"/multiple/abc", "/multiple/abc", Response & TypedResponse<"GET multiple", StatusCode, "text">, BlankInput, {}>(path: "/multiple/abc", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<{}, "/multiple/abc", BlankInput>

return c

(parameter) c: Context<{}, "/multiple/abc", BlankInput>

.text('GET multiple')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"GET multiple", StatusCode>(text: "GET multiple", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('GET /multiple/abc', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/multiple/abc')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('GET multiple')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-after')).toBe('abc')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('Overwrite the response from middleware after next()', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/normal', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/normal", "/normal", BlankEnv>(path: "/normal", handler: MiddlewareHandler<BlankEnv, "/normal", {}>) => Hono<{}, { "/normal": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "/normal", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<BlankEnv, "/normal", {}>

.res = new

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

Response('Middleware')          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/overwrite', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/overwrite", "/overwrite", BlankEnv>(path: "/overwrite", handler: MiddlewareHandler<BlankEnv, "/overwrite", {}>) => Hono<{}, { "/overwrite": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "/overwrite", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<BlankEnv, "/overwrite", {}>

.res = undefined          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

c

(parameter) c: Context<BlankEnv, "/overwrite", {}>

.res = new

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

Response('Middleware')          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('*',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"*", "*", Response & TypedResponse<"Handler", StatusCode, "text">, BlankInput, BlankEnv>(path: "*", handler: H<BlankEnv, "*", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "*", BlankInput>

c

(parameter) c: Context<BlankEnv, "*", BlankInput>

.header('x-custom', 'foo')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

return c

(parameter) c: Context<BlankEnv, "*", BlankInput>

.text('Handler')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Handler", StatusCode>(text: "Handler", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Should have the custom header', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/normal')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-custom')).toBe('foo')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('Should not have the custom header', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/overwrite')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-custom')).toBe(null)          

(method) Headers.get(name: string): string | null MDN Reference

}) }) }) describe('Builtin Middleware', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/abc',

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/abc", "/abc", any>(path: "/abc", handler: MiddlewareHandler<any, "/abc", {}>) => Hono<{}, { "/abc": {}; }, "/"> (+20 overloads)

poweredBy())          

(alias) poweredBy(): MiddlewareHandler import poweredBy

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/def', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/def", "/def", BlankEnv>(path: "/def", handler: MiddlewareHandler<BlankEnv, "/def", {}>) => Hono<{}, { "/def": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "/def", {}>

next) => {          

(parameter) next: Next

const middleware =

const middleware: MiddlewareHandler

poweredBy()          

(alias) poweredBy(): MiddlewareHandler import poweredBy

await middleware

const middleware: (c: Context<any, string, {}>, next: Next) => Promise<Response | void>

(c,

(parameter) c: Context<BlankEnv, "/def", {}>

next)          

(parameter) next: Next

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/abc', () => new

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/abc", "/abc", Response, BlankInput, BlankEnv>(path: "/abc", handler: H<BlankEnv, "/abc", BlankInput, Response>) => Hono<...> (+22 overloads)

Response())          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/def', () => new

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/def", "/def", Response, BlankInput, BlankEnv>(path: "/def", handler: H<BlankEnv, "/def", BlankInput, Response>) => Hono<...> (+22 overloads)

Response())          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

it('"powered-by" middleware', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/abc')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-powered-by')).toBe('Hono')          

(method) Headers.get(name: string): string | null MDN Reference

}) it('"powered-by" middleware in a handler', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/def')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-powered-by')).toBe('Hono')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('Middleware with app.HTTP_METHOD', () => { describe('Basic', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.all('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.all: HandlerInterface <"*", "*", HandlerResponse<any>, BlankInput, BlankEnv>(path: "*", handler: H<BlankEnv, "*", BlankInput, HandlerResponse<any>>) => Hono<...> (+22 overloads)

(c,

(parameter) c: Context<BlankEnv, "*", BlankInput>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<BlankEnv, "*", BlankInput>

.header('x-before-dispatch', 'foo')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<BlankEnv, "*", BlankInput>

.header('x-custom-message', 'hello')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

}) const customHeader = async

const customHeader: (c: Context, next: Next) => Promise<void>

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

next:

(parameter) next: Next

Next) => {          

(alias) type Next = () => Promise<void> import Next

c

(parameter) c: Context<any, any, {}>

.req

(property) Context<any, any, {}>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.raw

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.raw: Request .raw can get the raw Request object.

@see — https://hono.dev/docs/api/request#raw

@example
ts // For Cloudflare Workers app.post('/', async (c) => { const metadata = c.req.raw.cf?.hostMetadata? ... })

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.append('x-custom-foo', 'bar')          

(method) Headers.append(name: string, value: string): void MDN Reference

await next()          

(parameter) next: () => Promise<void>

} const customHeader2 = async

const customHeader2: (c: Context, next: Next) => Promise<void>

(c:

(parameter) c: Context<any, any, {}>

Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> import Context

next:

(parameter) next: Next

Next) => {          

(alias) type Next = () => Promise<void> import Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<any, any, {}>

.header('x-custom-foo-2', 'bar-2')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

} app          

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/abc',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/abc", any, Response & TypedResponse<string, StatusCode, "text">, {}, {}, any, {}>(path: "/abc", handlers_0: H<any, any, {}, any>, handlers_1: H<{}, any, {}, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

customHeader,

const customHeader: (c: Context, next: Next) => Promise<void>

(c) => {          

(parameter) c: Context<{}, any, {}>

const foo =

const foo: string

c

(parameter) c: Context<{}, any, {}>

.req

(property) Context<{}, any, {}>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.header('x-custom-foo') || ''          

(method) HonoRequest<any, unknown>.header(name: string): string | undefined (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

return c

(parameter) c: Context<{}, any, {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(foo)          

const foo: string

}) .post

(property) Hono<BlankEnv, { "/abc": { $get: { input: {}; output: string; outputFormat: "text"; status: StatusCode; }; }; }, "/">.post: HandlerInterface <any, {}, {}, Response & TypedResponse<"POST /abc", StatusCode, "text">, any, {}>(handlers_0: H<any, any, {}, any>, handlers_1: H<{}, any, {}, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(customHeader2,

const customHeader2: (c: Context, next: Next) => Promise<void>

(c) => {          

(parameter) c: Context<{}, any, {}>

return c

(parameter) c: Context<{}, any, {}>

.text('POST /abc')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"POST /abc", StatusCode>(text: "POST /abc", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('GET /abc', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/abc')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-custom-message')).toBe('hello')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-before-dispatch')).toBe('foo')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('bar')          

(method) Body.text(): Promise<string> MDN Reference

}) it('POST /abc', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/abc', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'POST' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('POST /abc')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-custom-foo-2')).toBe('bar-2')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('With builtin middleware', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/abc',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/abc", "/abc", Response & TypedResponse<"GET /abc", StatusCode, "text">, {}, {}, any, {}>(path: "/abc", handlers_0: H<any, "/abc", {}, any>, handlers_1: H<...>) => Hono<...> (+22 overloads)

poweredBy(),

(alias) poweredBy(): MiddlewareHandler import poweredBy

(c) => {          

(parameter) c: Context<{}, "/abc", {}>

return c

(parameter) c: Context<{}, "/abc", {}>

.text('GET /abc')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"GET /abc", StatusCode>(text: "GET /abc", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('GET /abc', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/abc')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('GET /abc')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-powered-by')).toBe('Hono')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) }) describe('Not Found', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.notFound(

(property) Hono<BlankEnv, BlankSchema, "/">.notFound: (handler: NotFoundHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .notFound() allows you to customize a Not Found Response.

@see — https://hono.dev/docs/api/hono#not-found

@param handler — request handler for not-found

@returns — changed Hono instance

@example
ts app.notFound((c) => { return c.text('Custom 404 Message', 404) })

(c) => {          

(parameter) c: Context<BlankEnv, any, {}>

return c

(parameter) c: Context<BlankEnv, any, {}>

.text('Custom 404 Not Found', 404)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Custom 404 Not Found", 404>(text: "Custom 404 Not Found", status?: 404 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Custom 404 Not Found", 404, "text"> (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/hello',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/hello", "/hello", Response & TypedResponse<"hello", StatusCode, "text">, BlankInput, BlankEnv>(path: "/hello", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/hello", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/hello", BlankInput>

.text('hello')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hello", StatusCode>(text: "hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/notfound',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/notfound", "/notfound", Response | Promise<Response>, BlankInput, BlankEnv>(path: "/notfound", handler: H<BlankEnv, "/notfound", BlankInput, Response | Promise<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/notfound", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/notfound", BlankInput>

.notFound()          

(property) Context<BlankEnv, "/notfound", BlankInput>.notFound: () => Response | Promise<Response> .notFound() can return the Not Found Response.

@see — https://hono.dev/docs/api/context#notfound

@example
ts app.get('/notfound', (c) => { return c.notFound() })

}) it('Custom 404 Not Found', async () => { let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/hello')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/notfound')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/foo')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('Custom 404 Not Found')          

(method) Body.text(): Promise<string> MDN Reference

}) describe('Not Found with a middleware', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"hello", StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text('hello'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hello", StatusCode>(text: "hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<BlankEnv, "*", {}>

.res = new

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

Response((await

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

c

(parameter) c: Context<BlankEnv, "*", {}>

.res

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.text()) + ' + Middleware',

(method) Body.text(): Promise<string> MDN Reference

c

(parameter) c: Context<BlankEnv, "*", {}>

.res)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

}) it('Custom 404 Not Found', async () => { let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/foo')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('404 Not Found + Middleware')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('Not Found with some middleware', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"hello", StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text('hello'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hello", StatusCode>(text: "hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<BlankEnv, "*", {}>

.res = new

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

Response((await

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

c

(parameter) c: Context<BlankEnv, "*", {}>

.res

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.text()) + ' + Middleware 1',

(method) Body.text(): Promise<string> MDN Reference

c

(parameter) c: Context<BlankEnv, "*", {}>

.res)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<BlankEnv, "*", {}>

.res = new

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

Response((await

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

c

(parameter) c: Context<BlankEnv, "*", {}>

.res

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.text()) + ' + Middleware 2',

(method) Body.text(): Promise<string> MDN Reference

c

(parameter) c: Context<BlankEnv, "*", {}>

.res)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

}) it('Custom 404 Not Found', async () => { let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/foo')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('404 Not Found + Middleware 2 + Middleware 1')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('No response from a handler', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"hello", StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text('hello'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"hello", StatusCode>(text: "hello", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/not-found', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/not-found", "/not-found", HandlerResponse<any>, BlankInput, BlankEnv>(path: "/not-found", handler: H<BlankEnv, "/not-found", BlankInput, HandlerResponse<...>>) => Hono<...> (+22 overloads)

(c) => undefined)          

(parameter) c: Context<BlankEnv, "/not-found", BlankInput>

it('Custom 404 Not Found', async () => { let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/not-found')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('404 Not Found')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('Custom 404 Not Found with a middleware like Compress Middleware', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

// Custom Middleware which creates a new Response object after `next()`. app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<BlankEnv, "*", {}>

.res = new

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

Response(await

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

c

(parameter) c: Context<BlankEnv, "*", {}>

.res

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.text(),

(method) Body.text(): Promise<string> MDN Reference

c

(parameter) c: Context<BlankEnv, "*", {}>

.res)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.notFound(

(property) Hono<BlankEnv, BlankSchema, "/">.notFound: (handler: NotFoundHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .notFound() allows you to customize a Not Found Response.

@see — https://hono.dev/docs/api/hono#not-found

@param handler — request handler for not-found

@returns — changed Hono instance

@example
ts app.notFound((c) => { return c.text('Custom 404 Message', 404) })

(c) => {          

(parameter) c: Context<BlankEnv, any, {}>

return c

(parameter) c: Context<BlankEnv, any, {}>

.text('Custom NotFound', 404)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Custom NotFound", 404>(text: "Custom NotFound", status?: 404 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Custom NotFound", 404, "text"> (+1 overload)

}) it('Custom 404 Not Found', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Custom NotFound')          

(method) Body.text(): Promise<string> MDN Reference

}) }) }) describe('Redirect', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/redirect',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/redirect", "/redirect", Response & TypedResponse<undefined, 302, "redirect">, BlankInput, BlankEnv>(path: "/redirect", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/redirect", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/redirect", BlankInput>

.redirect('/')          

(property) Context<BlankEnv, "/redirect", BlankInput>.redirect: <302>(location: string, status?: 302 | undefined) => Response & TypedResponse<undefined, 302, "redirect"> .redirect() can Redirect, default status code is 302.

@see — https://hono.dev/docs/api/context#redirect

@example
ts app.get('/redirect', (c) => { return c.redirect('/') }) app.get('/redirect-permanently', (c) => { return c.redirect('/', 301) })

}) it('Absolute URL', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/redirect')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(302)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Location')).toBe('/')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('Error handle', () => { describe('Basic', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/error', () => {          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/error", "/error", never, BlankInput, BlankEnv>(path: "/error", handler: H<BlankEnv, "/error", BlankInput, never>) => Hono<BlankEnv, { ...; }, "/"> (+22 overloads)

throw new Error('This is Error')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/error-string', () => {          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/error-string", "/error-string", never, BlankInput, BlankEnv>(path: "/error-string", handler: H<BlankEnv, "/error-string", BlankInput, never>) => Hono<...> (+22 overloads)

throw 'This is Error' }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/error-middleware', async () => {          

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/error-middleware", "/error-middleware", BlankEnv>(path: "/error-middleware", handler: MiddlewareHandler<BlankEnv, "/error-middleware", {}>) => Hono<...> (+20 overloads)

throw new Error('This is Middleware Error')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.onError(

(property) Hono<BlankEnv, BlankSchema, "/">.onError: (handler: ErrorHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .onError() handles an error and returns a customized Response.

@see — https://hono.dev/docs/api/hono#error-handling

@param handler — request Handler for error

@returns — changed Hono instance

@example
ts app.onError((err, c) => { console.error(`${err}`) return c.text('Custom Error Message', 500) })

(err,

(parameter) err: Error | HTTPResponseError

c) => {          

(parameter) c: Context<BlankEnv, any, {}>

c

(parameter) c: Context<BlankEnv, any, {}>

.header('x-debug',

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

err

(parameter) err: Error | HTTPResponseError

.message)          

(property) Error.message: string

return c

(parameter) c: Context<BlankEnv, any, {}>

.text('Custom Error Message', 500)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Custom Error Message", 500>(text: "Custom Error Message", status?: 500 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Custom Error Message", 500, "text"> (+1 overload)

}) it('Should throw Error if a non-Error object is thrown in a handler', async () => { expect(() => app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/error-string')).toThrowError()          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

}) it('Custom Error Message', async () => { let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/error')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(500)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('Custom Error Message')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

let res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-debug')).toBe('This is Error')          

(method) Headers.get(name: string): string | null MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/error-middleware')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(500)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('Custom Error Message')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

let res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-debug')).toBe('This is Middleware Error')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('Async custom handler', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/error', () => {          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/error", "/error", never, BlankInput, BlankEnv>(path: "/error", handler: H<BlankEnv, "/error", BlankInput, never>) => Hono<BlankEnv, { ...; }, "/"> (+22 overloads)

throw new Error('This is Error')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/error-middleware', async () => {          

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/error-middleware", "/error-middleware", BlankEnv>(path: "/error-middleware", handler: MiddlewareHandler<BlankEnv, "/error-middleware", {}>) => Hono<...> (+20 overloads)

throw new Error('This is Middleware Error')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.onError(async

(property) Hono<BlankEnv, BlankSchema, "/">.onError: (handler: ErrorHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .onError() handles an error and returns a customized Response.

@see — https://hono.dev/docs/api/hono#error-handling

@param handler — request Handler for error

@returns — changed Hono instance

@example
ts app.onError((err, c) => { console.error(`${err}`) return c.text('Custom Error Message', 500) })

(err,

(parameter) err: Error | HTTPResponseError

c) => {          

(parameter) c: Context<BlankEnv, any, {}>

const promise = new

const promise: Promise<unknown>

Promise(

var Promise: PromiseConstructor new <unknown>(executor: (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void) => Promise<unknown> Creates a new Promise.

@param executor
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

(resolve) =>          

(parameter) resolve: (value: unknown) => void

setTimeout(() => {          

function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number MDN Reference

resolve('Promised')          

(parameter) resolve: (value: unknown) => void

}, 1) ) const message = (await

const message: string

promise) as string          

const promise: Promise<unknown>

c

(parameter) c: Context<BlankEnv, any, {}>

.header('x-debug',

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

err

(parameter) err: Error | HTTPResponseError

.message)          

(property) Error.message: string

return c

(parameter) c: Context<BlankEnv, any, {}>

.text(`Custom Error Message with $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`Custom Error Message with ${string}`, 500>(text: `Custom Error Message with ${string}`, status?: 500 | undefined, headers?: HeaderRecord) => Response & TypedResponse<`Custom Error Message with ${string}`, 500, "text"> (+1 overload)

{message}`, 500)          

const message: string

}) it('Custom Error Message', async () => { let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/error')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(500)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('Custom Error Message with Promised')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

let res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-debug')).toBe('This is Error')          

(method) Headers.get(name: string): string | null MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/error-middleware')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(500)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('Custom Error Message with Promised')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

let res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-debug')).toBe('This is Middleware Error')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('Handle HTTPException', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/exception', () => {          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/exception", "/exception", never, BlankInput, BlankEnv>(path: "/exception", handler: H<BlankEnv, "/exception", BlankInput, never>) => Hono<...> (+22 overloads)

throw new HTTPException(401, {          

(alias) new HTTPException(status?: StatusCode, options?: HTTPExceptionOptions): HTTPException import HTTPException Creates an instance of HTTPException.

@param status — HTTP status code for the exception. Defaults to 500.

@param options — Additional options for the exception.

message: 'Unauthorized',          

(property) message?: string | undefined

}) }) it('Should return 401 response', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/exception')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(401)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Unauthorized')          

(method) Body.text(): Promise<string> MDN Reference

}) const app2 = new

const app2: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app2

const app2: Hono<BlankEnv, BlankSchema, "/">

.get('/exception', () => {          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/exception", "/exception", never, BlankInput, BlankEnv>(path: "/exception", handler: H<BlankEnv, "/exception", BlankInput, never>) => Hono<...> (+22 overloads)

throw new HTTPException(401)          

(alias) new HTTPException(status?: StatusCode, options?: HTTPExceptionOptions): HTTPException import HTTPException Creates an instance of HTTPException.

@param status — HTTP status code for the exception. Defaults to 500.

@param options — Additional options for the exception.

}) app2

const app2: Hono<BlankEnv, BlankSchema, "/">

.onError(

(property) Hono<BlankEnv, BlankSchema, "/">.onError: (handler: ErrorHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .onError() handles an error and returns a customized Response.

@see — https://hono.dev/docs/api/hono#error-handling

@param handler — request Handler for error

@returns — changed Hono instance

@example
ts app.onError((err, c) => { console.error(`${err}`) return c.text('Custom Error Message', 500) })

(err,

(parameter) err: Error | HTTPResponseError

c) => {          

(parameter) c: Context<BlankEnv, any, {}>

if (err instanceof

(parameter) err: Error | HTTPResponseError

HTTPException &&

(alias) class HTTPException import HTTPException HTTPException must be used when a fatal error such as authentication failure occurs.

@see — https://hono.dev/docs/api/exception

@param status — status code of HTTPException

@param options — options of HTTPException

@param options.res — response of options of HTTPException

@param options.message — message of options of HTTPException

@param options.cause — cause of options of HTTPException

@example
```ts import { HTTPException } from 'hono/http-exception'

// ...

app.post('/auth', async (c, next) => { // authentication if (authorized === false) { throw new HTTPException(401, { message: 'Custom error message' }) } await next() }) ```

err

(parameter) err: HTTPException

.status === 401) {          

(property) HTTPException.status: StatusCode

return c

(parameter) c: Context<BlankEnv, any, {}>

.text('Custom Error Message', 401)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Custom Error Message", 401>(text: "Custom Error Message", status?: 401 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Custom Error Message", 401, "text"> (+1 overload)

} return c

(parameter) c: Context<BlankEnv, any, {}>

.text('Internal Server Error', 500)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Internal Server Error", 500>(text: "Internal Server Error", status?: 500 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Internal Server Error", 500, "text"> (+1 overload)

}) it('Should return 401 response with a custom message', async () => { const res = await

const res: Response

app2

const app2: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/exception')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(401)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Custom Error Message')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('Handle HTTPException like object', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

class CustomError extends

class CustomError

Error {          

var Error: ErrorConstructor

getResponse() {          

(method) CustomError.getResponse(): Response

return new Response('Custom Error', {

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 400 })          

(property) ResponseInit.status?: number | undefined

} } app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/exception', () => {          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/exception", "/exception", never, BlankInput, BlankEnv>(path: "/exception", handler: H<BlankEnv, "/exception", BlankInput, never>) => Hono<...> (+22 overloads)

throw new CustomError()          

constructor CustomError(message?: string, options?: ErrorOptions): CustomError (+1 overload)

}) it('Should return 401 response', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/exception')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(400)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Custom Error')          

(method) Body.text(): Promise<string> MDN Reference

}) }) }) describe('Error handling in middleware', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/handle-error-in-middleware', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/handle-error-in-middleware", "/handle-error-in-middleware", HandlerResponse<any>, BlankInput, BlankEnv>(path: "/handle-error-in-middleware", handler: H<...>) => Hono<...> (+22 overloads)

(c,

(parameter) c: Context<BlankEnv, "/handle-error-in-middleware", BlankInput>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

if (c

(parameter) c: Context<BlankEnv, "/handle-error-in-middleware", BlankInput>

.error) {          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.error: Error | undefined .error can get the error object from the middleware if the Handler throws an error.

@see — https://hono.dev/docs/api/context#error

@example
ts app.use('*', async (c, next) => { await next() if (c.error) { // do something... } })

const message =

const message: string

c

(parameter) c: Context<BlankEnv, "/handle-error-in-middleware", BlankInput>

.error

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.error: Error .error can get the error object from the middleware if the Handler throws an error.

@see — https://hono.dev/docs/api/context#error

@example
ts app.use('*', async (c, next) => { await next() if (c.error) { // do something... } })

.message          

(property) Error.message: string

c

(parameter) c: Context<BlankEnv, "/handle-error-in-middleware", BlankInput>

.res =

(property) Context<BlankEnv, "/handle-error-in-middleware", BlankInput>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

c

(parameter) c: Context<BlankEnv, "/handle-error-in-middleware", BlankInput>

.text(`Handle the error in middleware, original message is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`Handle the error in middleware, original message is ${string}`, 500>(text: `Handle the error in middleware, original message is ${string}`, status?: 500 | undefined, headers?: HeaderRecord) => Response & TypedResponse<`Handle the error in middleware, original message is ${string}`, 500, "text"> (+1 overload)

{message}`, 500)          

const message: string

} }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/handle-error-in-middleware-async', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/handle-error-in-middleware-async", "/handle-error-in-middleware-async", HandlerResponse<any>, BlankInput, BlankEnv>(path: "/handle-error-in-middleware-async", handler: H<...>) => Hono<...> (+22 overloads)

(c,

(parameter) c: Context<BlankEnv, "/handle-error-in-middleware-async", BlankInput>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

if (c

(parameter) c: Context<BlankEnv, "/handle-error-in-middleware-async", BlankInput>

.error) {          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.error: Error | undefined .error can get the error object from the middleware if the Handler throws an error.

@see — https://hono.dev/docs/api/context#error

@example
ts app.use('*', async (c, next) => { await next() if (c.error) { // do something... } })

const message =

const message: string

c

(parameter) c: Context<BlankEnv, "/handle-error-in-middleware-async", BlankInput>

.error

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.error: Error .error can get the error object from the middleware if the Handler throws an error.

@see — https://hono.dev/docs/api/context#error

@example
ts app.use('*', async (c, next) => { await next() if (c.error) { // do something... } })

.message          

(property) Error.message: string

c

(parameter) c: Context<BlankEnv, "/handle-error-in-middleware-async", BlankInput>

.res =

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response | undefined Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

c

(parameter) c: Context<BlankEnv, "/handle-error-in-middleware-async", BlankInput>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`Handle the error in middleware with async, original message is ${string}`, 500>(text: `Handle the error in middleware with async, original message is ${string}`, status?: 500 | undefined, headers?: HeaderRecord) => Response & TypedResponse<`Handle the error in middleware with async, original message is ${string}`, 500, "text"> (+1 overload)

`Handle the error in middleware with async, original message is ${message}`,          

const message: string

500 ) } }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/handle-error-in-middleware', () => {          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/handle-error-in-middleware", "/handle-error-in-middleware", never, BlankInput, BlankEnv>(path: "/handle-error-in-middleware", handler: H<BlankEnv, "/handle-error-in-middleware", BlankInput, never>) => Hono<...> (+22 overloads)

throw new Error('Error message')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/handle-error-in-middleware-async', async () => {          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/handle-error-in-middleware-async", "/handle-error-in-middleware-async", Promise<never>, BlankInput, BlankEnv>(path: "/handle-error-in-middleware-async", handler: H<...>) => Hono<...> (+22 overloads)

throw new Error('Error message')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) it('Should handle the error in middleware', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/handle-error-in-middleware')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(500)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe(          

(method) Body.text(): Promise<string> MDN Reference

'Handle the error in middleware, original message is Error message' ) }) it('Should handle the error in middleware - async', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/handle-error-in-middleware-async')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(500)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe(          

(method) Body.text(): Promise<string> MDN Reference

'Handle the error in middleware with async, original message is Error message' ) }) describe('Default route app.use', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app          

const app: Hono<BlankEnv, BlankSchema, "/">

.use(async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <BlankEnv>(...handlers: MiddlewareHandler<BlankEnv, never, {}>[]) => Hono<{}, BlankSchema, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, never, {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<BlankEnv, never, {}>

.header('x-default-use', 'abc')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

await next()          

(parameter) next: () => Promise<void>

}) .get('/multiple/abc',

(property) Hono<{}, BlankSchema, "/">.get: HandlerInterface <"/multiple/abc", "/multiple/abc", Response & TypedResponse<"GET multiple", StatusCode, "text">, BlankInput, {}>(path: "/multiple/abc", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<{}, "/multiple/abc", BlankInput>

return c

(parameter) c: Context<{}, "/multiple/abc", BlankInput>

.text('GET multiple')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"GET multiple", StatusCode>(text: "GET multiple", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('GET /multiple/abc', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/multiple/abc')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('GET multiple')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-default-use')).toBe('abc')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('Error in `notFound()`', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*', async () => {})          

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.notFound(() => {          

(property) Hono<BlankEnv, BlankSchema, "/">.notFound: (handler: NotFoundHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .notFound() allows you to customize a Not Found Response.

@see — https://hono.dev/docs/api/hono#not-found

@param handler — request handler for not-found

@returns — changed Hono instance

@example
ts app.notFound((c) => { return c.text('Custom 404 Message', 404) })

throw new Error('Error in Not Found')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.onError(

(property) Hono<BlankEnv, BlankSchema, "/">.onError: (handler: ErrorHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .onError() handles an error and returns a customized Response.

@see — https://hono.dev/docs/api/hono#error-handling

@param handler — request Handler for error

@returns — changed Hono instance

@example
ts app.onError((err, c) => { console.error(`${err}`) return c.text('Custom Error Message', 500) })

(err,

(parameter) err: Error | HTTPResponseError

c) => {          

(parameter) c: Context<BlankEnv, any, {}>

return c

(parameter) c: Context<BlankEnv, any, {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, 400>(text: string, status?: 400 | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, 400, "text"> (+1 overload)

(err

(parameter) err: Error | HTTPResponseError

.message, 400)          

(property) Error.message: string

}) it('Should handle the error thrown in `notFound()``', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(400)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Error in Not Found')          

(method) Body.text(): Promise<string> MDN Reference

}) }) }) describe('Request methods with custom middleware', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "*", {}>

next) => {          

(parameter) next: Next

const query =

const query: string | undefined

c

(parameter) c: Context<BlankEnv, "*", {}>

.req

(property) Context<BlankEnv, "*", {}>.req: HonoRequest<"*", unknown> .req is the instance of HonoRequest.

.query('foo')          

(method) HonoRequest<"*", unknown>.query(key: string): string | undefined (+1 overload) .query() can get querystring parameters.

@see — https://hono.dev/docs/api/request#query

@example
```ts // Query params app.get('/search', (c) => { const query = c.req.query('q') })

// Get all params at once app.get('/search', (c) => { const { q, limit, offset } = c.req.query() }) ```

// @ts-ignore const param =

const param: string | undefined

c

(parameter) c: Context<BlankEnv, "*", {}>

.req

(property) Context<BlankEnv, "*", {}>.req: HonoRequest<"*", unknown> .req is the instance of HonoRequest.

.param('foo') // This will cause a type error.          

(method) HonoRequest<"*", unknown>.param(key: string): string | undefined (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

const header =

const header: string | undefined

c

(parameter) c: Context<BlankEnv, "*", {}>

.req

(property) Context<BlankEnv, "*", {}>.req: HonoRequest<"*", unknown> .req is the instance of HonoRequest.

.header('User-Agent')          

(method) HonoRequest<"*", unknown>.header(name: string): string | undefined (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<BlankEnv, "*", {}>

.header('X-Query-2',

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

query ??

const query: string | undefined

throwExpression('missing `X-Query-2` header'))          

function throwExpression(errorMessage: string): never

c

(parameter) c: Context<BlankEnv, "*", {}>

.header('X-Param-2',

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

param)          

const param: string | undefined

c

(parameter) c: Context<BlankEnv, "*", {}>

.header('X-Header-2',

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

header ??

const header: string | undefined

throwExpression('missing `X-Header-2` header'))          

function throwExpression(errorMessage: string): never

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/:foo',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/:foo", "/:foo", Response, BlankInput, BlankEnv>(path: "/:foo", handler: H<BlankEnv, "/:foo", BlankInput, Response>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/:foo", BlankInput>

const query =

const query: string | undefined

c

(parameter) c: Context<BlankEnv, "/:foo", BlankInput>

.req

(property) Context<BlankEnv, "/:foo", BlankInput>.req: HonoRequest<"/:foo", unknown> .req is the instance of HonoRequest.

.query('foo')          

(method) HonoRequest<"/:foo", unknown>.query(key: string): string | undefined (+1 overload) .query() can get querystring parameters.

@see — https://hono.dev/docs/api/request#query

@example
```ts // Query params app.get('/search', (c) => { const query = c.req.query('q') })

// Get all params at once app.get('/search', (c) => { const { q, limit, offset } = c.req.query() }) ```

const param =

const param: string

c

(parameter) c: Context<BlankEnv, "/:foo", BlankInput>

.req

(property) Context<BlankEnv, "/:foo", BlankInput>.req: HonoRequest<"/:foo", unknown> .req is the instance of HonoRequest.

.param('foo')          

(method) HonoRequest<"/:foo", unknown>.param<"foo">(key: "foo"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

const header =

const header: string | undefined

c

(parameter) c: Context<BlankEnv, "/:foo", BlankInput>

.req

(property) Context<BlankEnv, "/:foo", BlankInput>.req: HonoRequest<"/:foo", unknown> .req is the instance of HonoRequest.

.header('User-Agent')          

(method) HonoRequest<"/:foo", unknown>.header(name: string): string | undefined (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

c

(parameter) c: Context<BlankEnv, "/:foo", BlankInput>

.header('X-Query',

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

query ??

const query: string | undefined

throwExpression('missing `X-Query` header'))          

function throwExpression(errorMessage: string): never

c

(parameter) c: Context<BlankEnv, "/:foo", BlankInput>

.header('X-Param',

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

param)          

const param: string

c

(parameter) c: Context<BlankEnv, "/:foo", BlankInput>

.header('X-Header',

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

header ??

const header: string | undefined

throwExpression('missing `X-Header` header'))          

function throwExpression(errorMessage: string): never

return c

(parameter) c: Context<BlankEnv, "/:foo", BlankInput>

.body('Hono')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.body: BodyRespond (data: Data | null, status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

}) it('query', async () => { const url = new

const url: URL

URL('http://localhost/bar')          

var URL: new (url: string | URL, base?: string | URL) => URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

url

const url: URL

.searchParams

(property) URL.searchParams: URLSearchParams MDN Reference

.append('foo', 'bar')          

(method) URLSearchParams.append(name: string, value: string): void Appends a specified key/value pair as a new search parameter.

MDN Reference

const req = new

const req: Request

Request

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

(url

const url: URL

.toString())          

(method) URL.toString(): string

req

const req: Request

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.append('User-Agent', 'bar')          

(method) Headers.append(name: string, value: string): void MDN Reference

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Query')).toBe('bar')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Param')).toBe('bar')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Header')).toBe('bar')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Query-2')).toBe('bar')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Param-2')).toBe(null)          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Header-2')).toBe('bar')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('Middleware + c.json(0, requestInit)', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/", "/", BlankEnv>(path: "/", handler: MiddlewareHandler<BlankEnv, "/", {}>) => Hono<{}, { "/": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "/", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", JSONRespondReturn<0, StatusCode>, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.json(0, {          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <0, StatusCode>(object: 0, init?: ResponseInit) => JSONRespondReturn<0, StatusCode> (+1 overload)

status: 200,          

(property) ResponseInit.status?: number | undefined

headers: {          

(property) ResponseInit.headers?: ResponseHeadersInit | undefined

foo: 'bar',          

(property) foo: string

}, }) }) it('Should return a correct headers', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('content-type')).toMatch(/^application\/json/)          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('foo')).toBe('bar')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('Hono with `app.route`', () => { describe('Basic', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const api = new

const api: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const middleware = new

const middleware: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

api

const api: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<BlankEnv, "*", {}>

.res

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.append('x-custom-a', 'a')          

(method) Headers.append(name: string, value: string): void MDN Reference

}) api

const api: Hono<BlankEnv, BlankSchema, "/">

.get('/posts',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/posts", "/posts", Response & TypedResponse<"List", StatusCode, "text">, BlankInput, BlankEnv>(path: "/posts", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/posts", BlankInput>

c

(parameter) c: Context<BlankEnv, "/posts", BlankInput>

.text('List'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"List", StatusCode>(text: "List", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"List", StatusCode, "text"> (+1 overload)

api

const api: Hono<BlankEnv, BlankSchema, "/">

.post('/posts',

(property) Hono<BlankEnv, BlankSchema, "/">.post: HandlerInterface <"/posts", "/posts", Response & TypedResponse<"Create", StatusCode, "text">, BlankInput, BlankEnv>(path: "/posts", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/posts", BlankInput>

c

(parameter) c: Context<BlankEnv, "/posts", BlankInput>

.text('Create'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Create", StatusCode>(text: "Create", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

api

const api: Hono<BlankEnv, BlankSchema, "/">

.get('/posts/:id',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/posts/:id", "/posts/:id", Response & TypedResponse<`GET ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/posts/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.text(`GET $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`GET ${string}`, StatusCode>(text: `GET ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.req

(property) Context<BlankEnv, "/posts/:id", BlankInput>.req: HonoRequest<"/posts/:id", unknown> .req is the instance of HonoRequest.

.param('id')}`))          

(method) HonoRequest<"/posts/:id", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

middleware

const middleware: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<BlankEnv, "*", {}>

.res

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.res: Response Sets the Response object for the current request.

@see — https://hono.dev/docs/api/context#resThe Response object for the current request.

@param _res — The Response object to set.

.headers

(property) Response.headers: Headers MDN Reference

.append('x-custom-b', 'b')          

(method) Headers.append(name: string, value: string): void MDN Reference

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/api',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/api", BlankEnv, BlankSchema, "/">(path: "/api", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

middleware)          

const middleware: Hono<BlankEnv, BlankSchema, "/">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/api',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/api", BlankEnv, BlankSchema, "/">(path: "/api", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

api)          

const api: Hono<BlankEnv, BlankSchema, "/">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/foo',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/foo", "/foo", Response & TypedResponse<"bar", StatusCode, "text">, BlankInput, BlankEnv>(path: "/foo", handler: H<BlankEnv, "/foo", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

c

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

.text('bar'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"bar", StatusCode>(text: "bar", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"bar", StatusCode, "text"> (+1 overload)

it('Should return not found response', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) it('Should return not found response', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/posts')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) test('GET /api/posts', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/api/posts')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('List')          

(method) Body.text(): Promise<string> MDN Reference

}) test('Custom header by middleware', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/api/posts')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-custom-a')).toBe('a')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-custom-b')).toBe('b')          

(method) Headers.get(name: string): string | null MDN Reference

}) test('POST /api/posts', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/api/posts', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'POST' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Create')          

(method) Body.text(): Promise<string> MDN Reference

}) test('GET /api/posts/123', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/api/posts/123')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('GET 123')          

(method) Body.text(): Promise<string> MDN Reference

}) test('GET /foo', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/foo')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('bar')          

(method) Body.text(): Promise<string> MDN Reference

}) describe('With app.get(...handler)', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const about = new

const about: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

about

const about: Hono<BlankEnv, BlankSchema, "/">

.get(

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", BlankInput, Response & TypedResponse<"me", StatusCode, "text">, BlankEnv>(handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text('me'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"me", StatusCode>(text: "me", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"me", StatusCode, "text"> (+1 overload)

const subApp = new

const subApp: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

subApp

const subApp: Hono<BlankEnv, BlankSchema, "/">

.route('/about',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/about", BlankEnv, BlankSchema, "/">(path: "/about", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

about)          

const about: Hono<BlankEnv, BlankSchema, "/">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/", BlankEnv, BlankSchema, "/">(path: "/", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

subApp)          

const subApp: Hono<BlankEnv, BlankSchema, "/">

it('Should return 200 response - /about', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/about')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('me')          

(method) Body.text(): Promise<string> MDN Reference

}) test('Should return 404 response /about/foo', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/about/foo')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) }) describe('With app.get(...handler) and app.basePath()', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const about = new

const about: Hono<BlankEnv, BlankSchema, "/about">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.basePath('/about')          

(method) Hono<BlankEnv, BlankSchema, "/">.basePath<"/about">(path: "/about"): Hono<BlankEnv, BlankSchema, "/about"> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

about

const about: Hono<BlankEnv, BlankSchema, "/about">

.get(

(property) Hono<BlankEnv, BlankSchema, "/about">.get: HandlerInterface <"/about", BlankInput, Response & TypedResponse<"me", StatusCode, "text">, BlankEnv>(handler: H<BlankEnv, "/about", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/about", BlankInput>

c

(parameter) c: Context<BlankEnv, "/about", BlankInput>

.text('me'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"me", StatusCode>(text: "me", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"me", StatusCode, "text"> (+1 overload)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/", BlankEnv, BlankSchema, "/about">(path: "/", app: Hono<BlankEnv, BlankSchema, "/about">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

about)          

const about: Hono<BlankEnv, BlankSchema, "/about">

it('Should return 200 response - /about', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/about')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('me')          

(method) Body.text(): Promise<string> MDN Reference

}) test('Should return 404 response /about/foo', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/about/foo')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) }) }) describe('Chaining', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const route = new

const route: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

route

const route: Hono<BlankEnv, BlankSchema, "/">

.get('/post',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/post", "/post", Response & TypedResponse<"GET /POST v2", StatusCode, "text">, BlankInput, BlankEnv>(path: "/post", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/post", BlankInput>

c

(parameter) c: Context<BlankEnv, "/post", BlankInput>

.text('GET /POST v2'))

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"GET /POST v2", StatusCode>(text: "GET /POST v2", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

.post(

(property) Hono<BlankEnv, { "/post": { $get: { input: {}; output: "GET /POST v2"; outputFormat: "text"; status: StatusCode; }; }; }, "/">.post: HandlerInterface <"/post", BlankInput, Response & TypedResponse<"POST /POST v2", StatusCode, "text">, BlankEnv>(handler: H<BlankEnv, "/post", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/post", BlankInput>

c

(parameter) c: Context<BlankEnv, "/post", BlankInput>

.text('POST /POST v2'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"POST /POST v2", StatusCode>(text: "POST /POST v2", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/v2',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/v2", BlankEnv, BlankSchema, "/">(path: "/v2", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

route)          

const route: Hono<BlankEnv, BlankSchema, "/">

it('Should return 200 response - GET /v2/post', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/v2/post')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('GET /POST v2')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return 200 response - POST /v2/post', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/v2/post', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'POST' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('POST /POST v2')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return 404 response - DELETE /v2/post', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/v2/post', {

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

method: 'DELETE' })          

(property) RequestInit.method?: string | undefined A string to set request's method.

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) }) describe('Nested', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const api = new

const api: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const book = new

const book: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

book

const book: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"list books", StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text('list books'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"list books", StatusCode>(text: "list books", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

book

const book: Hono<BlankEnv, BlankSchema, "/">

.get('/:id',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/:id", "/:id", Response & TypedResponse<`book ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/:id", handler: H<BlankEnv, "/:id", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/:id", BlankInput>

c

(parameter) c: Context<BlankEnv, "/:id", BlankInput>

.text(`book $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`book ${string}`, StatusCode>(text: `book ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/:id", BlankInput>

.req

(property) Context<BlankEnv, "/:id", BlankInput>.req: HonoRequest<"/:id", unknown> .req is the instance of HonoRequest.

.param('id')}`))          

(method) HonoRequest<"/:id", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

api

const api: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"this is API", StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text('this is API'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"this is API", StatusCode>(text: "this is API", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

api

const api: Hono<BlankEnv, BlankSchema, "/">

.route('/book',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/book", BlankEnv, BlankSchema, "/">(path: "/book", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

book)          

const book: Hono<BlankEnv, BlankSchema, "/">

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"root", StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text('root'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"root", StatusCode>(text: "root", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"root", StatusCode, "text"> (+1 overload)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/v2',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/v2", BlankEnv, BlankSchema, "/">(path: "/v2", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

api)          

const api: Hono<BlankEnv, BlankSchema, "/">

it('Should return 200 response - GET /', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('root')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return 200 response - GET /v2', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/v2')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('this is API')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return 200 response - GET /v2/book', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/v2/book')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('list books')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return 200 response - GET /v2/book/123', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/v2/book/123')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('book 123')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('onError', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const sub = new

const sub: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

if (c

(parameter) c: Context<BlankEnv, "*", {}>

.req

(property) Context<BlankEnv, "*", {}>.req: HonoRequest<"*", unknown> .req is the instance of HonoRequest.

.query('app-error')) {          

(method) HonoRequest<"*", unknown>.query(key: string): string | undefined (+1 overload) .query() can get querystring parameters.

@see — https://hono.dev/docs/api/request#query

@example
```ts // Query params app.get('/search', (c) => { const query = c.req.query('q') })

// Get all params at once app.get('/search', (c) => { const { q, limit, offset } = c.req.query() }) ```

throw new Error('This is Error')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

} }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.onError(

(property) Hono<BlankEnv, BlankSchema, "/">.onError: (handler: ErrorHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .onError() handles an error and returns a customized Response.

@see — https://hono.dev/docs/api/hono#error-handling

@param handler — request Handler for error

@returns — changed Hono instance

@example
ts app.onError((err, c) => { console.error(`${err}`) return c.text('Custom Error Message', 500) })

(err,

(parameter) err: Error | HTTPResponseError

c) => {          

(parameter) c: Context<BlankEnv, any, {}>

return c

(parameter) c: Context<BlankEnv, any, {}>

.text('onError by app', 500)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"onError by app", 500>(text: "onError by app", status?: 500 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"onError by app", 500, "text"> (+1 overload)

}) sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.get('/posts/:id', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/posts/:id", "/posts/:id", HandlerResponse<any>, BlankInput, BlankEnv>(path: "/posts/:id", handler: H<BlankEnv, "/posts/:id", BlankInput, HandlerResponse<...>>) => Hono<...> (+22 overloads)

(c,

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.header('handler-chain', '1')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

await next()          

(parameter) next: () => Promise<void>

}) sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.get('/posts/:id',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/posts/:id", "/posts/:id", Response & TypedResponse<`post: ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/posts/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.text(`post: $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`post: ${string}`, StatusCode>(text: `post: ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.req

(property) Context<BlankEnv, "/posts/:id", BlankInput>.req: HonoRequest<"/posts/:id", unknown> .req is the instance of HonoRequest.

.param('id')}`)          

(method) HonoRequest<"/posts/:id", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

}) sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.get('/error', () => {          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/error", "/error", never, BlankInput, BlankEnv>(path: "/error", handler: H<BlankEnv, "/error", BlankInput, never>) => Hono<BlankEnv, { ...; }, "/"> (+22 overloads)

throw new Error('This is Error')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.onError(

(property) Hono<BlankEnv, BlankSchema, "/">.onError: (handler: ErrorHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .onError() handles an error and returns a customized Response.

@see — https://hono.dev/docs/api/hono#error-handling

@param handler — request Handler for error

@returns — changed Hono instance

@example
ts app.onError((err, c) => { console.error(`${err}`) return c.text('Custom Error Message', 500) })

(err,

(parameter) err: Error | HTTPResponseError

c) => {          

(parameter) c: Context<BlankEnv, any, {}>

return c

(parameter) c: Context<BlankEnv, any, {}>

.text('onError by sub', 500)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"onError by sub", 500>(text: "onError by sub", status?: 500 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"onError by sub", 500, "text"> (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/sub',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/sub", BlankEnv, BlankSchema, "/">(path: "/sub", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

sub)          

const sub: Hono<BlankEnv, BlankSchema, "/">

it('GET /posts/123 for sub', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/sub/posts/123')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('handler-chain')).toBe('1')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('post: 123')          

(method) Body.text(): Promise<string> MDN Reference

}) it('should be handled by app', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/sub/ok?app-error=1')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(500)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('onError by app')          

(method) Body.text(): Promise<string> MDN Reference

}) it('should be handled by sub', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/sub/error')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(500)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('onError by sub')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('onError for a single handler', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const sub = new

const sub: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.get('/ok',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/ok", "/ok", Response & TypedResponse<"OK", StatusCode, "text">, BlankInput, BlankEnv>(path: "/ok", handler: H<BlankEnv, "/ok", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/ok", BlankInput>

c

(parameter) c: Context<BlankEnv, "/ok", BlankInput>

.text('OK'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"OK", StatusCode>(text: "OK", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"OK", StatusCode, "text"> (+1 overload)

sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.get('/error', () => {          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/error", "/error", never, BlankInput, BlankEnv>(path: "/error", handler: H<BlankEnv, "/error", BlankInput, never>) => Hono<BlankEnv, { ...; }, "/"> (+22 overloads)

throw new Error('This is Error')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

}) sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.onError(

(property) Hono<BlankEnv, BlankSchema, "/">.onError: (handler: ErrorHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .onError() handles an error and returns a customized Response.

@see — https://hono.dev/docs/api/hono#error-handling

@param handler — request Handler for error

@returns — changed Hono instance

@example
ts app.onError((err, c) => { console.error(`${err}`) return c.text('Custom Error Message', 500) })

(err,

(parameter) err: Error | HTTPResponseError

c) => {          

(parameter) c: Context<BlankEnv, any, {}>

return c

(parameter) c: Context<BlankEnv, any, {}>

.text('onError by sub', 500)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"onError by sub", 500>(text: "onError by sub", status?: 500 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"onError by sub", 500, "text"> (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/sub',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/sub", BlankEnv, BlankSchema, "/">(path: "/sub", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

sub)          

const sub: Hono<BlankEnv, BlankSchema, "/">

it('ok', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/sub/ok')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

}) it('error', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/sub/error')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(500)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('onError by sub')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('notFound', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const sub = new

const sub: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/explicit-404', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/explicit-404", "/explicit-404", HandlerResponse<any>, BlankInput, BlankEnv>(path: "/explicit-404", handler: H<BlankEnv, "/explicit-404", BlankInput, HandlerResponse<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/explicit-404", BlankInput>

c

(parameter) c: Context<BlankEnv, "/explicit-404", BlankInput>

.header('explicit', '1')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.notFound(

(property) Hono<BlankEnv, BlankSchema, "/">.notFound: (handler: NotFoundHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .notFound() allows you to customize a Not Found Response.

@see — https://hono.dev/docs/api/hono#not-found

@param handler — request handler for not-found

@returns — changed Hono instance

@example
ts app.notFound((c) => { return c.text('Custom 404 Message', 404) })

(c) => {          

(parameter) c: Context<BlankEnv, any, {}>

return c

(parameter) c: Context<BlankEnv, any, {}>

.text('404 Not Found by app', 404)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"404 Not Found by app", 404>(text: "404 Not Found by app", status?: 404 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"404 Not Found by app", 404, "text"> (+1 overload)

}) sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.get('/ok',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/ok", "/ok", Response & TypedResponse<"ok", StatusCode, "text">, BlankInput, BlankEnv>(path: "/ok", handler: H<BlankEnv, "/ok", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/ok", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/ok", BlankInput>

.text('ok')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"ok", StatusCode>(text: "ok", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"ok", StatusCode, "text"> (+1 overload)

}) sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.get('/explicit-404', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/explicit-404", "/explicit-404", HandlerResponse<any>, BlankInput, BlankEnv>(path: "/explicit-404", handler: H<BlankEnv, "/explicit-404", BlankInput, HandlerResponse<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/explicit-404", BlankInput>

c

(parameter) c: Context<BlankEnv, "/explicit-404", BlankInput>

.header('explicit', '1')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

}) sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.notFound(

(property) Hono<BlankEnv, BlankSchema, "/">.notFound: (handler: NotFoundHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .notFound() allows you to customize a Not Found Response.

@see — https://hono.dev/docs/api/hono#not-found

@param handler — request handler for not-found

@returns — changed Hono instance

@example
ts app.notFound((c) => { return c.text('Custom 404 Message', 404) })

(c) => {          

(parameter) c: Context<BlankEnv, any, {}>

return c

(parameter) c: Context<BlankEnv, any, {}>

.text('404 Not Found by sub', 404)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"404 Not Found by sub", 404>(text: "404 Not Found by sub", status?: 404 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"404 Not Found by sub", 404, "text"> (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/sub',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/sub", BlankEnv, BlankSchema, "/">(path: "/sub", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

sub)          

const sub: Hono<BlankEnv, BlankSchema, "/">

it('/explicit-404 should be handled on app', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/explicit-404')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('explicit')).toBe('1')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('404 Not Found by app')          

(method) Body.text(): Promise<string> MDN Reference

}) it('/sub/explicit-404 should be handled on app', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/sub/explicit-404')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('explicit')).toBe('1')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('404 Not Found by app')          

(method) Body.text(): Promise<string> MDN Reference

}) it('/implicit-404 should be handled by app', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/implicit-404')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('explicit')).toBe(null)          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('404 Not Found by app')          

(method) Body.text(): Promise<string> MDN Reference

}) it('/sub/implicit-404 should be handled by sub', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('https://example.com/sub/implicit-404')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('explicit')).toBe(null)          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('404 Not Found by app')          

(method) Body.text(): Promise<string> MDN Reference

}) }) }) describe('Using other methods with `app.on`', () => { it('Should handle PURGE method with RegExpRouter', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono({

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

router: new

(property) router?: Router<[H, RouterRoute]> | undefined router option specifices which router to use.

@see — https://hono.dev/docs/api/hono#router-option

@example
ts const app = new Hono({ router: new RegExpRouter() })

RegExpRouter() })          

(alias) new RegExpRouter<[H, RouterRoute]>(): RegExpRouter<[H, RouterRoute]> import RegExpRouter

app

const app: Hono<BlankEnv, BlankSchema, "/">

.on('PURGE', '/purge',

(property) Hono<BlankEnv, BlankSchema, "/">.on: OnHandlerInterface <"PURGE", "/purge", "/purge", Response & TypedResponse<"Accepted", 202, "text">, BlankInput, BlankEnv>(method: "PURGE", path: "/purge", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/purge", BlankInput>

c

(parameter) c: Context<BlankEnv, "/purge", BlankInput>

.text('Accepted', 202))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Accepted", 202>(text: "Accepted", status?: 202 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Accepted", 202, "text"> (+1 overload)

const req = new

const req: Request

Request('http://localhost/purge', {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

method: 'PURGE',          

(property) RequestInit.method?: string | undefined A string to set request's method.

}) const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.status).toBe(202)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Accepted')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should handle PURGE method with TrieRouter', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono({

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

router: new

(property) router?: Router<[H, RouterRoute]> | undefined router option specifices which router to use.

@see — https://hono.dev/docs/api/hono#router-option

@example
ts const app = new Hono({ router: new RegExpRouter() })

TrieRouter() })          

(alias) new TrieRouter<[H, RouterRoute]>(): TrieRouter<[H, RouterRoute]> import TrieRouter

app

const app: Hono<BlankEnv, BlankSchema, "/">

.on('PURGE', '/purge',

(property) Hono<BlankEnv, BlankSchema, "/">.on: OnHandlerInterface <"PURGE", "/purge", "/purge", Response & TypedResponse<"Accepted", 202, "text">, BlankInput, BlankEnv>(method: "PURGE", path: "/purge", handler: H<...>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/purge", BlankInput>

c

(parameter) c: Context<BlankEnv, "/purge", BlankInput>

.text('Accepted', 202))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Accepted", 202>(text: "Accepted", status?: 202 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Accepted", 202, "text"> (+1 overload)

const req = new

const req: Request

Request('http://localhost/purge', {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

method: 'PURGE',          

(property) RequestInit.method?: string | undefined A string to set request's method.

}) const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.status).toBe(202)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Accepted')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('Multiple methods with `app.on`', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.on(['PUT', 'DELETE'], '/posts/:id',

(property) Hono<BlankEnv, BlankSchema, "/">.on: OnHandlerInterface <string[], "/posts/:id", "/posts/:id", JSONRespondReturn<{ postId: string; method: string; }, StatusCode>, BlankInput, BlankEnv>(methods: string[], path: "/posts/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.json({          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ postId: string; method: string; }, StatusCode>(object: { postId: string; method: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

postId:

(property) postId: string

c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.req

(property) Context<BlankEnv, "/posts/:id", BlankInput>.req: HonoRequest<"/posts/:id", unknown> .req is the instance of HonoRequest.

.param('id'),          

(method) HonoRequest<"/posts/:id", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

method:

(property) method: string

c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.req

(property) Context<BlankEnv, "/posts/:id", BlankInput>.req: HonoRequest<"/posts/:id", unknown> .req is the instance of HonoRequest.

.method,          

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.method: string .method() can get the method name of the request.

@see — https://hono.dev/docs/api/request#method

@example
ts app.get('/about/me', (c) => { const method = c.req.method // `GET` })

}) }) it('Should return 200 with PUT', async () => { const req = new

const req: Request

Request('http://localhost/posts/123', {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

method: 'PUT',          

(property) RequestInit.method?: string | undefined A string to set request's method.

}) const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

postId: '123',          

(property) postId: string

method: 'PUT',          

(property) method: string

}) }) it('Should return 200 with DELETE', async () => { const req = new

const req: Request

Request('http://localhost/posts/123', {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

method: 'DELETE',          

(property) RequestInit.method?: string | undefined A string to set request's method.

}) const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

postId: '123',          

(property) postId: string

method: 'DELETE',          

(property) method: string

}) }) it('Should return 404 with POST', async () => { const req = new

const req: Request

Request('http://localhost/posts/123', {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

method: 'POST',          

(property) RequestInit.method?: string | undefined A string to set request's method.

}) const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) }) describe('Multiple paths with one handler', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const paths = ['/hello', '/ja/hello', '/en/hello']          

const paths: string[]

app

const app: Hono<BlankEnv, BlankSchema, "/">

.on('GET',

(property) Hono<BlankEnv, BlankSchema, "/">.on: OnHandlerInterface <BlankInput, JSONRespondReturn<{ path: string; routePath: string; }, StatusCode>>(methods: string | string[], paths: string[], ...handlers: H<...>[]) => Hono<...> (+22 overloads)

paths,

const paths: string[]

(c) => {          

(parameter) c: Context<BlankEnv, any, BlankInput>

return c

(parameter) c: Context<BlankEnv, any, BlankInput>

.json({          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ path: string; routePath: string; }, StatusCode>(object: { path: string; routePath: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

path:

(property) path: string

c

(parameter) c: Context<BlankEnv, any, BlankInput>

.req

(property) Context<BlankEnv, any, BlankInput>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.path,          

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.path: string .path can get the pathname of the request.

@see — https://hono.dev/docs/api/request#path

@example
ts app.get('/about/me', (c) => { const pathname = c.req.path // `/about/me` })

routePath:

(property) routePath: string

c

(parameter) c: Context<BlankEnv, any, BlankInput>

.req

(property) Context<BlankEnv, any, BlankInput>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.routePath,          

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.routePath: string routePath() can retrieve the path registered within the handler

@see — https://hono.dev/docs/api/request#routepath

@example
ts app.get('/posts/:id', (c) => { return c.json({ path: c.req.routePath }) })

}) }) it('Should handle multiple paths', async () => { paths

const paths: string[]

.map(async

(method) Array<string>.map<Promise<void>>(callbackfn: (value: string, index: number, array: string[]) => Promise<void>, thisArg?: any): Promise<void>[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(path) => {          

(parameter) path: string

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(path)          

(parameter) path: string

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

const data = await

const data: any

res

const res: Response

.json()          

(method) Body.json(): Promise<any> MDN Reference

expect(data).toEqual({          

const data: any

path,          

(property) path: string

routePath:

(property) routePath: string

path,          

(parameter) path: string

}) }) }) }) describe('Multiple handler', () => { describe('handler + handler', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/posts/:id',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/posts/:id", "/posts/:id", Response & TypedResponse<`id is ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/posts/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

const id =

const id: string

c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.req

(property) Context<BlankEnv, "/posts/:id", BlankInput>.req: HonoRequest<"/posts/:id", unknown> .req is the instance of HonoRequest.

.param('id')          

(method) HonoRequest<"/posts/:id", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.header('foo', 'bar')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

return c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.text(`id is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`id is ${string}`, StatusCode>(text: `id is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{id}`)          

const id: string

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/:type/:id',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/:type/:id", "/:type/:id", Response & TypedResponse<"foo", StatusCode, "text">, BlankInput, BlankEnv>(path: "/:type/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/:type/:id", BlankInput>

c

(parameter) c: Context<BlankEnv, "/:type/:id", BlankInput>

.status(404)          

(property) Context<BlankEnv, "/:type/:id", BlankInput>.status: (status: StatusCode) => void

c

(parameter) c: Context<BlankEnv, "/:type/:id", BlankInput>

.header('foo2', 'bar2')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

return c

(parameter) c: Context<BlankEnv, "/:type/:id", BlankInput>

.text('foo')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"foo", StatusCode>(text: "foo", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"foo", StatusCode, "text"> (+1 overload)

}) it('Should return response from `specialized` route', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/posts/123')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('id is 123')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('foo')).toBe('bar')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('foo2')).toBeNull()          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('Duplicate param name', () => { describe('basic', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/:type/:url',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/:type/:url", "/:type/:url", Response & TypedResponse<`type: ${string}, url: ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/:type/:url", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/:type/:url", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/:type/:url", BlankInput>

.text(`type: $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`type: ${string}, url: ${string}`, StatusCode>(text: `type: ${string}, url: ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/:type/:url", BlankInput>

.req

(property) Context<BlankEnv, "/:type/:url", BlankInput>.req: HonoRequest<"/:type/:url", unknown> .req is the instance of HonoRequest.

.param('type')}, url: $

(method) HonoRequest<"/:type/:url", unknown>.param<"type">(key: "type"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

{c

(parameter) c: Context<BlankEnv, "/:type/:url", BlankInput>

.req

(property) Context<BlankEnv, "/:type/:url", BlankInput>.req: HonoRequest<"/:type/:url", unknown> .req is the instance of HonoRequest.

.param('url')}`)          

(method) HonoRequest<"/:type/:url", unknown>.param<"url">(key: "url"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/foo/:type/:url',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/foo/:type/:url", "/foo/:type/:url", Response & TypedResponse<`foo type: ${string}, url: ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/foo/:type/:url", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/foo/:type/:url", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/foo/:type/:url", BlankInput>

.text(`foo type: $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`foo type: ${string}, url: ${string}`, StatusCode>(text: `foo type: ${string}, url: ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/foo/:type/:url", BlankInput>

.req

(property) Context<BlankEnv, "/foo/:type/:url", BlankInput>.req: HonoRequest<"/foo/:type/:url", unknown> .req is the instance of HonoRequest.

.param('type')}, url: $

(method) HonoRequest<"/foo/:type/:url", unknown>.param<"type">(key: "type"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

{c

(parameter) c: Context<BlankEnv, "/foo/:type/:url", BlankInput>

.req

(property) Context<BlankEnv, "/foo/:type/:url", BlankInput>.req: HonoRequest<"/foo/:type/:url", unknown> .req is the instance of HonoRequest.

.param('url')}`)          

(method) HonoRequest<"/foo/:type/:url", unknown>.param<"url">(key: "url"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

}) it('Should return a correct param - GET /car/good-car', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/car/good-car')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.ok).toBe(true)          

(property) Response.ok: boolean MDN Reference

expect(await res

const res: Response

.text()).toBe('type: car, url: good-car')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return a correct param - GET /foo/food/good-food', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/foo/food/good-food')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.ok).toBe(true)          

(property) Response.ok: boolean MDN Reference

expect(await res

const res: Response

.text()).toBe('foo type: food, url: good-food')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('self', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/:id/:id',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/:id/:id", "/:id/:id", Response & TypedResponse<`id is ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/:id/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/:id/:id", BlankInput>

const id =

const id: string

c

(parameter) c: Context<BlankEnv, "/:id/:id", BlankInput>

.req

(property) Context<BlankEnv, "/:id/:id", BlankInput>.req: HonoRequest<"/:id/:id", unknown> .req is the instance of HonoRequest.

.param('id')          

(method) HonoRequest<"/:id/:id", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

return c

(parameter) c: Context<BlankEnv, "/:id/:id", BlankInput>

.text(`id is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`id is ${string}`, StatusCode>(text: `id is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{id}`)          

const id: string

}) it('Should return 123 - GET /123/456', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/123/456')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('id is 123')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('hierarchy', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/posts/:id/comments/:comment_id',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/posts/:id/comments/:comment_id", "/posts/:id/comments/:comment_id", Response & TypedResponse<`post: ${string}, comment: ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/posts/:id/comments/:comment_id", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/posts/:id/comments/:comment_id", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/posts/:id/comments/:comment_id", BlankInput>

.text(`post: $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`post: ${string}, comment: ${string}`, StatusCode>(text: `post: ${string}, comment: ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/posts/:id/comments/:comment_id", BlankInput>

.req

(property) Context<BlankEnv, "/posts/:id/comments/:comment_id", BlankInput>.req: HonoRequest<"/posts/:id/comments/:comment_id", unknown> .req is the instance of HonoRequest.

.param('id')}, comment: $

(method) HonoRequest<"/posts/:id/comments/:comment_id", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

{c

(parameter) c: Context<BlankEnv, "/posts/:id/comments/:comment_id", BlankInput>

.req

(property) Context<BlankEnv, "/posts/:id/comments/:comment_id", BlankInput>.req: HonoRequest<"/posts/:id/comments/:comment_id", unknown> .req is the instance of HonoRequest.

.param('comment_id')}`)          

(method) HonoRequest<"/posts/:id/comments/:comment_id", unknown>.param<"comment_id">(key: "comment_id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/posts/:id',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/posts/:id", "/posts/:id", Response & TypedResponse<`post: ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/posts/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.text(`post: $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`post: ${string}`, StatusCode>(text: `post: ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.req

(property) Context<BlankEnv, "/posts/:id", BlankInput>.req: HonoRequest<"/posts/:id", unknown> .req is the instance of HonoRequest.

.param('id')}`)          

(method) HonoRequest<"/posts/:id", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

}) it('Should return a correct param - GET /posts/123/comments/456', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/posts/123/comments/456')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('post: 123, comment: 456')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return a correct param - GET /posts/789', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/posts/789')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('post: 789')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('different regular expression', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/:id/:action{create|update}',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/:id/:action{create|update}", "/:id/:action{create|update}", Response & TypedResponse<`id: ${string}, action: ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/:id/:action{create|update}", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/:id/:action{create|update}", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/:id/:action{create|update}", BlankInput>

.text(`id: $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`id: ${string}, action: ${string}`, StatusCode>(text: `id: ${string}, action: ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/:id/:action{create|update}", BlankInput>

.req

(property) Context<BlankEnv, "/:id/:action{create|update}", BlankInput>.req: HonoRequest<"/:id/:action{create|update}", unknown> .req is the instance of HonoRequest.

.param('id')}, action: $

(method) HonoRequest<"/:id/:action{create|update}", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

{c

(parameter) c: Context<BlankEnv, "/:id/:action{create|update}", BlankInput>

.req

(property) Context<BlankEnv, "/:id/:action{create|update}", BlankInput>.req: HonoRequest<"/:id/:action{create|update}", unknown> .req is the instance of HonoRequest.

.param('action')}`)          

(method) HonoRequest<"/:id/:action{create|update}", unknown>.param<"action">(key: "action"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/:id/:action{delete}',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/:id/:action{delete}", "/:id/:action{delete}", Response & TypedResponse<`id: ${string}, action: ${string}`, StatusCode, "text">, BlankInput, BlankEnv>(path: "/:id/:action{delete}", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/:id/:action{delete}", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/:id/:action{delete}", BlankInput>

.text(`id: $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`id: ${string}, action: ${string}`, StatusCode>(text: `id: ${string}, action: ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{c

(parameter) c: Context<BlankEnv, "/:id/:action{delete}", BlankInput>

.req

(property) Context<BlankEnv, "/:id/:action{delete}", BlankInput>.req: HonoRequest<"/:id/:action{delete}", unknown> .req is the instance of HonoRequest.

.param('id')}, action: $

(method) HonoRequest<"/:id/:action{delete}", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

{c

(parameter) c: Context<BlankEnv, "/:id/:action{delete}", BlankInput>

.req

(property) Context<BlankEnv, "/:id/:action{delete}", BlankInput>.req: HonoRequest<"/:id/:action{delete}", unknown> .req is the instance of HonoRequest.

.param('action')}`)          

(method) HonoRequest<"/:id/:action{delete}", unknown>.param<"action">(key: "action"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

}) it('Should return a correct param - GET /123/create', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/123/create')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('id: 123, action: create')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return a correct param - GET /456/update', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/467/update')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('id: 467, action: update')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return a correct param - GET /789/delete', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/789/delete')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('id: 789, action: delete')          

(method) Body.text(): Promise<string> MDN Reference

}) }) }) }) describe('Multiple handler - async', () => { describe('handler + handler', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/posts/:id', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/posts/:id", "/posts/:id", Promise<Response & TypedResponse<`id is ${string}`, StatusCode, "text">>, BlankInput, BlankEnv>(path: "/posts/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

await new Promise(

var Promise: PromiseConstructor new <unknown>(executor: (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void) => Promise<unknown> Creates a new Promise.

@param executor
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

(resolve) =>

(parameter) resolve: (value: unknown) => void

setTimeout

function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number MDN Reference

(resolve, 1))          

(parameter) resolve: (value: unknown) => void

c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.header('foo2', 'bar2')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

const id =

const id: string

c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.req

(property) Context<BlankEnv, "/posts/:id", BlankInput>.req: HonoRequest<"/posts/:id", unknown> .req is the instance of HonoRequest.

.param('id')          

(method) HonoRequest<"/posts/:id", unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

return c

(parameter) c: Context<BlankEnv, "/posts/:id", BlankInput>

.text(`id is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`id is ${string}`, StatusCode>(text: `id is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{id}`)          

const id: string

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/:type/:id', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/:type/:id", "/:type/:id", Promise<Response & TypedResponse<"foo", StatusCode, "text">>, BlankInput, BlankEnv>(path: "/:type/:id", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/:type/:id", BlankInput>

await new Promise(

var Promise: PromiseConstructor new <unknown>(executor: (resolve: (value: unknown) => void, reject: (reason?: any) => void) => void) => Promise<unknown> Creates a new Promise.

@param executor
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

(resolve) =>

(parameter) resolve: (value: unknown) => void

setTimeout

function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number MDN Reference

(resolve, 1))          

(parameter) resolve: (value: unknown) => void

c

(parameter) c: Context<BlankEnv, "/:type/:id", BlankInput>

.header('foo', 'bar')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

(parameter) c: Context<BlankEnv, "/:type/:id", BlankInput>

.status(404)          

(property) Context<BlankEnv, "/:type/:id", BlankInput>.status: (status: StatusCode) => void

return c

(parameter) c: Context<BlankEnv, "/:type/:id", BlankInput>

.text('foo')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"foo", StatusCode>(text: "foo", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"foo", StatusCode, "text"> (+1 overload)

}) it('Should return response from `specialized` route', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/posts/123')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('id is 123')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('foo')).toBeNull()          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('foo2')).toBe('bar2')          

(method) Headers.get(name: string): string | null MDN Reference

}) }) }) describe('Lack returning response with a single handler', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

// @ts-expect-error it should return Response to type it app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/sync', () => {})          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", BlankInput, BlankInput, HandlerResponse<any>, BlankEnv, {}>(handlers_0: H<BlankEnv, "/", BlankInput, any>, handlers_1: H<...>) => Hono<...> (+22 overloads)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/async', async () => {})          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/async", "/async", HandlerResponse<any>, BlankInput, BlankEnv>(path: "/async", handler: H<BlankEnv, "/async", BlankInput, HandlerResponse<...>>) => Hono<...> (+22 overloads)

it('Should return 404 response if lacking returning response', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/sync')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) it('Should return 404 response if lacking returning response in an async handler', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/async')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

}) }) describe('Context is not finalized', () => { it('should throw error - lack `await next()`', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

// @ts-ignore app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*', () => {})          

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <BlankEnv>(...handlers: MiddlewareHandler<BlankEnv, never, {}>[]) => Hono<{}, BlankSchema, "/"> (+20 overloads)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/foo',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/foo", "/foo", Response & TypedResponse<"foo", StatusCode, "text">, BlankInput, BlankEnv>(path: "/foo", handler: H<BlankEnv, "/foo", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

.text('foo')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"foo", StatusCode>(text: "foo", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"foo", StatusCode, "text"> (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.onError(

(property) Hono<BlankEnv, BlankSchema, "/">.onError: (handler: ErrorHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .onError() handles an error and returns a customized Response.

@see — https://hono.dev/docs/api/hono#error-handling

@param handler — request Handler for error

@returns — changed Hono instance

@example
ts app.onError((err, c) => { console.error(`${err}`) return c.text('Custom Error Message', 500) })

(err,

(parameter) err: Error | HTTPResponseError

c) => {          

(parameter) c: Context<BlankEnv, any, {}>

return c

(parameter) c: Context<BlankEnv, any, {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, 500>(text: string, status?: 500 | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, 500, "text"> (+1 overload)

(err

(parameter) err: Error | HTTPResponseError

.message, 500)          

(property) Error.message: string

}) const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/foo')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(500)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toMatch(/^Context is not finalized/)          

(method) Body.text(): Promise<string> MDN Reference

}) it('should throw error - lack `returning Response`', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(_c,

(parameter) _c: Context<BlankEnv, "*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

}) // @ts-ignore app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/foo', () => {})          

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", BlankInput, BlankInput, HandlerResponse<any>, BlankEnv, {}>(handlers_0: H<BlankEnv, "/", BlankInput, any>, handlers_1: H<...>) => Hono<...> (+22 overloads)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.onError(

(property) Hono<BlankEnv, BlankSchema, "/">.onError: (handler: ErrorHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .onError() handles an error and returns a customized Response.

@see — https://hono.dev/docs/api/hono#error-handling

@param handler — request Handler for error

@returns — changed Hono instance

@example
ts app.onError((err, c) => { console.error(`${err}`) return c.text('Custom Error Message', 500) })

(err,

(parameter) err: Error | HTTPResponseError

c) => {          

(parameter) c: Context<BlankEnv, any, {}>

return c

(parameter) c: Context<BlankEnv, any, {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, 500>(text: string, status?: 500 | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, 500, "text"> (+1 overload)

(err

(parameter) err: Error | HTTPResponseError

.message, 500)          

(property) Error.message: string

}) const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/foo')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(500)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toMatch(/^Context is not finalized/)          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('Parse Body', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.post('/json', async

(property) Hono<BlankEnv, BlankSchema, "/">.post: HandlerInterface <"/json", "/json", Promise<JSONRespondReturn<{}, 200>>, BlankInput, BlankEnv>(path: "/json", handler: H<BlankEnv, "/json", BlankInput, Promise<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/json", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/json", BlankInput>

.json<{}, 200>(await

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{}, 200>(object: {}, status?: 200 | undefined, headers?: HeaderRecord) => JSONRespondReturn<{}, 200> (+1 overload)

c

(parameter) c: Context<BlankEnv, "/json", BlankInput>

.req

(property) Context<BlankEnv, "/json", BlankInput>.req: HonoRequest<"/json", unknown> .req is the instance of HonoRequest.

.parseBody(), 200)          

(method) HonoRequest<"/json", unknown>.parseBody<Partial<ParseBodyOptions>, {}>(options?: Partial<ParseBodyOptions> | undefined): Promise<{}> (+1 overload) .parseBody() can parse Request body of type multipart/form-data or application/x-www-form-urlencoded

@see — https://hono.dev/docs/api/request#parsebody

@example
ts app.post('/entry', async (c) => { const body = await c.req.parseBody() })

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.post('/form', async

(property) Hono<BlankEnv, BlankSchema, "/">.post: HandlerInterface <"/form", "/form", Promise<JSONRespondReturn<{}, 200>>, BlankInput, BlankEnv>(path: "/form", handler: H<BlankEnv, "/form", BlankInput, Promise<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/form", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/form", BlankInput>

.json<{}, 200>(await

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{}, 200>(object: {}, status?: 200 | undefined, headers?: HeaderRecord) => JSONRespondReturn<{}, 200> (+1 overload)

c

(parameter) c: Context<BlankEnv, "/form", BlankInput>

.req

(property) Context<BlankEnv, "/form", BlankInput>.req: HonoRequest<"/form", unknown> .req is the instance of HonoRequest.

.parseBody(), 200)          

(method) HonoRequest<"/form", unknown>.parseBody<Partial<ParseBodyOptions>, {}>(options?: Partial<ParseBodyOptions> | undefined): Promise<{}> (+1 overload) .parseBody() can parse Request body of type multipart/form-data or application/x-www-form-urlencoded

@see — https://hono.dev/docs/api/request#parsebody

@example
ts app.post('/entry', async (c) => { const body = await c.req.parseBody() })

}) it('POST with JSON', async () => { const req = new

const req: Request

Request('http://localhost/json', {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

method: 'POST',          

(property) RequestInit.method?: string | undefined A string to set request's method.

body:

(property) RequestInit.body?: BodyInit | null | undefined A BodyInit object or null to set request's body.

JSON

var JSON: JSON An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.

.stringify({

(method) JSON.stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string (+1 overload) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.

@param value — A JavaScript value, usually an object or array, to be converted.

@param replacer — A function that transforms the results.

@param space — Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.

message: 'hello hono' }),          

(property) message: string

headers: new

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

Headers({ 'Content-Type': 'application/json' }),          

var Headers: new (init?: HeadersInit) => Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

}) const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

}) it('POST with `multipart/form-data`', async () => { const formData = new

const formData: FormData

FormData()          

var FormData: new (form?: HTMLFormElement, submitter?: HTMLElement | null) => FormData Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".

MDN Reference

formData

const formData: FormData

.append('message', 'hello')          

(method) FormData.append(name: string, value: string | Blob): void (+2 overloads) MDN Reference

const req = new

const req: Request

Request('https://localhost/form', {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

method: 'POST',          

(property) RequestInit.method?: string | undefined A string to set request's method.

body:

(property) RequestInit.body?: BodyInit | null | undefined A BodyInit object or null to set request's body.

formData,          

const formData: FormData

}) const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({

(method) Body.json(): Promise<any> MDN Reference

message: 'hello' })          

(property) message: string

}) it('POST with `application/x-www-form-urlencoded`', async () => { const searchParam = new

const searchParam: URLSearchParams

URLSearchParams()          

var URLSearchParams: new (init?: string[][] | Record<string, string> | string | URLSearchParams) => URLSearchParams MDN Reference

searchParam

const searchParam: URLSearchParams

.append('message', 'hello')          

(method) URLSearchParams.append(name: string, value: string): void Appends a specified key/value pair as a new search parameter.

MDN Reference

const req = new

const req: Request

Request('https://localhost/form', {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

method: 'POST',          

(property) RequestInit.method?: string | undefined A string to set request's method.

body:

(property) RequestInit.body?: BodyInit | null | undefined A BodyInit object or null to set request's body.

searchParam,          

const searchParam: URLSearchParams

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

'Content-Type': 'application/x-www-form-urlencoded', }, }) const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({

(method) Body.json(): Promise<any> MDN Reference

message: 'hello' })          

(property) message: string

}) }) describe('Both two middleware returning response', () => { it('Should return correct Content-Type`', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

return c

(parameter) c: Context<BlankEnv, "*", {}>

.html('Foo')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.html: HTMLRespond <"Foo">(html: "Foo", status?: StatusCode, headers?: HeaderRecord) => Response (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"Bar", StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text('Bar')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Bar", StatusCode>(text: "Bar", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Bar", StatusCode, "text"> (+1 overload)

}) const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Bar')          

(method) Body.text(): Promise<string> MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('Content-Type')).toMatch(/^text\/plain/)          

(method) Headers.get(name: string): string | null MDN Reference

}) }) describe('Count of logger called', () => { // It will be added `2` each time the logger is called once. let count = 0          

let count: number

let log = ''          

let log: string

const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const logFn =

const logFn: (str: string) => void

(str: string) => {          

(parameter) str: string

count++          

let count: number

log =

let log: string

str          

(parameter) str: string

} app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*',

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", any>(path: "*", handler: MiddlewareHandler<any, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

logger

(alias) logger(fn?: PrintFunc): MiddlewareHandler import logger Logger Middleware for Hono.

@see — https://hono.dev/docs/middleware/builtin/logger

@param fn — Optional function for customized logging behavior.

@returns — The middleware handler function.

@example
```ts const app = new Hono()

app.use(logger()) app.get('/', (c) => c.text('Hello Hono!')) ```

(logFn))          

const logFn: (str: string) => void

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"foo", StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text('foo'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"foo", StatusCode>(text: "foo", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"foo", StatusCode, "text"> (+1 overload)

it('Should be called two times', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/not-found')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('404 Not Found')          

(method) Body.text(): Promise<string> MDN Reference

expect(count).toBe(2)          

let count: number

expect(log).toMatch(/404/)          

let log: string

}) it('Should be called two times / Custom Not Found', async () => { app

const app: Hono<BlankEnv, BlankSchema, "/">

.notFound(

(property) Hono<BlankEnv, BlankSchema, "/">.notFound: (handler: NotFoundHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .notFound() allows you to customize a Not Found Response.

@see — https://hono.dev/docs/api/hono#not-found

@param handler — request handler for not-found

@returns — changed Hono instance

@example
ts app.notFound((c) => { return c.text('Custom 404 Message', 404) })

(c) =>

(parameter) c: Context<BlankEnv, any, {}>

c

(parameter) c: Context<BlankEnv, any, {}>

.text('Custom Not Found', 404))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Custom Not Found", 404>(text: "Custom Not Found", status?: 404 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Custom Not Found", 404, "text"> (+1 overload)

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/custom-not-found')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res).not.toBeNull()          

const res: Response

expect(res

const res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Custom Not Found')          

(method) Body.text(): Promise<string> MDN Reference

expect(count).toBe(4)          

let count: number

expect(log).toMatch(/404/)          

let log: string

}) }) describe('Context set/get variables', () => { type Variables = {          

type Variables = { id: number; title: string; }

id: number          

(property) id: number

title: string          

(property) title: string

} const app = new

const app: Hono<{ Variables: Variables; }, BlankSchema, "/">

Hono<{

(alias) new Hono<{ Variables: Variables; }, BlankSchema, "/">(options?: HonoOptions<{ Variables: Variables; }>): Hono<{ Variables: Variables; }, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

Variables:

(property) Variables: Variables

Variables }>()          

type Variables = { id: number; title: string; }

it('Should set and get variables with correct types', async () => { app

const app: Hono<{ Variables: Variables; }, BlankSchema, "/">

.use('*', async

(property) Hono<{ Variables: Variables; }, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", { Variables: Variables; }>(path: "*", handler: MiddlewareHandler<{ Variables: Variables; }, "*", {}>) => Hono<{ Variables: Variables; }, { ...; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<{ Variables: Variables; }, "*", {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<{ Variables: Variables; }, "*", {}>

.set('id', 123)          

(property) Context<{ Variables: Variables; }, "*", {}>.set: Set <"id">(key: "id", value: number) => void (+1 overload)

c

(parameter) c: Context<{ Variables: Variables; }, "*", {}>

.set('title', 'Hello')          

(property) Context<{ Variables: Variables; }, "*", {}>.set: Set <"title">(key: "title", value: string) => void (+1 overload)

await next()          

(parameter) next: () => Promise<void>

}) app

const app: Hono<{ Variables: Variables; }, BlankSchema, "/">

.get('/',

(property) Hono<{ Variables: Variables; }, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<`${number} is ${string}`, StatusCode, "text">, BlankInput, { Variables: Variables; }>(path: "/", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<{ Variables: Variables; }, "/", BlankInput>

const id =

const id: number

c

(parameter) c: Context<{ Variables: Variables; }, "/", BlankInput>

.get('id')          

(property) Context<{ Variables: Variables; }, "/", BlankInput>.get: Get <"id">(key: "id") => number (+1 overload)

const title =

const title: string

c

(parameter) c: Context<{ Variables: Variables; }, "/", BlankInput>

.get('title')          

(property) Context<{ Variables: Variables; }, "/", BlankInput>.get: Get <"title">(key: "title") => string (+1 overload)

// type verifyID = Expect> expectTypeOf(id).toEqualTypeOf()          

const id: number

// type verifyTitle = Expect> expectTypeOf(title).toEqualTypeOf()          

const title: string

return c

(parameter) c: Context<{ Variables: Variables; }, "/", BlankInput>

.text(`$

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`${number} is ${string}`, StatusCode>(text: `${number} is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{id} is $

const id: number

{title}`)          

const title: string

}) const res = await

const res: Response

app

const app: Hono<{ Variables: Variables; }, BlankSchema, "/">

.request('http://localhost/')          

(property) Hono<{ Variables: Variables; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('123 is Hello')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('Context binding variables', () => { type Bindings = {          

type Bindings = { USER_ID: number; USER_NAME: string; }

USER_ID: number          

(property) USER_ID: number

USER_NAME: string          

(property) USER_NAME: string

} const app = new

const app: Hono<{ Bindings: Bindings; }, BlankSchema, "/">

Hono<{

(alias) new Hono<{ Bindings: Bindings; }, BlankSchema, "/">(options?: HonoOptions<{ Bindings: Bindings; }>): Hono<{ Bindings: Bindings; }, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

Bindings:

(property) Bindings: Bindings

Bindings }>()          

type Bindings = { USER_ID: number; USER_NAME: string; }

it('Should get binding variables with correct types', async () => { app

const app: Hono<{ Bindings: Bindings; }, BlankSchema, "/">

.get('/',

(property) Hono<{ Bindings: Bindings; }, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"These are verified", StatusCode, "text">, BlankInput, { Bindings: Bindings; }>(path: "/", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<{ Bindings: Bindings; }, "/", BlankInput>

expectTypeOf(c

(parameter) c: Context<{ Bindings: Bindings; }, "/", BlankInput>

.env).toEqualTypeOf

(property) Context<{ Bindings: Bindings; }, "/", BlankInput>.env: Bindings .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

<Bindings>()          

type Bindings = { USER_ID: number; USER_NAME: string; }

return c

(parameter) c: Context<{ Bindings: Bindings; }, "/", BlankInput>

.text('These are verified')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"These are verified", StatusCode>(text: "These are verified", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) const res = await

const res: Response

app

const app: Hono<{ Bindings: Bindings; }, BlankSchema, "/">

.request('http://localhost/')          

(property) Hono<{ Bindings: Bindings; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | Bindings | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

}) }) describe('Handler as variables', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

it('Should be typed correctly', async () => { const handler:

const handler: Handler

Handler =

(alias) type Handler<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = (c: Context<E, P, I>, next: Next) => R import Handler

(c) => {          

(parameter) c: Context<any, any, BlankInput>

const id =

const id: string

c

(parameter) c: Context<any, any, BlankInput>

.req

(property) Context<any, any, BlankInput>.req: HonoRequest<any, unknown> .req is the instance of HonoRequest.

.param('id')          

(method) HonoRequest<any, unknown>.param<"id">(key: "id"): string (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

return c

(parameter) c: Context<any, any, BlankInput>

.text(`Post id is $

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <`Post id is ${string}`, StatusCode>(text: `Post id is ${string}`, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

{id}`)          

const id: string

} app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/posts/:id',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/posts/:id", any, any, BlankInput, any>(path: "/posts/:id", handler: H<any, any, BlankInput, any>) => Hono<BlankEnv, { "/posts/:id": { $get: { input: { ...; }; output: {}; outputFormat: ResponseFormat; status: StatusCode; }; }; }, "/"> (+22 overloads)

handler)          

const handler: Handler

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/posts/123')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Post id is 123')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('json', () => { const api = new

const api: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

api

const api: Hono<BlankEnv, BlankSchema, "/">

.get('/message',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/message", "/message", JSONRespondReturn<{ message: string; }, StatusCode>, BlankInput, BlankEnv>(path: "/message", handler: H<BlankEnv, "/message", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/message", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/message", BlankInput>

.json({          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ message: string; }, StatusCode>(object: { message: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ message: string; }, StatusCode> (+1 overload)

message: 'Hello',          

(property) message: string

}) }) api

const api: Hono<BlankEnv, BlankSchema, "/">

.get('/message-async', async

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/message-async", "/message-async", Promise<JSONRespondReturn<{ message: string; }, StatusCode>>, BlankInput, BlankEnv>(path: "/message-async", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/message-async", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/message-async", BlankInput>

.json({          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ message: string; }, StatusCode>(object: { message: string; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<{ message: string; }, StatusCode> (+1 overload)

message: 'Hello',          

(property) message: string

}) }) describe('Single handler', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/api',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/api", BlankEnv, BlankSchema, "/">(path: "/api", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

api)          

const api: Hono<BlankEnv, BlankSchema, "/">

it('Should return 200 response', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/api/message')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

message: 'Hello',          

(property) message: string

}) }) it('Should return 200 response - with async', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/api/message-async')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

message: 'Hello',          

(property) message: string

}) }) }) describe('With middleware', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(_c,

(parameter) _c: Context<BlankEnv, "*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.route('/api',

(method) Hono<BlankEnv, BlankSchema, "/">.route<"/api", BlankEnv, BlankSchema, "/">(path: "/api", app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

api)          

const api: Hono<BlankEnv, BlankSchema, "/">

it('Should return 200 response', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/api/message')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

message: 'Hello',          

(property) message: string

}) }) it('Should return 200 response - with async', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/api/message-async')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

message: 'Hello',          

(property) message: string

}) }) }) }) describe('Optional parameters', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/api/:version/animal/:type?',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/api/:version/animal/:type?", "/api/:version/animal/:type?", JSONRespondReturn<{ type: string | undefined; }, StatusCode>, BlankInput, BlankEnv>(path: "/api/:version/animal/:type?", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/api/:version/animal/:type?", BlankInput>

const type1 =

const type1: string | undefined

c

(parameter) c: Context<BlankEnv, "/api/:version/animal/:type?", BlankInput>

.req

(property) Context<BlankEnv, "/api/:version/animal/:type?", BlankInput>.req: HonoRequest<"/api/:version/animal/:type?", unknown> .req is the instance of HonoRequest.

.param('type')          

(method) HonoRequest<"/api/:version/animal/:type?", unknown>.param<"type">(key: "type"): string | undefined (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

expectTypeOf(type1).toEqualTypeOf()          

const type1: string | undefined

const { type,

const type: string | undefined

version } =

const version: string

c

(parameter) c: Context<BlankEnv, "/api/:version/animal/:type?", BlankInput>

.req

(property) Context<BlankEnv, "/api/:version/animal/:type?", BlankInput>.req: HonoRequest<"/api/:version/animal/:type?", unknown> .req is the instance of HonoRequest.

.param()          

(method) HonoRequest<"/api/:version/animal/:type?", unknown>.param<"/api/:version/animal/:type?">(): { version: string; type: string | undefined; } (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

expectTypeOf(version).toEqualTypeOf()          

const version: string

expectTypeOf(type).toEqualTypeOf()          

const type: string | undefined

return c

(parameter) c: Context<BlankEnv, "/api/:version/animal/:type?", BlankInput>

.json({          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <{ type: string | undefined; }, StatusCode>(object: { type: string | undefined; }, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

type:

(property) type: string | undefined

type,          

const type: string | undefined

}) }) it('Should match with an optional parameter', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/api/v1/animal/bird')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

type: 'bird',          

(property) type: string

}) }) it('Should match without an optional parameter', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('http://localhost/api/v1/animal')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

type: undefined,          

(property) type: undefined

}) }) it('Should have a correct type with an optional parameter in a regexp path', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/url/:url{.*}?',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/url/:url{.*}?", "/url/:url{.*}?", JSONRespondReturn<0, StatusCode>, BlankInput, BlankEnv>(path: "/url/:url{.*}?", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/url/:url{.*}?", BlankInput>

const url =

const url: string | undefined

c

(parameter) c: Context<BlankEnv, "/url/:url{.*}?", BlankInput>

.req

(property) Context<BlankEnv, "/url/:url{.*}?", BlankInput>.req: HonoRequest<"/url/:url{.*}?", unknown> .req is the instance of HonoRequest.

.param('url')          

(method) HonoRequest<"/url/:url{.*}?", unknown>.param<"url">(key: "url"): string | undefined (+3 overloads) .req.param() gets the path parameters.

@see — https://hono.dev/docs/api/routing#path-parameter

@example
ts const name = c.req.param('name') // or all parameters at once const { id, comment_id } = c.req.param()

expectTypeOf(url).toEqualTypeOf()          

const url: string | undefined

return c

(parameter) c: Context<BlankEnv, "/url/:url{.*}?", BlankInput>

.json(0)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <0, StatusCode>(object: 0, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<0, StatusCode> (+1 overload)

}) }) }) describe('app.mount()', () => { describe('Basic', () => { const anotherApp =

const anotherApp: (req: Request, ...params: unknown[]) => Response

(req:

(parameter) req: Request

Request, ..

interface Request This Fetch API interface represents a resource request.

MDN Reference

.params: unknown[]) => {          

(parameter) params: unknown[]

const path =

const path: string

getPath

(alias) getPath(request: Request): string import getPath

(req)          

(parameter) req: Request

if (path === '/') {          

const path: string

return new Response('AnotherApp')          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

} if (path === '/hello') {          

const path: string

return new Response('Hello from AnotherApp')          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

} if (path === '/header') {          

const path: string

const message =

const message: string | null

req

(parameter) req: Request

.headers

(property) Request.headers: Headers Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.

MDN Reference

.get('x-message')          

(method) Headers.get(name: string): string | null MDN Reference

return new Response

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

(message)          

const message: string | null

} if (path === '/with-query') {          

const path: string

const queryStrings = new

const queryStrings: string

URL

var URL: new (url: string | URL, base?: string | URL) => URL The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference

(req

(parameter) req: Request

.url)

(property) Request.url: string Returns the URL of request as a string.

MDN Reference

.searchParams

(property) URL.searchParams: URLSearchParams MDN Reference

.toString()          

(method) URLSearchParams.toString(): string Returns a string containing a query string suitable for use in a URL. Does not include the question mark.

return new Response

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

(queryStrings)          

const queryStrings: string

} if (path == '/with-params') {          

const path: string

return new Response(          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

JSON

var JSON: JSON An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.

.stringify({          

(method) JSON.stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string (+1 overload) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.

@param value — A JavaScript value, usually an object or array, to be converted.

@param replacer — A function that transforms the results.

@param space — Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.

params,          

(property) params: unknown[]

}), { headers: {          

(property) ResponseInit.headers?: HeadersInit | undefined

'Content-Type': 'application.json', }, } ) } if (path === '/undefined') {          

const path: string

return undefined as unknown as Response          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

} return new Response('Not Found from AnotherApp', {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 404,          

(property) ResponseInit.status?: number | undefined

}) } const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('*', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", BlankEnv>(path: "*", handler: MiddlewareHandler<BlankEnv, "*", {}>) => Hono<{}, { "*": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "*", {}>

next) => {          

(parameter) next: Next

await next()          

(parameter) next: () => Promise<void>

c

(parameter) c: Context<BlankEnv, "*", {}>

.header('x-message', 'Foo')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"Hono", StatusCode, "text">, BlankInput, BlankEnv>(path: "/", handler: H<BlankEnv, "/", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/", BlankInput>

c

(parameter) c: Context<BlankEnv, "/", BlankInput>

.text('Hono'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Hono", StatusCode>(text: "Hono", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Hono", StatusCode, "text"> (+1 overload)

app

const app: Hono<BlankEnv, BlankSchema, "/">

.notFound(

(property) Hono<BlankEnv, BlankSchema, "/">.notFound: (handler: NotFoundHandler<BlankEnv>) => Hono<BlankEnv, BlankSchema, "/"> .notFound() allows you to customize a Not Found Response.

@see — https://hono.dev/docs/api/hono#not-found

@param handler — request handler for not-found

@returns — changed Hono instance

@example
ts app.notFound((c) => { return c.text('Custom 404 Message', 404) })

(c) => {          

(parameter) c: Context<BlankEnv, any, {}>

return c

(parameter) c: Context<BlankEnv, any, {}>

.text('Not Found from App', 404)          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Not Found from App", 404>(text: "Not Found from App", status?: 404 | undefined, headers?: HeaderRecord) => Response & TypedResponse<"Not Found from App", 404, "text"> (+1 overload)

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.mount('/another-app',

(method) Hono<BlankEnv, BlankSchema, "/">.mount(path: string, applicationHandler: (request: Request, ...args: any) => Response | Promise<Response>, options?: MountOptions): Hono<BlankEnv, BlankSchema, "/"> .mount() allows you to mount applications built with other frameworks into your Hono application.

@see — https://hono.dev/docs/api/hono#mount

@param path — base Path

@param applicationHandler — other Request Handler

@param options — options of .mount()

@returns — mounted Hono instance

@example
```ts import { Router as IttyRouter } from 'itty-router' import { Hono } from 'hono' // Create itty-router application const ittyRouter = IttyRouter() // GET /itty-router/hello ittyRouter.get('/hello', () => new Response('Hello from itty-router'))

const app = new Hono() app.mount('/itty-router', ittyRouter.handle) ```

@example
ts const app = new Hono() // Send the request to another application without modification. app.mount('/app', anotherApp, { replaceRequest: (req) => req, })

anotherApp, () => {          

const anotherApp: (req: Request, ...params: unknown[]) => Response

return 'params' }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.mount('/another-app-with-array-option',

(method) Hono<BlankEnv, BlankSchema, "/">.mount(path: string, applicationHandler: (request: Request, ...args: any) => Response | Promise<Response>, options?: MountOptions): Hono<BlankEnv, BlankSchema, "/"> .mount() allows you to mount applications built with other frameworks into your Hono application.

@see — https://hono.dev/docs/api/hono#mount

@param path — base Path

@param applicationHandler — other Request Handler

@param options — options of .mount()

@returns — mounted Hono instance

@example
```ts import { Router as IttyRouter } from 'itty-router' import { Hono } from 'hono' // Create itty-router application const ittyRouter = IttyRouter() // GET /itty-router/hello ittyRouter.get('/hello', () => new Response('Hello from itty-router'))

const app = new Hono() app.mount('/itty-router', ittyRouter.handle) ```

@example
ts const app = new Hono() // Send the request to another application without modification. app.mount('/app', anotherApp, { replaceRequest: (req) => req, })

anotherApp, () => {          

const anotherApp: (req: Request, ...params: unknown[]) => Response

return ['param1', 'param2'] }) app

const app: Hono<BlankEnv, BlankSchema, "/">

.mount('/another-app2/sub-slash/',

(method) Hono<BlankEnv, BlankSchema, "/">.mount(path: string, applicationHandler: (request: Request, ...args: any) => Response | Promise<Response>, options?: MountOptions): Hono<BlankEnv, BlankSchema, "/"> .mount() allows you to mount applications built with other frameworks into your Hono application.

@see — https://hono.dev/docs/api/hono#mount

@param path — base Path

@param applicationHandler — other Request Handler

@param options — options of .mount()

@returns — mounted Hono instance

@example
```ts import { Router as IttyRouter } from 'itty-router' import { Hono } from 'hono' // Create itty-router application const ittyRouter = IttyRouter() // GET /itty-router/hello ittyRouter.get('/hello', () => new Response('Hello from itty-router'))

const app = new Hono() app.mount('/itty-router', ittyRouter.handle) ```

@example
ts const app = new Hono() // Send the request to another application without modification. app.mount('/app', anotherApp, { replaceRequest: (req) => req, })

anotherApp)          

const anotherApp: (req: Request, ...params: unknown[]) => Response

const api = new

const api: Hono<BlankEnv, BlankSchema, "/api">

Hono()

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.basePath('/api')          

(method) Hono<BlankEnv, BlankSchema, "/">.basePath<"/api">(path: "/api"): Hono<BlankEnv, BlankSchema, "/api"> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

api

const api: Hono<BlankEnv, BlankSchema, "/api">

.mount('/another-app',

(method) Hono<BlankEnv, BlankSchema, "/api">.mount(path: string, applicationHandler: (request: Request, ...args: any) => Response | Promise<Response>, options?: MountOptions): Hono<BlankEnv, BlankSchema, "/api"> .mount() allows you to mount applications built with other frameworks into your Hono application.

@see — https://hono.dev/docs/api/hono#mount

@param path — base Path

@param applicationHandler — other Request Handler

@param options — options of .mount()

@returns — mounted Hono instance

@example
```ts import { Router as IttyRouter } from 'itty-router' import { Hono } from 'hono' // Create itty-router application const ittyRouter = IttyRouter() // GET /itty-router/hello ittyRouter.get('/hello', () => new Response('Hello from itty-router'))

const app = new Hono() app.mount('/itty-router', ittyRouter.handle) ```

@example
ts const app = new Hono() // Send the request to another application without modification. app.mount('/app', anotherApp, { replaceRequest: (req) => req, })

anotherApp)          

const anotherApp: (req: Request, ...params: unknown[]) => Response

it('Should return responses from Hono app', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-message')).toBe('Foo')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('Hono')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return responses from AnotherApp', async () => { let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/another-app')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

let res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-message')).toBe('Foo')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

let res: Response

.text()).toBe('AnotherApp')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/another-app/hello')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

let res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-message')).toBe('Foo')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

let res: Response

.text()).toBe('Hello from AnotherApp')          

(method) Body.text(): Promise<string> MDN Reference

const req = new

const req: Request

Request('http://localhost/another-app/header', {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

headers: {          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

'x-message': 'Message Foo!', }, }) res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

let res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-message')).toBe('Foo')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

let res: Response

.text()).toBe('Message Foo!')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/another-app/not-found')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(res

let res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('x-message')).toBe('Foo')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

let res: Response

.text()).toBe('Not Found from AnotherApp')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/another-app/with-query?foo=bar&baz=qux')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('foo=bar&baz=qux')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/another-app/with-params')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

params: ['params'],          

(property) params: string[]

}) res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/another-app/undefined')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('Not Found from App')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return response from Another app with an array option', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/another-app-with-array-option/with-params')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

params: ['param1', 'param2'],          

(property) params: string[]

}) }) it('Should return responses from AnotherApp - sub + slash', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/another-app2/sub-slash')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('AnotherApp')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return responses from AnotherApp - with `basePath()`', async () => { const res = await

const res: Response

api

const api: Hono<BlankEnv, BlankSchema, "/api">

.request('/api/another-app')          

(property) Hono<BlankEnv, BlankSchema, "/api">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('AnotherApp')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('With fetch', () => { const anotherApp = async

const anotherApp: (req: Request, env: {}, executionContext: ExecutionContext) => Promise<Response>

(req:

(parameter) req: Request

Request,

interface Request This Fetch API interface represents a resource request.

MDN Reference

env: {},

(parameter) env: {}

executionContext:

(parameter) executionContext: ExecutionContext

ExecutionContext) => {          

(alias) interface ExecutionContext import ExecutionContext Interface for the execution context in a web worker or similar environment.

const path =

const path: string

getPath

(alias) getPath(request: Request): string import getPath

(req)          

(parameter) req: Request

if (path === '/') {          

const path: string

return new Response(          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

JSON

var JSON: JSON An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.

.stringify({          

(method) JSON.stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string (+1 overload) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.

@param value — A JavaScript value, usually an object or array, to be converted.

@param replacer — A function that transforms the results.

@param space — Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.

env,          

(property) env: {}

executionContext,          

(property) executionContext: ExecutionContext

}), { headers: {          

(property) ResponseInit.headers?: HeadersInit | undefined

'Content-Type': 'application/json', }, } ) } return new Response('Not Found from AnotherApp', {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 404,          

(property) ResponseInit.status?: number | undefined

}) } const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.mount('/another-app',

(method) Hono<BlankEnv, BlankSchema, "/">.mount(path: string, applicationHandler: (request: Request, ...args: any) => Response | Promise<Response>, options?: MountOptions): Hono<BlankEnv, BlankSchema, "/"> .mount() allows you to mount applications built with other frameworks into your Hono application.

@see — https://hono.dev/docs/api/hono#mount

@param path — base Path

@param applicationHandler — other Request Handler

@param options — options of .mount()

@returns — mounted Hono instance

@example
```ts import { Router as IttyRouter } from 'itty-router' import { Hono } from 'hono' // Create itty-router application const ittyRouter = IttyRouter() // GET /itty-router/hello ittyRouter.get('/hello', () => new Response('Hello from itty-router'))

const app = new Hono() app.mount('/itty-router', ittyRouter.handle) ```

@example
ts const app = new Hono() // Send the request to another application without modification. app.mount('/app', anotherApp, { replaceRequest: (req) => req, })

anotherApp)          

const anotherApp: (req: Request, env: {}, executionContext: ExecutionContext) => Promise<Response>

it('Should handle Env and ExecuteContext', async () => { const request = new

const request: Request

Request('http://localhost/another-app')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.fetch(          

(property) Hono<BlankEnv, BlankSchema, "/">.fetch: (request: Request, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .fetch() will be entry point of your app.

@see — https://hono.dev/docs/api/hono#fetch

@param request — request Object of request

@param Env — env Object

@param — - context of execution

@returns — response of request

request,          

const request: Request

{ TOKEN: 'foo',          

(property) TOKEN: string

}, { // Force mocking! // @ts-ignore waitUntil: 'waitUntil',          

(method) ExecutionContext.waitUntil(promise: Promise<unknown>): void Extends the lifetime of the event callback until the promise is settled.

@param promise — A promise to wait for.

// @ts-ignore passThroughOnException: 'passThroughOnException',          

(method) ExecutionContext.passThroughOnException(): void Allows the event to be passed through to subsequent event listeners.

} ) expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.json()).toEqual({          

(method) Body.json(): Promise<any> MDN Reference

env: {          

(property) env: { TOKEN: string; }

TOKEN: 'foo',          

(property) TOKEN: string

}, executionContext: {          

(property) executionContext: { waitUntil: string; passThroughOnException: string; }

waitUntil: 'waitUntil',          

(property) waitUntil: string

passThroughOnException: 'passThroughOnException',          

(property) passThroughOnException: string

}, }) }) }) describe('Mount on `/`', () => { const anotherApp =

const anotherApp: (req: Request, params: unknown) => Response

(req:

(parameter) req: Request

Request,

interface Request This Fetch API interface represents a resource request.

MDN Reference

params: unknown) => {          

(parameter) params: unknown

const path =

const path: string

getPath

(alias) getPath(request: Request): string import getPath

(req)          

(parameter) req: Request

if (path === '/') {          

const path: string

return new Response('AnotherApp')          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

} if (path === '/hello') {          

const path: string

return new Response('Hello from AnotherApp')          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

} if (path === '/good/night') {          

const path: string

return new Response('Good Night from AnotherApp')          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

} return new Response('Not Found from AnotherApp', {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 404,          

(property) ResponseInit.status?: number | undefined

}) } const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.mount('/',

(method) Hono<BlankEnv, BlankSchema, "/">.mount(path: string, applicationHandler: (request: Request, ...args: any) => Response | Promise<Response>, options?: MountOptions): Hono<BlankEnv, BlankSchema, "/"> .mount() allows you to mount applications built with other frameworks into your Hono application.

@see — https://hono.dev/docs/api/hono#mount

@param path — base Path

@param applicationHandler — other Request Handler

@param options — options of .mount()

@returns — mounted Hono instance

@example
```ts import { Router as IttyRouter } from 'itty-router' import { Hono } from 'hono' // Create itty-router application const ittyRouter = IttyRouter() // GET /itty-router/hello ittyRouter.get('/hello', () => new Response('Hello from itty-router'))

const app = new Hono() app.mount('/itty-router', ittyRouter.handle) ```

@example
ts const app = new Hono() // Send the request to another application without modification. app.mount('/app', anotherApp, { replaceRequest: (req) => req, })

anotherApp)          

const anotherApp: (req: Request, params: unknown) => Response

it('Should return responses from AnotherApp - mount on `/`', async () => { let res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('AnotherApp')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/hello')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('Hello from AnotherApp')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/good/night')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('Good Night from AnotherApp')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/not-found')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(404)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('Not Found from AnotherApp')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('With replaceRequest option', () => { const anotherApp =

const anotherApp: (req: Request) => Response

(req:

(parameter) req: Request

Request) => {          

interface Request This Fetch API interface represents a resource request.

MDN Reference

const path =

const path: string

getPath

(alias) getPath(request: Request): string import getPath

(req)          

(parameter) req: Request

if (path === '/app') {          

const path: string

return new Response

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

(getPath

(alias) getPath(request: Request): string import getPath

(req))          

(parameter) req: Request

} return new Response(null, {

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 404 })          

(property) ResponseInit.status?: number | undefined

} const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.mount('/app',

(method) Hono<BlankEnv, BlankSchema, "/">.mount(path: string, applicationHandler: (request: Request, ...args: any) => Response | Promise<Response>, options?: MountOptions): Hono<BlankEnv, BlankSchema, "/"> .mount() allows you to mount applications built with other frameworks into your Hono application.

@see — https://hono.dev/docs/api/hono#mount

@param path — base Path

@param applicationHandler — other Request Handler

@param options — options of .mount()

@returns — mounted Hono instance

@example
```ts import { Router as IttyRouter } from 'itty-router' import { Hono } from 'hono' // Create itty-router application const ittyRouter = IttyRouter() // GET /itty-router/hello ittyRouter.get('/hello', () => new Response('Hello from itty-router'))

const app = new Hono() app.mount('/itty-router', ittyRouter.handle) ```

@example
ts const app = new Hono() // Send the request to another application without modification. app.mount('/app', anotherApp, { replaceRequest: (req) => req, })

anotherApp, {          

const anotherApp: (req: Request) => Response

replaceRequest:

(property) replaceRequest?: MountReplaceRequest | undefined

(req) =>

(parameter) req: Request

req,          

(parameter) req: Request

}) it('Should return 200 response with the correct path', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/app')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('/app')          

(method) Body.text(): Promise<string> MDN Reference

}) }) }) describe('HEAD method', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/page',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/page", "/page", Response & TypedResponse<"/page", StatusCode, "text">, BlankInput, BlankEnv>(path: "/page", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/page", BlankInput>

c

(parameter) c: Context<BlankEnv, "/page", BlankInput>

.header('X-Message', 'Foo')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

(parameter) c: Context<BlankEnv, "/page", BlankInput>

.header('X-Method',

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.header: SetHeaders (name: string, value?: string, options?: SetHeadersOptions) => void (+2 overloads)

c

(parameter) c: Context<BlankEnv, "/page", BlankInput>

.req

(property) Context<BlankEnv, "/page", BlankInput>.req: HonoRequest<"/page", unknown> .req is the instance of HonoRequest.

.method)          

(property) HonoRequest<P extends string = "/", I extends Input["out"] = {}>.method: string .method() can get the method name of the request.

@see — https://hono.dev/docs/api/request#method

@example
ts app.get('/about/me', (c) => { const method = c.req.method // `GET` })

return c

(parameter) c: Context<BlankEnv, "/page", BlankInput>

.text('/page')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"/page", StatusCode>(text: "/page", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) it('Should return 200 response with body - GET /page', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/page')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Message')).toBe('Foo')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Method')).toBe('GET')          

(method) Headers.get(name: string): string | null MDN Reference

expect(await res

const res: Response

.text()).toBe('/page')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return 200 response without body - HEAD /page', async () => { const req = new

const req: Request

Request('http://localhost/page', {          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

method: 'HEAD',          

(property) RequestInit.method?: string | undefined A string to set request's method.

}) const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req)          

const req: Request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Message')).toBe('Foo')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.headers

(property) Response.headers: Headers MDN Reference

.get('X-Method')).toBe('HEAD')          

(method) Headers.get(name: string): string | null MDN Reference

expect(res

const res: Response

.body).toBe(null)          

(property) Body.body: ReadableStream<Uint8Array> | null MDN Reference

}) }) declare module './context' { interface ContextRenderer {          

interface ContextRenderer Interface for context renderer.

(content: string |

(parameter) content: string | Promise<string>

Promise,

interface Promise<T> Represents the completion of an asynchronous operation

head: {

(parameter) head: { title: string; }

title: string }):

(property) title: string

Response |

interface Response This Fetch API interface represents the response to a request.

MDN Reference

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<Response>          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

} } describe('app.request()', () => { it('Should return response with Request and RequestInit as args', async () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/foo',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/foo", "/foo", JSONRespondReturn<string | undefined, StatusCode>, BlankInput, BlankEnv>(path: "/foo", handler: H<BlankEnv, "/foo", BlankInput, JSONRespondReturn<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

.json

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <string | undefined, StatusCode>(object: string | undefined, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<...> (+1 overload)

(c

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

.req

(property) Context<BlankEnv, "/foo", BlankInput>.req: HonoRequest<"/foo", unknown> .req is the instance of HonoRequest.

.header('x-message'))          

(method) HonoRequest<"/foo", unknown>.header(name: string): string | undefined (+1 overload) .header() can get the request header value.

@see — https://hono.dev/docs/api/request#header

@example
ts app.get('/', (c) => { const userAgent = c.req.header('User-Agent') })

}) const req = new

const req: Request

Request('http://localhost/foo')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

const headers = new

const headers: Headers

Headers()          

var Headers: new (init?: HeadersInit) => Headers This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence.

MDN Reference

headers

const headers: Headers

.append('x-message', 'hello')          

(method) Headers.append(name: string, value: string): void MDN Reference

const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

(req, {          

const req: Request

headers,          

(property) RequestInit.headers?: HeadersInit | undefined A Headers object, an object literal, or an array of two-item arrays to set request's headers.

}) expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('"hello"')          

(method) Body.text(): Promise<string> MDN Reference

}) }) describe('app.fire()', () => { it('Should call global.addEventListener', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const addEventListener = vi.fn()          

const addEventListener: any

global.addEventListener = addEventListener          

const addEventListener: any

app

const app: Hono<BlankEnv, BlankSchema, "/">

.fire()          

(property) Hono<BlankEnv, BlankSchema, "/">.fire: () => void .fire() automatically adds a global fetch event listener. This can be useful for environments that adhere to the Service Worker API, such as non-ES module Cloudflare Workers.

@see — https://hono.dev/docs/api/hono#fire

@see — https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API

@see — https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/

expect(addEventListener).toHaveBeenCalledWith('fetch', expect.any

const addEventListener: any

(Function))          

var Function: FunctionConstructor Creates a new function.

const fetchEventListener =

const fetchEventListener: any

addEventListener.mock.calls[0][1]          

const addEventListener: any

const respondWith = vi.fn()          

const respondWith: any

const request = new

const request: Request

Request('http://localhost')          

var Request: new (input: RequestInfo | URL, init?: RequestInit) => Request This Fetch API interface represents a resource request.

MDN Reference

fetchEventListener({

const fetchEventListener: any

respondWith,

(property) respondWith: any

request })          

(property) request: Request

expect(respondWith).toHaveBeenCalledWith(expect.any

const respondWith: any

(Promise))          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

}) }) describe('Context render and setRenderer', () => { const app = new

const app: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/default',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/default", "/default", Response | Promise<Response>, BlankInput, BlankEnv>(path: "/default", handler: H<BlankEnv, "/default", BlankInput, Response | Promise<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/default", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/default", BlankInput>

.render('

content

', {

(property) Context<BlankEnv, "/default", BlankInput>.render: ContextRenderer (content: string | Promise<string>, head: { title: string; }) => Response | Promise<Response> (+1 overload)

title: 'dummy ' })          

(property) title: string

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.use('/page', async

(property) Hono<BlankEnv, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/page", "/page", BlankEnv>(path: "/page", handler: MiddlewareHandler<BlankEnv, "/page", {}>) => Hono<{}, { "/page": {}; }, "/"> (+20 overloads)

(c,

(parameter) c: Context<BlankEnv, "/page", {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<BlankEnv, "/page", {}>

.setRenderer(

(property) Context<BlankEnv, "/page", {}>.setRenderer: (renderer: ContextRenderer) => void .setRenderer() can set the layout in the custom middleware.

@see — https://hono.dev/docs/api/context#render-setrenderer

@example
tsx app.use('*', async (c, next) => { c.setRenderer((content) => { return c.html( <html> <body> <p>{content}</p> </body> </html> ) }) await next() })

(content,

(parameter) content: string | Promise<string>

head) => {          

(parameter) head: { title: string; } | { title: string; }

return new Response(          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

`${</span><span class="annotated">head<span class="annotation"><p><code>(parameter) head: { title: string; } | { title: string; }</code></p></span></span><span class="annotated">.</span><span class="annotated">title}

$

(property) title: string

{content}

`          

(parameter) content: string | Promise<string>

) }) await next()          

(parameter) next: () => Promise<void>

}) app

const app: Hono<BlankEnv, BlankSchema, "/">

.get('/page',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/page", "/page", Response | Promise<Response>, BlankInput, BlankEnv>(path: "/page", handler: H<BlankEnv, "/page", BlankInput, Response | Promise<...>>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<BlankEnv, "/page", BlankInput>

return c

(parameter) c: Context<BlankEnv, "/page", BlankInput>

.render('page content', {          

(property) Context<BlankEnv, "/page", BlankInput>.render: ContextRenderer (content: string | Promise<string>, head: { title: string; }) => Response | Promise<Response> (+1 overload)

title: 'page title',          

(property) title: string

}) }) it('Should return a Response from the default renderer', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/default')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(await res

const res: Response

.text()).toBe('

content

')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return a Response from the custom renderer', async () => { const res = await

const res: Response

app

const app: Hono<BlankEnv, BlankSchema, "/">

.request('/page')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(await res

const res: Response

.text()).toBe(          

(method) Body.text(): Promise<string> MDN Reference

'page title

page content

'
) }) }) describe('c.var - with testing types', () => { const app = new

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

Hono<{          

(alias) new Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">(options?: HonoOptions<{ Bindings: { Token: string; }; }>): Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

Bindings: {          

(property) Bindings: { Token: string; }

Token: string          

(property) Token: string

} }>() const mw =          

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

(): MiddlewareHandler<{          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

Variables: {          

(property) Variables: { echo: (str: string) => string; }

echo:

(property) echo: (str: string) => string

(str: string) => string          

(parameter) str: string

} }> => async (c,

(parameter) c: Context<{ Variables: { echo: (str: string) => string; }; }, string, {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<{ Variables: { echo: (str: string) => string; }; }, string, {}>

.set('echo',

(property) Context<{ Variables: { echo: (str: string) => string; }; }, string, {}>.set: Set <"echo">(key: "echo", value: (str: string) => string) => void (+1 overload)

(str) =>

(parameter) str: string

str)          

(parameter) str: string

await next()          

(parameter) next: () => Promise<void>

} const mw2 =          

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

(): MiddlewareHandler<{          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

Variables: {          

(property) Variables: { echo2: (str: string) => string; }

echo2:

(property) echo2: (str: string) => string

(str: string) => string          

(parameter) str: string

} }> => async (c,

(parameter) c: Context<{ Variables: { echo2: (str: string) => string; }; }, string, {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<{ Variables: { echo2: (str: string) => string; }; }, string, {}>

.set('echo2',

(property) Context<{ Variables: { echo2: (str: string) => string; }; }, string, {}>.set: Set <"echo2">(key: "echo2", value: (str: string) => string) => void (+1 overload)

(str) =>

(parameter) str: string

str)          

(parameter) str: string

await next()          

(parameter) next: () => Promise<void>

} const mw3 =          

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

(): MiddlewareHandler<{          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

Variables: {          

(property) Variables: { echo3: (str: string) => string; }

echo3:

(property) echo3: (str: string) => string

(str: string) => string          

(parameter) str: string

} }> => async (c,

(parameter) c: Context<{ Variables: { echo3: (str: string) => string; }; }, string, {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<{ Variables: { echo3: (str: string) => string; }; }, string, {}>

.set('echo3',

(property) Context<{ Variables: { echo3: (str: string) => string; }; }, string, {}>.set: Set <"echo3">(key: "echo3", value: (str: string) => string) => void (+1 overload)

(str) =>

(parameter) str: string

str)          

(parameter) str: string

await next()          

(parameter) next: () => Promise<void>

} const mw4 =          

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

(): MiddlewareHandler<{          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

Variables: {          

(property) Variables: { echo4: (str: string) => string; }

echo4:

(property) echo4: (str: string) => string

(str: string) => string          

(parameter) str: string

} }> => async (c,

(parameter) c: Context<{ Variables: { echo4: (str: string) => string; }; }, string, {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<{ Variables: { echo4: (str: string) => string; }; }, string, {}>

.set('echo4',

(property) Context<{ Variables: { echo4: (str: string) => string; }; }, string, {}>.set: Set <"echo4">(key: "echo4", value: (str: string) => string) => void (+1 overload)

(str) =>

(parameter) str: string

str)          

(parameter) str: string

await next()          

(parameter) next: () => Promise<void>

} const mw5 =          

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

(): MiddlewareHandler<{          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

Variables: {          

(property) Variables: { echo5: (str: string) => string; }

echo5:

(property) echo5: (str: string) => string

(str: string) => string          

(parameter) str: string

} }> => async (c,

(parameter) c: Context<{ Variables: { echo5: (str: string) => string; }; }, string, {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<{ Variables: { echo5: (str: string) => string; }; }, string, {}>

.set('echo5',

(property) Context<{ Variables: { echo5: (str: string) => string; }; }, string, {}>.set: Set <"echo5">(key: "echo5", value: (str: string) => string) => void (+1 overload)

(str) =>

(parameter) str: string

str)          

(parameter) str: string

await next()          

(parameter) next: () => Promise<void>

} const mw6 =          

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

(): MiddlewareHandler<{          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

Variables: {          

(property) Variables: { echo6: (str: string) => string; }

echo6:

(property) echo6: (str: string) => string

(str: string) => string          

(parameter) str: string

} }> => async (c,

(parameter) c: Context<{ Variables: { echo6: (str: string) => string; }; }, string, {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<{ Variables: { echo6: (str: string) => string; }; }, string, {}>

.set('echo6',

(property) Context<{ Variables: { echo6: (str: string) => string; }; }, string, {}>.set: Set <"echo6">(key: "echo6", value: (str: string) => string) => void (+1 overload)

(str) =>

(parameter) str: string

str)          

(parameter) str: string

await next()          

(parameter) next: () => Promise<void>

} const mw7 =          

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

(): MiddlewareHandler<{          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

Variables: {          

(property) Variables: { echo7: (str: string) => string; }

echo7:

(property) echo7: (str: string) => string

(str: string) => string          

(parameter) str: string

} }> => async (c,

(parameter) c: Context<{ Variables: { echo7: (str: string) => string; }; }, string, {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<{ Variables: { echo7: (str: string) => string; }; }, string, {}>

.set('echo7',

(property) Context<{ Variables: { echo7: (str: string) => string; }; }, string, {}>.set: Set <"echo7">(key: "echo7", value: (str: string) => string) => void (+1 overload)

(str) =>

(parameter) str: string

str)          

(parameter) str: string

await next()          

(parameter) next: () => Promise<void>

} const mw8 =          

const mw8: () => MiddlewareHandler<{ Variables: { echo8: (str: string) => string; }; }>

(): MiddlewareHandler<{          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

Variables: {          

(property) Variables: { echo8: (str: string) => string; }

echo8:

(property) echo8: (str: string) => string

(str: string) => string          

(parameter) str: string

} }> => async (c,

(parameter) c: Context<{ Variables: { echo8: (str: string) => string; }; }, string, {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<{ Variables: { echo8: (str: string) => string; }; }, string, {}>

.set('echo8',

(property) Context<{ Variables: { echo8: (str: string) => string; }; }, string, {}>.set: Set <"echo8">(key: "echo8", value: (str: string) => string) => void (+1 overload)

(str) =>

(parameter) str: string

str)          

(parameter) str: string

await next()          

(parameter) next: () => Promise<void>

} const mw9 =          

const mw9: () => MiddlewareHandler<{ Variables: { echo9: (str: string) => string; }; }>

(): MiddlewareHandler<{          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

Variables: {          

(property) Variables: { echo9: (str: string) => string; }

echo9:

(property) echo9: (str: string) => string

(str: string) => string          

(parameter) str: string

} }> => async (c,

(parameter) c: Context<{ Variables: { echo9: (str: string) => string; }; }, string, {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<{ Variables: { echo9: (str: string) => string; }; }, string, {}>

.set('echo9',

(property) Context<{ Variables: { echo9: (str: string) => string; }; }, string, {}>.set: Set <"echo9">(key: "echo9", value: (str: string) => string) => void (+1 overload)

(str) =>

(parameter) str: string

str)          

(parameter) str: string

await next()          

(parameter) next: () => Promise<void>

} const mw10 =          

const mw10: () => MiddlewareHandler<{ Variables: { echo10: (str: string) => string; }; }>

(): MiddlewareHandler<{          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> import MiddlewareHandler

Variables: {          

(property) Variables: { echo10: (str: string) => string; }

echo10:

(property) echo10: (str: string) => string

(str: string) => string          

(parameter) str: string

} }> => async (c,

(parameter) c: Context<{ Variables: { echo10: (str: string) => string; }; }, string, {}>

next) => {          

(parameter) next: Next

c

(parameter) c: Context<{ Variables: { echo10: (str: string) => string; }; }, string, {}>

.set('echo10',

(property) Context<{ Variables: { echo10: (str: string) => string; }; }, string, {}>.set: Set <"echo10">(key: "echo10", value: (str: string) => string) => void (+1 overload)

(str) =>

(parameter) str: string

str)          

(parameter) str: string

await next()          

(parameter) next: () => Promise<void>

} app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.use('/no-path/1')

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/no-path/1", { Bindings: { Token: string; }; }>(path: "/no-path/1", ...handlers: MiddlewareHandler<{ Bindings: { Token: string; }; }, "/no-path/1", {}>[]) => Hono<...> (+20 overloads)

.get

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <string, {}, {}, Response & TypedResponse<string, StatusCode, "text">, { Variables: { echo: (str: string) => string; }; }, { ...; } & { Variables: { echo: (str: string) => string; }; }>(handlers_0: H<...>, handlers_1: H<...>) => Hono<...> (+22 overloads)

(mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, string, {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, string, {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello'))          

(property) echo: (str: string) => string

}) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.use('/no-path/2')

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/no-path/2", { Bindings: { Token: string; }; }>(path: "/no-path/2", ...handlers: MiddlewareHandler<{ Bindings: { Token: string; }; }, "/no-path/2", {}>[]) => Hono<...> (+20 overloads)

.get

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <string, Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; } & ... 1 more ... & { ...; }>(handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>) => Hono<...> (+22 overloads)

(mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, string, {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, string, {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2'))          

(property) echo2: (str: string) => string

}) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.use('/no-path/3')

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/no-path/3", { Bindings: { Token: string; }; }>(path: "/no-path/3", ...handlers: MiddlewareHandler<{ Bindings: { Token: string; }; }, "/no-path/3", {}>[]) => Hono<...> (+20 overloads)

.get

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <string, Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; } & ... 2 more ... & { ...; }>(handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>) => Hono<...> (+22 overloads)

(mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, string, {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, string, {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3'))          

(property) echo3: (str: string) => string

}) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.use('/no-path/4')

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/no-path/4", { Bindings: { Token: string; }; }>(path: "/no-path/4", ...handlers: MiddlewareHandler<{ Bindings: { Token: string; }; }, "/no-path/4", {}>[]) => Hono<...> (+20 overloads)

.get

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <string, Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 3 more ... & { ...; }>(handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>) => Hono<...> (+22 overloads)

(mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, string, {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, string, {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4')          

(property) echo4: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.use('/no-path/5')

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/no-path/5", { Bindings: { Token: string; }; }>(path: "/no-path/5", ...handlers: MiddlewareHandler<{ Bindings: { Token: string; }; }, "/no-path/5", {}>[]) => Hono<...> (+20 overloads)

.get

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <string, Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 4 more ... & { ...; }>(handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>) => Hono<...> (+22 overloads)

(mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, string, {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, string, {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5')          

(property) echo5: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.use('/no-path/6')

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/no-path/6", { Bindings: { Token: string; }; }>(path: "/no-path/6", ...handlers: MiddlewareHandler<{ Bindings: { Token: string; }; }, "/no-path/6", {}>[]) => Hono<...> (+20 overloads)

.get

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <string, Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 5 more ... & { ...; }>(handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>) => Hono<...> (+22 overloads)

(mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, string, {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, string, {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6')          

(property) echo6: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.use('/no-path/7')

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/no-path/7", { Bindings: { Token: string; }; }>(path: "/no-path/7", ...handlers: MiddlewareHandler<{ Bindings: { Token: string; }; }, "/no-path/7", {}>[]) => Hono<...> (+20 overloads)

.get

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <string, Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 6 more ... & { ...; }>(handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>, handlers_7: H<...>) => Hono<...> (+22 overloads)

(mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6') +          

(property) echo6: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo7('hello7')          

(property) echo7: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.use('/no-path/8')

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/no-path/8", { Bindings: { Token: string; }; }>(path: "/no-path/8", ...handlers: MiddlewareHandler<{ Bindings: { Token: string; }; }, "/no-path/8", {}>[]) => Hono<...> (+20 overloads)

.get

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <string, Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 7 more ... & { ...; }>(handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>, handlers_7: H<...>, handlers_8: H<...>) => Hono<...> (+22 overloads)

(mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

mw8(),

const mw8: () => MiddlewareHandler<{ Variables: { echo8: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6') +          

(property) echo6: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo7('hello7') +          

(property) echo7: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo8('hello8')          

(property) echo8: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.use('/no-path/9')

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/no-path/9", { Bindings: { Token: string; }; }>(path: "/no-path/9", ...handlers: MiddlewareHandler<{ Bindings: { Token: string; }; }, "/no-path/9", {}>[]) => Hono<...> (+20 overloads)

.get

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <string, Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 8 more ... & { ...; }>(handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>, handlers_7: H<...>, handlers_8: H<...>, handlers_9: H<...>) => Hono<...> (+22 overloads)

(mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

mw8(),

const mw8: () => MiddlewareHandler<{ Variables: { echo8: (str: string) => string; }; }>

mw9(),

const mw9: () => MiddlewareHandler<{ Variables: { echo9: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6') +          

(property) echo6: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo7('hello7') +          

(property) echo7: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo8('hello8') +          

(property) echo8: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo9('hello9')          

(property) echo9: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.use('/no-path/10')

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.use: MiddlewareHandlerInterface <"/no-path/10", { Bindings: { Token: string; }; }>(path: "/no-path/10", ...handlers: MiddlewareHandler<{ Bindings: { Token: string; }; }, "/no-path/10", {}>[]) => Hono<...> (+20 overloads)

.get(          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <string, string, any, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo2: (str: string) => string; }; }, { Variables: { echo3: (str: string) => string; }; }, { Variables: { echo4: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 8 more ... & { ...; }>(path: string, handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>, handlers_7: H<...>, handlers_8: H<...>, handlers_9: H<...>) => Hono<...> (+22 overloads)

// @ts-expect-error The handlers are more than 10 mw(),          

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),          

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),          

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),          

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),          

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),          

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),          

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

mw8(),          

const mw8: () => MiddlewareHandler<{ Variables: { echo8: (str: string) => string; }; }>

mw9(),          

const mw9: () => MiddlewareHandler<{ Variables: { echo9: (str: string) => string; }; }>

mw10(),          

const mw10: () => MiddlewareHandler<{ Variables: { echo10: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>

.var.echo('hello') +          

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & ... 4 more ... & { echo10: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & ... 4 more ... & { echo10: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & ... 4 more ... & { echo10: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & ... 4 more ... & { echo10: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & ... 4 more ... & { echo10: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & ... 4 more ... & { echo10: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6') +          

(property) echo6: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & ... 4 more ... & { echo10: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo7('hello7') +          

(property) echo7: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & ... 4 more ... & { echo10: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo8('hello8') +          

(property) echo8: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & ... 4 more ... & { echo10: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo9('hello9') +          

(property) echo9: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo10: (str: string) => string; }; }, string, {}>.var: Readonly<ContextVariableMap & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & ... 4 more ... & { echo10: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo10('hello10')          

(property) echo10: (str: string) => string

) } ) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.get('*',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <"*", "*", HandlerResponse<any>, {}, { Variables: { echo: (str: string) => string; }; }>(path: "*", handler: H<{ Variables: { echo: (str: string) => string; }; }, "*", {}, HandlerResponse<...>>) => Hono<...> (+22 overloads)

mw())          

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.get('/path/1',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/path/1", "/path/1", Response & TypedResponse<string, StatusCode, "text">, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; } & { Variables: { echo: (str: string) => string; }; }>(path: "/path/1", handlers_0: H<...>, handlers_1: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/path/1", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/path/1", {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/path/1", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/path/1", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello'))          

(property) echo: (str: string) => string

}) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.get('/path/2',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/path/2", "/path/2", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; } & ... 1 more ... & { ...; }>(path: "/path/2", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/path/2", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/path/2", {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/path/2", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/path/2", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/path/2", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/path/2", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2'))          

(property) echo2: (str: string) => string

}) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.get('/path/3',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/path/3", "/path/3", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; } & ... 2 more ... & { ...; }>(path: "/path/3", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/path/3", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/path/3", {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/path/3", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/path/3", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/path/3", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/path/3", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/path/3", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/path/3", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3'))          

(property) echo3: (str: string) => string

}) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.get('/path/4',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/path/4", "/path/4", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 3 more ... & { ...; }>(path: "/path/4", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/path/4", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/path/4", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/path/4", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/path/4", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/path/4", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/path/4", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/path/4", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/path/4", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/path/4", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/path/4", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4')          

(property) echo4: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.get('/path/5',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/path/5", "/path/5", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 4 more ... & { ...; }>(path: "/path/5", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/path/5", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/path/5", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/path/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/path/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/path/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/path/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/path/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/path/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/path/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/path/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/path/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/path/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5')          

(property) echo5: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.get('/path/6',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/path/6", "/path/6", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 5 more ... & { ...; }>(path: "/path/6", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/path/6", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/path/6", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/path/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/path/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/path/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/path/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/path/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/path/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/path/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/path/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/path/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/path/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/path/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/path/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6')          

(property) echo6: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.get('/path/7',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/path/7", "/path/7", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 6 more ... & { ...; }>(path: "/path/7", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>, handlers_7: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6') +          

(property) echo6: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/path/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo7('hello7')          

(property) echo7: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.get('/path/8',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/path/8", "/path/8", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 7 more ... & { ...; }>(path: "/path/8", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>, handlers_7: H<...>, handlers_8: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

mw8(),

const mw8: () => MiddlewareHandler<{ Variables: { echo8: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6') +          

(property) echo6: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo7('hello7') +          

(property) echo7: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/path/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo8('hello8')          

(property) echo8: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.get('/path/9',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/path/9", "/path/9", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 8 more ... & { ...; }>(path: "/path/9", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>, handlers_7: H<...>, handlers_8: H<...>, handlers_9: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

mw8(),

const mw8: () => MiddlewareHandler<{ Variables: { echo8: (str: string) => string; }; }>

mw9(),

const mw9: () => MiddlewareHandler<{ Variables: { echo9: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6') +          

(property) echo6: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo7('hello7') +          

(property) echo7: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo8('hello8') +          

(property) echo8: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/path/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo9('hello9')          

(property) echo9: (str: string) => string

) }) // @ts-expect-error app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.get('/path/10',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <string, {}, HandlerResponse<any>>(...handlers: H<{ Bindings: { Token: string; }; }, string, {}, HandlerResponse<any>>[]) => Hono<{ Bindings: { Token: string; }; }, { ...; }, "/"> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

mw8(),

const mw8: () => MiddlewareHandler<{ Variables: { echo8: (str: string) => string; }; }>

mw9(),

const mw9: () => MiddlewareHandler<{ Variables: { echo9: (str: string) => string; }; }>

mw10(),

const mw10: () => MiddlewareHandler<{ Variables: { echo10: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; }, string, {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; }, string, {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <any, StatusCode>(text: any, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<any, StatusCode, "text"> (+1 overload)

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, string, {}>

.var.echo('hello') +          

(property) Context<{ Bindings: { Token: string; }; }, string, {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, string, {}>

.var.echo2('hello2') +          

(property) Context<{ Bindings: { Token: string; }; }, string, {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, string, {}>

.var.echo3('hello3') +          

(property) Context<{ Bindings: { Token: string; }; }, string, {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, string, {}>

.var.echo4('hello4') +          

(property) Context<{ Bindings: { Token: string; }; }, string, {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, string, {}>

.var.echo5('hello5') +          

(property) Context<{ Bindings: { Token: string; }; }, string, {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, string, {}>

.var.echo6('hello6') +          

(property) Context<{ Bindings: { Token: string; }; }, string, {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, string, {}>

.var.echo7('hello7') +          

(property) Context<{ Bindings: { Token: string; }; }, string, {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, string, {}>

.var.echo8('hello8') +          

(property) Context<{ Bindings: { Token: string; }; }, string, {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, string, {}>

.var.echo9('hello9') +          

(property) Context<{ Bindings: { Token: string; }; }, string, {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, string, {}>

.var.echo10('hello10')          

(property) Context<{ Bindings: { Token: string; }; }, string, {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on('GET', '/on/1',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <"GET", "/on/1", "/on/1", Response & TypedResponse<string, StatusCode, "text">, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; } & { Variables: { echo: (str: string) => string; }; }>(method: "GET", path: "/on/1", handlers_0: H<...>, handlers_1: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/on/1", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/on/1", {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/on/1", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/on/1", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello'))          

(property) echo: (str: string) => string

}) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on('GET', '/on/2',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <"GET", "/on/2", "/on/2", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; } & ... 1 more ... & { ...; }>(method: "GET", path: "/on/2", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/on/2", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/on/2", {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/on/2", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/on/2", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/on/2", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/on/2", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2'))          

(property) echo2: (str: string) => string

}) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on('GET', '/on/3',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <"GET", "/on/3", "/on/3", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; } & ... 2 more ... & { ...; }>(method: "GET", path: "/on/3", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3'))          

(property) echo3: (str: string) => string

}) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on('GET', '/on/4',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <"GET", "/on/4", "/on/4", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 3 more ... & { ...; }>(method: "GET", path: "/on/4", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4')          

(property) echo4: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on('GET', '/on/5',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <"GET", "/on/5", "/on/5", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 4 more ... & { ...; }>(method: "GET", path: "/on/5", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5')          

(property) echo5: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on('GET', '/on/6',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <"GET", "/on/6", "/on/6", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 5 more ... & { ...; }>(method: "GET", path: "/on/6", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6')          

(property) echo6: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on('GET', '/on/7',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <"GET", "/on/7", "/on/7", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 6 more ... & { ...; }>(method: "GET", path: "/on/7", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>, handlers_7: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6') +          

(property) echo6: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo7('hello7')          

(property) echo7: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on('GET', '/on/8',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <"GET", "/on/8", "/on/8", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 7 more ... & { ...; }>(method: "GET", path: "/on/8", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>, handlers_7: H<...>, handlers_8: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

mw8(),

const mw8: () => MiddlewareHandler<{ Variables: { echo8: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6') +          

(property) echo6: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo7('hello7') +          

(property) echo7: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo8('hello8')          

(property) echo8: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on('GET', '/on/9',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <"GET", "/on/9", "/on/9", {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { Variables: { echo2: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 8 more ... & { ...; }>(method: "GET", path: "/on/9", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>, handlers_7: H<...>, handlers_8: H<...>, handlers_9: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

mw8(),

const mw8: () => MiddlewareHandler<{ Variables: { echo8: (str: string) => string; }; }>

mw9(),

const mw9: () => MiddlewareHandler<{ Variables: { echo9: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6') +          

(property) echo6: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo7('hello7') +          

(property) echo7: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo8('hello8') +          

(property) echo8: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo9('hello9')          

(property) echo9: (str: string) => string

) }) // @ts-expect-error app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on(          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <"GET", "/on/10", HandlerResponse<any>, {}>(method: "GET", path: "/on/10", ...handlers: H<{ Bindings: { Token: string; }; }, "/on/10", {}, HandlerResponse<any>>[]) => Hono<...> (+22 overloads)

'GET', '/on/10', mw(),          

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),          

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),          

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),          

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),          

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),          

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),          

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

mw8(),          

const mw8: () => MiddlewareHandler<{ Variables: { echo8: (str: string) => string; }; }>

mw9(),          

const mw9: () => MiddlewareHandler<{ Variables: { echo9: (str: string) => string; }; }>

mw10(),          

const mw10: () => MiddlewareHandler<{ Variables: { echo10: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <any, StatusCode>(text: any, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<any, StatusCode, "text"> (+1 overload)

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo('hello') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo2('hello2') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo3('hello3') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo4('hello4') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo5('hello5') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo6('hello6') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo7('hello7') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo8('hello8') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo9('hello9') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo10('hello10')          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

) } ) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on(['GET', 'POST'], '/on/1',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <string[], "/on/1", "/on/1", Response & TypedResponse<string, StatusCode, "text">, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; } & { Variables: { echo: (str: string) => string; }; }>(methods: string[], path: "/on/1", handlers_0: H<...>, handlers_1: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/on/1", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/on/1", {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/on/1", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/on/1", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello'))          

(property) echo: (str: string) => string

}) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on(['GET', 'POST'], '/on/2',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <string[], "/on/2", "/on/2", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; } & ... 1 more ... & { ...; }>(methods: string[], path: "/on/2", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/on/2", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/on/2", {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/on/2", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/on/2", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/on/2", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; }, "/on/2", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2'))          

(property) echo2: (str: string) => string

}) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on(['GET', 'POST'], '/on/3',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <string[], "/on/3", "/on/3", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; } & ... 2 more ... & { ...; }>(methods: string[], path: "/on/3", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; }, "/on/3", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3'))          

(property) echo3: (str: string) => string

}) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on(['GET', 'POST'], '/on/4',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <string[], "/on/4", "/on/4", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 3 more ... & { ...; }>(methods: string[], path: "/on/4", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; }, "/on/4", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4')          

(property) echo4: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on(['GET', 'POST'], '/on/5',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <string[], "/on/5", "/on/5", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 4 more ... & { ...; }>(methods: string[], path: "/on/5", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; }, "/on/5", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5')          

(property) echo5: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on(['GET', 'POST'], '/on/6',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <string[], "/on/6", "/on/6", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 5 more ... & { ...; }>(methods: string[], path: "/on/6", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & { Variables: { echo3: (str: string) => string; }; } & { Variables: { echo4: (str: string) => string; }; } & { Variables: { echo5: (str: string) => string; }; } & { Variables: { echo6: (str: string) => string; }; }, "/on/6", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6')          

(property) echo6: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on(['GET', 'POST'], '/on/7',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <string[], "/on/7", "/on/7", Response & TypedResponse<string, StatusCode, "text">, {}, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 6 more ... & { ...; }>(methods: string[], path: "/on/7", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>, handlers_7: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6') +          

(property) echo6: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 4 more ... & { Variables: { echo7: (str: string) => string; }; }, "/on/7", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo7('hello7')          

(property) echo7: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on(['GET', 'POST'], '/on/8',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <string[], "/on/8", "/on/8", {}, {}, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { Variables: { echo2: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 7 more ... & { ...; }>(methods: string[], path: "/on/8", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>, handlers_7: H<...>, handlers_8: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

mw8(),

const mw8: () => MiddlewareHandler<{ Variables: { echo8: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6') +          

(property) echo6: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo7('hello7') +          

(property) echo7: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 5 more ... & { Variables: { echo8: (str: string) => string; }; }, "/on/8", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & { echo5: (str: string) => string; } & { echo6: (str: string) => string; } & { echo7: (str: string) => string; } & { echo8: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo8('hello8')          

(property) echo8: (str: string) => string

) }) app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on(          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <string[], "/on/9", "/on/9", {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { Variables: { echo2: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; }, { ...; } & ... 8 more ... & { ...; }>(methods: string[], path: "/on/9", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>, handlers_5: H<...>, handlers_6: H<...>, handlers_7: H<...>, handlers_8: H<...>, handlers_9: H<...>) => Hono<...> (+22 overloads)

['GET', 'POST'], '/on/9', mw(),          

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),          

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),          

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),          

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),          

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),          

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),          

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

mw8(),          

const mw8: () => MiddlewareHandler<{ Variables: { echo8: (str: string) => string; }; }>

mw9(),          

const mw9: () => MiddlewareHandler<{ Variables: { echo9: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello') +          

(property) echo: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo2('hello2') +          

(property) echo2: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo3('hello3') +          

(property) echo3: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo4('hello4') +          

(property) echo4: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo5('hello5') +          

(property) echo5: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo6('hello6') +          

(property) echo6: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo7('hello7') +          

(property) echo7: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo8('hello8') +          

(property) echo8: (str: string) => string

c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; } & { Variables: { echo2: (str: string) => string; }; } & ... 6 more ... & { Variables: { echo9: (str: string) => string; }; }, "/on/9", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; } & { echo2: (str: string) => string; } & { echo3: (str: string) => string; } & { echo4: (str: string) => string; } & ... 4 more ... & { echo9: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo9('hello9')          

(property) echo9: (str: string) => string

) } ) // @ts-expect-error app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.on(          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.on: OnHandlerInterface <string, "/on/10", HandlerResponse<any>, {}>(method: string, path: "/on/10", ...handlers: H<{ Bindings: { Token: string; }; }, "/on/10", {}, HandlerResponse<any>>[]) => Hono<...> (+22 overloads)

['GET', 'POST'], '/on/10', mw(),          

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),          

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),          

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),          

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5(),          

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

mw6(),          

const mw6: () => MiddlewareHandler<{ Variables: { echo6: (str: string) => string; }; }>

mw7(),          

const mw7: () => MiddlewareHandler<{ Variables: { echo7: (str: string) => string; }; }>

mw8(),          

const mw8: () => MiddlewareHandler<{ Variables: { echo8: (str: string) => string; }; }>

mw9(),          

const mw9: () => MiddlewareHandler<{ Variables: { echo9: (str: string) => string; }; }>

mw10(),          

const mw10: () => MiddlewareHandler<{ Variables: { echo10: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

return c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.text(          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <any, StatusCode>(text: any, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<any, StatusCode, "text"> (+1 overload)

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo('hello') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo2('hello2') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo3('hello3') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo4('hello4') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo5('hello5') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo6('hello6') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo7('hello7') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo8('hello8') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo9('hello9') +          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; }, "/on/10", {}>

.var.echo10('hello10')          

(property) Context<{ Bindings: { Token: string; }; }, "/on/10", {}>.var: Readonly<ContextVariableMap> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

) } ) it('Should return the correct response - no-path', async () => { let res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/no-path/1')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/no-path/2')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hellohello2')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/no-path/3')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hellohello2hello3')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/no-path/4')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hellohello2hello3hello4')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/no-path/5')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hellohello2hello3hello4hello5')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return the correct response - path', async () => { let res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/path/1')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/path/2')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hellohello2')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/path/3')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hellohello2hello3')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/path/4')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hellohello2hello3hello4')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/path/5')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hellohello2hello3hello4hello5')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should return the correct response - on', async () => { let res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/on/1')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hello')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/on/2')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hellohello2')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/on/3')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hellohello2hello3')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/on/4')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hellohello2hello3hello4')          

(method) Body.text(): Promise<string> MDN Reference

res = await

let res: Response

app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.request('/on/5')          

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: {} | { Token: string; } | undefined, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

let res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

expect(await res

let res: Response

.text()).toBe('hellohello2hello3hello4hello5')          

(method) Body.text(): Promise<string> MDN Reference

}) it('Should not throw type errors', () => { const app = new

const app: Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">

Hono<{          

(alias) new Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">(options?: HonoOptions<{ Variables: { hello: () => string; }; }>): Hono<...> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

Variables: {          

(property) Variables: { hello: () => string; }

hello: () => string          

(property) hello: () => string

} }>() app

const app: Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">

.get

(property) Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">.get: HandlerInterface <string, {}, HandlerResponse<any>, { Variables: { echo: (str: string) => string; }; }>(handler: H<{ Variables: { echo: (str: string) => string; }; }, string, {}, HandlerResponse<...>>) => Hono<...> (+22 overloads)

(mw())          

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

app

const app: Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">

.get

(property) Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">.get: HandlerInterface <string, {}, {}, HandlerResponse<any>, { Variables: { echo: (str: string) => string; }; }, { Variables: { echo2: (str: string) => string; }; }>(handlers_0: H<...>, handlers_1: H<...>) => Hono<...> (+22 overloads)

(mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2())          

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

app

const app: Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">

.get

(property) Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">.get: HandlerInterface <string, HandlerResponse<any>, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { Variables: { echo2: (str: string) => string; }; }, { ...; }>(handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>) => Hono<...> (+22 overloads)

(mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3())          

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

app

const app: Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">

.get

(property) Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">.get: HandlerInterface <string, HandlerResponse<any>, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { Variables: { echo2: (str: string) => string; }; }, { ...; }, { ...; }>(handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>) => Hono<...> (+22 overloads)

(mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4())          

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

app

const app: Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">

.get

(property) Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">.get: HandlerInterface <string, HandlerResponse<any>, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { Variables: { echo2: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }>(handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>) => Hono<...> (+22 overloads)

(mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5())          

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

app

const app: Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">

.get('/',

(property) Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">.get: HandlerInterface <"/", "/", HandlerResponse<any>, {}, { Variables: { echo: (str: string) => string; }; }>(path: "/", handler: H<{ Variables: { echo: (str: string) => string; }; }, "/", {}, HandlerResponse<...>>) => Hono<...> (+22 overloads)

mw())          

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

app

const app: Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">

.get('/',

(property) Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">.get: HandlerInterface <"/", "/", HandlerResponse<any>, {}, {}, { Variables: { echo: (str: string) => string; }; }, { Variables: { echo2: (str: string) => string; }; }>(path: "/", handlers_0: H<...>, handlers_1: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2())          

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

app

const app: Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">

.get('/',

(property) Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">.get: HandlerInterface <"/", "/", HandlerResponse<any>, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { Variables: { echo2: (str: string) => string; }; }, { ...; }>(path: "/", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3())          

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

app

const app: Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">

.get('/',

(property) Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">.get: HandlerInterface <"/", "/", HandlerResponse<any>, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { Variables: { echo2: (str: string) => string; }; }, { ...; }, { ...; }>(path: "/", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4())          

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

app

const app: Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">

.get('/',

(property) Hono<{ Variables: { hello: () => string; }; }, BlankSchema, "/">.get: HandlerInterface <"/", "/", HandlerResponse<any>, {}, {}, {}, {}, {}, { Variables: { echo: (str: string) => string; }; }, { Variables: { echo2: (str: string) => string; }; }, { ...; }, { ...; }, { ...; }>(path: "/", handlers_0: H<...>, handlers_1: H<...>, handlers_2: H<...>, handlers_3: H<...>, handlers_4: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

mw2(),

const mw2: () => MiddlewareHandler<{ Variables: { echo2: (str: string) => string; }; }>

mw3(),

const mw3: () => MiddlewareHandler<{ Variables: { echo3: (str: string) => string; }; }>

mw4(),

const mw4: () => MiddlewareHandler<{ Variables: { echo4: (str: string) => string; }; }>

mw5())          

const mw5: () => MiddlewareHandler<{ Variables: { echo5: (str: string) => string; }; }>

}) it('Should be a read-only', () => { expect(() => { app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.get('/path/1',

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/path/1", "/path/1", Response & TypedResponse<string, StatusCode, "text">, {}, {}, { Variables: { echo: (str: string) => string; }; }, { ...; } & { Variables: { echo: (str: string) => string; }; }>(path: "/path/1", handlers_0: H<...>, handlers_1: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

(c) => {          

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/path/1", {}>

// @ts-expect-error c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/path/1", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/path/1", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo = 'hello'          

(property) echo: any

return c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/path/1", {}>

.text

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <string, StatusCode>(text: string, status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<string, StatusCode, "text"> (+1 overload)

(c

(parameter) c: Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/path/1", {}>

.var

(property) Context<{ Bindings: { Token: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/path/1", {}>.var: Readonly<ContextVariableMap & { echo: (str: string) => string; }> .var can access the value of a variable.

@see — https://hono.dev/docs/api/context#var

@example
ts const result = c.var.client.oneMethod()

.echo('hello'))          

(property) echo: (str: string) => string

}) }).toThrow() }) it('Should not throw a type error', (c) => {          

(parameter) c: any

const app = new

const app: Hono<{ Bindings: { TOKEN: string; }; }, BlankSchema, "/">

Hono<{          

(alias) new Hono<{ Bindings: { TOKEN: string; }; }, BlankSchema, "/">(options?: HonoOptions<{ Bindings: { TOKEN: string; }; }>): Hono<{ Bindings: { TOKEN: string; }; }, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

Bindings: {          

(property) Bindings: { TOKEN: string; }

TOKEN: string          

(property) TOKEN: string

} }>() app

const app: Hono<{ Bindings: { TOKEN: string; }; }, BlankSchema, "/">

.get('/',

(property) Hono<{ Bindings: { TOKEN: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/", "/", HandlerResponse<any>, {}, {}, any, { Bindings: { TOKEN: string; }; }>(path: "/", handlers_0: H<any, "/", {}, any>, handlers_1: H<{ Bindings: { TOKEN: string; }; }, "/", {}, HandlerResponse<...>>) => Hono<...> (+22 overloads)

poweredBy(), async

(alias) poweredBy(): MiddlewareHandler import poweredBy

(c) => {          

(parameter) c: Context<{ Bindings: { TOKEN: string; }; }, "/", {}>

expectTypeOf(c

(parameter) c: Context<{ Bindings: { TOKEN: string; }; }, "/", {}>

.env

(property) Context<{ Bindings: { TOKEN: string; }; }, "/", {}>.env: { TOKEN: string; } .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

.TOKEN).toEqualTypeOf()          

(property) TOKEN: string

}) app

const app: Hono<{ Bindings: { TOKEN: string; }; }, BlankSchema, "/">

.get('/', async

(property) Hono<{ Bindings: { TOKEN: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/", "/", HandlerResponse<any>, BlankInput, { Bindings: { TOKEN: string; }; }>(path: "/", handler: H<{ Bindings: { TOKEN: string; }; }, "/", BlankInput, HandlerResponse<...>>) => Hono<...> (+22 overloads)

(c,

(parameter) c: Context<{ Bindings: { TOKEN: string; }; }, "/", BlankInput>

next) => {          

(parameter) next: Next

expectTypeOf(c

(parameter) c: Context<{ Bindings: { TOKEN: string; }; }, "/", BlankInput>

.env

(property) Context<{ Bindings: { TOKEN: string; }; }, "/", BlankInput>.env: { TOKEN: string; } .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

.TOKEN).toEqualTypeOf()          

(property) TOKEN: string

const mw =

const mw: MiddlewareHandler

poweredBy()          

(alias) poweredBy(): MiddlewareHandler import poweredBy

await mw

const mw: (c: Context<any, string, {}>, next: Next) => Promise<Response | void>

(c,

(parameter) c: Context<{ Bindings: { TOKEN: string; }; }, "/", BlankInput>

next)          

(parameter) next: Next

}) app

const app: Hono<{ Bindings: { TOKEN: string; }; }, BlankSchema, "/">

.use

(property) Hono<{ Bindings: { TOKEN: string; }; }, BlankSchema, "/">.use: MiddlewareHandlerInterface <{ Variables: { echo: (str: string) => string; }; }>(...handlers: MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }, never, {}>[]) => Hono<...> (+20 overloads)

(mw())          

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

app

const app: Hono<{ Bindings: { TOKEN: string; }; }, BlankSchema, "/">

.use('*',

(property) Hono<{ Bindings: { TOKEN: string; }; }, BlankSchema, "/">.use: MiddlewareHandlerInterface <"*", "*", { Variables: { echo: (str: string) => string; }; }>(path: "*", handler: MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }, "*", {}>) => Hono<...> (+20 overloads)

mw())          

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

const route =

const route: Hono<{ Bindings: { TOKEN: string; }; }, { "/posts": { $get: { input: {}; output: 0; outputFormat: "json"; status: StatusCode; }; }; }, "/">

app

const app: Hono<{ Bindings: { TOKEN: string; }; }, BlankSchema, "/">

.get('/posts',

(property) Hono<{ Bindings: { TOKEN: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/posts", "/posts", JSONRespondReturn<0, StatusCode>, {}, {}, { Variables: { echo: (str: string) => string; }; }, { Bindings: { TOKEN: string; }; } & { Variables: { echo: (str: string) => string; }; }>(path: "/posts", handlers_0: H<...>, handlers_1: H<...>) => Hono<...> (+22 overloads)

mw(),

const mw: () => MiddlewareHandler<{ Variables: { echo: (str: string) => string; }; }>

(c) =>

(parameter) c: Context<{ Bindings: { TOKEN: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/posts", {}>

c

(parameter) c: Context<{ Bindings: { TOKEN: string; }; } & { Variables: { echo: (str: string) => string; }; }, "/posts", {}>

.json(0))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.json: JSONRespond <0, StatusCode>(object: 0, status?: StatusCode | undefined, headers?: HeaderRecord) => JSONRespondReturn<0, StatusCode> (+1 overload)

const client =

const client: { posts: ClientRequest<{ $get: { input: {}; output: 0; outputFormat: "json"; status: StatusCode; }; }>; }

hc

(alias) hc<Hono<{ Bindings: { TOKEN: string; }; }, { "/posts": { $get: { input: {}; output: 0; outputFormat: "json"; status: StatusCode; }; }; }, "/">>(baseUrl: string, options?: ClientRequestOptions): { ...; } import hc

route>('/')          

const route: Hono<{ Bindings: { TOKEN: string; }; }, { "/posts": { $get: { input: {}; output: 0; outputFormat: "json"; status: StatusCode; }; }; }, "/">

type key = keyof typeof

type key = "posts"

client          

const client: { posts: ClientRequest<{ $get: { input: {}; output: 0; outputFormat: "json"; status: StatusCode; }; }>; }

type verify =

type verify = true

Expect

(alias) type Expect<T extends true> = T import Expect

@module — Types utility.

<Equal<'posts',

(alias) type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false import Equal

key>>          

type key = "posts"

}) it('Should throw type errors', (c) => {          

(parameter) c: any

try { // @ts-expect-error app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.get(['foo', 'bar'],

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.get: HandlerInterface <string, BlankInput, {}, HandlerResponse<any>, { Bindings: { Token: string; }; }, any>(handlers_0: H<{ Bindings: { Token: string; }; }, string, BlankInput, any>, handlers_1: H<...>) => Hono<...> (+22 overloads)

poweredBy())          

(alias) poweredBy(): MiddlewareHandler import poweredBy

// @ts-expect-error app

const app: Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">

.use(['foo', 'bar'],

(property) Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/">.use: MiddlewareHandlerInterface <any>(...handlers: MiddlewareHandler<any, never, {}>[]) => Hono<{ Bindings: { Token: string; }; }, BlankSchema, "/"> (+20 overloads)

poweredBy())          

(alias) poweredBy(): MiddlewareHandler import poweredBy

} catch {} }) }) describe('Compatible with extended Hono classes, such Zod OpenAPI Hono.', () => { class ExtendedHono extends

class ExtendedHono

Hono {          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

// @ts-ignore route

(method) ExtendedHono.route(path: string, app?: Hono): this .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

(path: string,

(parameter) path: string

app?:

(parameter) app: Hono<BlankEnv, BlankSchema, "/"> | undefined

Hono) {          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> import Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

// @ts-ignore super.route

(method) Hono<BlankEnv, BlankSchema, "/">.route<string, BlankEnv, BlankSchema, "/">(path: string, app: Hono<BlankEnv, BlankSchema, "/">): Hono<BlankEnv, {}, "/"> .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

(path,

(parameter) path: string

app)          

(parameter) app: Hono<BlankEnv, BlankSchema, "/"> | undefined

return this } // @ts-ignore basePath

(method) ExtendedHono.basePath(path: string): ExtendedHono .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

(path: string) {          

(parameter) path: string

return new ExtendedHono(super

constructor ExtendedHono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): ExtendedHono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

.basePath

(method) Hono<BlankEnv, BlankSchema, "/">.basePath<string>(path: string): Hono<BlankEnv, BlankSchema, string> .basePath() allows base paths to be specified.

@see — https://hono.dev/docs/api/routing#base-path

@param path — base Path

@returns — changed Hono instance

@example
ts const api = new Hono().basePath('/api')

(path))          

(parameter) path: string

} } const a = new

const a: ExtendedHono

ExtendedHono()          

constructor ExtendedHono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): ExtendedHono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

const sub = new

const sub: Hono<BlankEnv, BlankSchema, "/">

Hono()          

(alias) new Hono<BlankEnv, BlankSchema, "/">(options?: HonoOptions<BlankEnv>): Hono<BlankEnv, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

sub

const sub: Hono<BlankEnv, BlankSchema, "/">

.get('/foo',

(property) Hono<BlankEnv, BlankSchema, "/">.get: HandlerInterface <"/foo", "/foo", Response & TypedResponse<"foo", StatusCode, "text">, BlankInput, BlankEnv>(path: "/foo", handler: H<BlankEnv, "/foo", BlankInput, Response & TypedResponse<...>>) => Hono<...> (+22 overloads)

(c) =>

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

c

(parameter) c: Context<BlankEnv, "/foo", BlankInput>

.text('foo'))          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"foo", StatusCode>(text: "foo", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"foo", StatusCode, "text"> (+1 overload)

a

const a: ExtendedHono

.route('/sub',

(method) ExtendedHono.route(path: string, app?: Hono): ExtendedHono .route() allows grouping other Hono instance in routes.

@see — https://hono.dev/docs/api/routing#grouping

@param path — base Path

@param app — other Hono instance

@returns — routed Hono instance

@example
```ts const app = new Hono() const app2 = new Hono()

app2.get("/user", (c) => c.text("user")) app.route("/api", app2) // GET /api/user ```

sub)          

const sub: Hono<BlankEnv, BlankSchema, "/">

it('Should return 200 response', async () => { const res = await

const res: Response

a

const a: ExtendedHono

.request('/sub/foo')          

(property) Hono<BlankEnv, BlankSchema, "/">.request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: unknown, executionCtx?: ExecutionContext) => Response | Promise<Response> .request() is a useful method for testing. You can pass a URL or pathname to send a GET request. app will return a Response object. ts test('GET /hello is ok', async () => { const res = await app.request('/hello') expect(res.status).toBe(200) })

@see — https://hono.dev/docs/api/hono#request

expect(res

const res: Response

.status).toBe(200)          

(property) Response.status: number MDN Reference

}) }) describe('Generics for Bindings and Variables', () => { interface CloudflareBindings {          

interface CloudflareBindings

MY_VARIABLE: string          

(property) CloudflareBindings.MY_VARIABLE: string

} it('Should not throw type errors', () => { // @ts-expect-error Bindings should extend object new Hono<{          

(alias) new Hono<{ Bindings: number; }, BlankSchema, "/">(options?: HonoOptions<{ Bindings: number; }>): Hono<{ Bindings: number; }, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

Bindings: number          

(property) Bindings: number

}>() const appWithInterface = new

const appWithInterface: Hono<{ Bindings: CloudflareBindings; }, BlankSchema, "/">

Hono<{          

(alias) new Hono<{ Bindings: CloudflareBindings; }, BlankSchema, "/">(options?: HonoOptions<{ Bindings: CloudflareBindings; }>): Hono<...> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

Bindings:

(property) Bindings: CloudflareBindings

CloudflareBindings          

interface CloudflareBindings

}>() appWithInterface

const appWithInterface: Hono<{ Bindings: CloudflareBindings; }, BlankSchema, "/">

.get('/',

(property) Hono<{ Bindings: CloudflareBindings; }, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"/", StatusCode, "text">, BlankInput, { Bindings: CloudflareBindings; }>(path: "/", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<{ Bindings: CloudflareBindings; }, "/", BlankInput>

expectTypeOf(c

(parameter) c: Context<{ Bindings: CloudflareBindings; }, "/", BlankInput>

.env

(property) Context<{ Bindings: CloudflareBindings; }, "/", BlankInput>.env: CloudflareBindings .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

.MY_VARIABLE).toMatchTypeOf()          

(property) CloudflareBindings.MY_VARIABLE: string

return c

(parameter) c: Context<{ Bindings: CloudflareBindings; }, "/", BlankInput>

.text('/')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"/", StatusCode>(text: "/", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<"/", StatusCode, "text"> (+1 overload)

}) const appWithType = new

const appWithType: Hono<{ Bindings: { foo: string; }; }, BlankSchema, "/">

Hono<{          

(alias) new Hono<{ Bindings: { foo: string; }; }, BlankSchema, "/">(options?: HonoOptions<{ Bindings: { foo: string; }; }>): Hono<{ Bindings: { foo: string; }; }, BlankSchema, "/"> import Hono Creates an instance of the Hono class.

@param options — Optional configuration options for the Hono instance.

Bindings: {          

(property) Bindings: { foo: string; }

foo: string          

(property) foo: string

} }>() appWithType

const appWithType: Hono<{ Bindings: { foo: string; }; }, BlankSchema, "/">

.get('/',

(property) Hono<{ Bindings: { foo: string; }; }, BlankSchema, "/">.get: HandlerInterface <"/", "/", Response & TypedResponse<"Hello Hono!", StatusCode, "text">, BlankInput, { Bindings: { foo: string; }; }>(path: "/", handler: H<...>) => Hono<...> (+22 overloads)

(c) => {          

(parameter) c: Context<{ Bindings: { foo: string; }; }, "/", BlankInput>

expectTypeOf(c

(parameter) c: Context<{ Bindings: { foo: string; }; }, "/", BlankInput>

.env

(property) Context<{ Bindings: { foo: string; }; }, "/", BlankInput>.env: { foo: string; } .env can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.

@see — https://hono.dev/docs/api/context#env

@example
ts // Environment object for Cloudflare Workers app.get('*', async c => { const counter = c.env.COUNTER })

.foo).toMatchTypeOf()          

(property) foo: string

return c

(parameter) c: Context<{ Bindings: { foo: string; }; }, "/", BlankInput>

.text('Hello Hono!')          

(property) Context<E extends Env = any, P extends string = any, I extends Input = {}>.text: TextRespond <"Hello Hono!", StatusCode>(text: "Hello Hono!", status?: StatusCode | undefined, headers?: HeaderRecord) => Response & TypedResponse<...> (+1 overload)

}) }) })
src/hono.ts
            
                import { HonoBase } from './hono-base'
                import type { HonoOptions } from './hono-base'
                import { RegExpRouter } from './router/reg-exp-router'
                import { SmartRouter } from './router/smart-router'
                import { TrieRouter } from './router/trie-router'
                import type { BlankEnv, BlankSchema, Env, Schema } from './types'
                
                /**
                 * The Hono class extends the functionality of the HonoBase class.
                 * It sets up routing and allows for custom options to be passed.
                 *
                 * @template E - The environment type.
                 * @template S - The schema type.
                 * @template BasePath - The base path type.
                 */
                export class Hono<          

class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

E extends

(type parameter) E in Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> - The environment type.

@template E — The environment type.

Env =

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } import Env

BlankEnv,          

(alias) type BlankEnv = {} import BlankEnv

S extends

(type parameter) S in Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> - The schema type.

@template S — The schema type.

Schema =

(alias) type Schema = { [Path: string]: { [Method: `$${Lowercase<string>}`]: Endpoint; }; } import Schema

BlankSchema,          

(alias) type BlankSchema = {} import BlankSchema

BasePath extends string = '/'          

(type parameter) BasePath in Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> - The base path type.

@template BasePath — The base path type.

> extends HonoBase

(alias) class HonoBase<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/"> import HonoBase

<E,

(type parameter) E in Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> - The environment type.

@template E — The environment type.

S,

(type parameter) S in Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> - The schema type.

@template S — The schema type.

BasePath> {          

(type parameter) BasePath in Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> - The base path type.

@template BasePath — The base path type.

/** * Creates an instance of the Hono class. * * @param options - Optional configuration options for the Hono instance. */ constructor(options:

(parameter) options: HonoOptions<E> - Optional configuration options for the Hono instance.

@param options — Optional configuration options for the Hono instance.

HonoOptions

(alias) type HonoOptions<E extends Env> = { strict?: boolean; router?: Router<[H, RouterRoute]>; getPath?: GetPath<E>; } import HonoOptions

<E> = {}) {          

(type parameter) E in Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> - The environment type.

@template E — The environment type.

super(options)          

(parameter) options: HonoOptions<E> - Optional configuration options for the Hono instance.

@param options — Optional configuration options for the Hono instance.

this.router =          

(property) Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">.router: Router<[H, RouterRoute]>

options

(parameter) options: HonoOptions<E> - Optional configuration options for the Hono instance.

@param options — Optional configuration options for the Hono instance.

.router ??          

(property) router?: Router<[H, RouterRoute]> | undefined router option specifices which router to use.

@see — https://hono.dev/docs/api/hono#router-option

@example
ts const app = new Hono({ router: new RegExpRouter() })

new SmartRouter({          

(alias) new SmartRouter<[H, RouterRoute]>(init: Pick<SmartRouter<[H, RouterRoute]>, "routers">): SmartRouter<[H, RouterRoute]> import SmartRouter

routers: [new

(property) routers: Router<[H, RouterRoute]>[]

RegExpRouter(), new

(alias) new RegExpRouter<[H, RouterRoute]>(): RegExpRouter<[H, RouterRoute]> import RegExpRouter

TrieRouter()],          

(alias) new TrieRouter<[H, RouterRoute]>(): TrieRouter<[H, RouterRoute]> import TrieRouter

}) } }
src/http-exception.test.ts
            
                import { HTTPException } from './http-exception'
                
                describe('HTTPException', () => {
                  it('Should be 401 HTTP exception object', async () => {
                    // We should throw an exception if is not authorized
                    // because next handlers should not be fired.
                    const exception = new

const exception: HTTPException

HTTPException(401, {          

(alias) new HTTPException(status?: StatusCode, options?: HTTPExceptionOptions): HTTPException import HTTPException Creates an instance of HTTPException.

@param status — HTTP status code for the exception. Defaults to 500.

@param options — Additional options for the exception.

message: 'Unauthorized',          

(property) message?: string | undefined

}) const res =

const res: Response

exception

const exception: HTTPException

.getResponse()          

(method) HTTPException.getResponse(): Response Returns the response object associated with the exception. If a response object is not provided, a new response is created with the error message and status code.

@returns — The response object.

expect(res

const res: Response

.status).toBe(401)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Unauthorized')          

(method) Body.text(): Promise<string> MDN Reference

expect(exception

const exception: HTTPException

.status).toBe(401)          

(property) HTTPException.status: StatusCode

expect(exception

const exception: HTTPException

.message).toBe('Unauthorized')          

(property) Error.message: string

}) it('Should be accessible to the object causing the exception', async () => { // We should pass the cause of the error to the cause option // because it makes debugging easier. const error = new

const error: Error

Error('Server Error')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

const exception = new

const exception: HTTPException

HTTPException(500, {          

(alias) new HTTPException(status?: StatusCode, options?: HTTPExceptionOptions): HTTPException import HTTPException Creates an instance of HTTPException.

@param status — HTTP status code for the exception. Defaults to 500.

@param options — Additional options for the exception.

message: 'Internal Server Error',          

(property) message?: string | undefined

cause:

(property) cause?: unknown

error,          

const error: Error

}) const res =

const res: Response

exception

const exception: HTTPException

.getResponse()          

(method) HTTPException.getResponse(): Response Returns the response object associated with the exception. If a response object is not provided, a new response is created with the error message and status code.

@returns — The response object.

expect(res

const res: Response

.status).toBe(500)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('Internal Server Error')          

(method) Body.text(): Promise<string> MDN Reference

expect(exception

const exception: HTTPException

.status).toBe(500)          

(property) HTTPException.status: StatusCode

expect(exception

const exception: HTTPException

.message).toBe('Internal Server Error')          

(property) Error.message: string

expect(exception

const exception: HTTPException

.cause).toBe

(property) Error.cause?: unknown

(error)          

const error: Error

}) it('Should prioritize the status code over the code in the response', async () => { const exception = new

const exception: HTTPException

HTTPException(400, {          

(alias) new HTTPException(status?: StatusCode, options?: HTTPExceptionOptions): HTTPException import HTTPException Creates an instance of HTTPException.

@param status — HTTP status code for the exception. Defaults to 500.

@param options — Additional options for the exception.

res: new

(property) res?: Response | undefined

Response('An exception', {          

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

status: 200,          

(property) ResponseInit.status?: number | undefined

}), }) const res =

const res: Response

exception

const exception: HTTPException

.getResponse()          

(method) HTTPException.getResponse(): Response Returns the response object associated with the exception. If a response object is not provided, a new response is created with the error message and status code.

@returns — The response object.

expect(res

const res: Response

.status).toBe(400)          

(property) Response.status: number MDN Reference

expect(await res

const res: Response

.text()).toBe('An exception')          

(method) Body.text(): Promise<string> MDN Reference

}) })
src/http-exception.ts
            
                /**
                 * @module
                 * This module provides the `HTTPException` class.
                 */
                
                import type { StatusCode } from './utils/http-status'
                
                /**
                 * Options for creating an `HTTPException`.
                 * @property res - Optional response object to use.
                 * @property message - Optional custom error message.
                 * @property cause - Optional cause of the error.
                 */
                type HTTPExceptionOptions = {          

type HTTPExceptionOptions = { res?: Response; message?: string; cause?: unknown; } Options for creating an HTTPException.

@property — res - Optional response object to use.

@property — message - Optional custom error message.

@property — cause - Optional cause of the error.

res?:

(property) res?: Response | undefined

Response          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

message?: string          

(property) message?: string | undefined

cause?: unknown          

(property) cause?: unknown

} /** * `HTTPException` must be used when a fatal error such as authentication failure occurs. * * @see {@link https://hono.dev/docs/api/exception} * * @param {StatusCode} status - status code of HTTPException * @param {HTTPExceptionOptions} options - options of HTTPException * @param {HTTPExceptionOptions["res"]} options.res - response of options of HTTPException * @param {HTTPExceptionOptions["message"]} options.message - message of options of HTTPException * @param {HTTPExceptionOptions["cause"]} options.cause - cause of options of HTTPException * * @example * ```ts * import { HTTPException } from 'hono/http-exception' * * // ... * * app.post('/auth', async (c, next) => { * // authentication * if (authorized === false) { * throw new HTTPException(401, { message: 'Custom error message' }) * } * await next() * }) * ``` */ export class HTTPException extends

class HTTPException HTTPException must be used when a fatal error such as authentication failure occurs.

@see — https://hono.dev/docs/api/exception

@param status — status code of HTTPException

@param options — options of HTTPException

@param options.res — response of options of HTTPException

@param options.message — message of options of HTTPException

@param options.cause — cause of options of HTTPException

@example
```ts import { HTTPException } from 'hono/http-exception'

// ...

app.post('/auth', async (c, next) => { // authentication if (authorized === false) { throw new HTTPException(401, { message: 'Custom error message' }) } await next() }) ```

Error {          

var Error: ErrorConstructor

readonly res?:

(property) HTTPException.res?: Response | undefined

Response          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

readonly status:

(property) HTTPException.status: StatusCode

StatusCode          

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

/** * Creates an instance of `HTTPException`. * @param status - HTTP status code for the exception. Defaults to 500. * @param options - Additional options for the exception. */ constructor(status:

(parameter) status: StatusCode - HTTP status code for the exception. Defaults to 500.

@param status — HTTP status code for the exception. Defaults to 500.

StatusCode = 500,

(alias) type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | -1 import StatusCode If you want to use an unofficial status, use UnofficialStatusCode.

options?:

(parameter) options: HTTPExceptionOptions | undefined - Additional options for the exception.

@param options — Additional options for the exception.

HTTPExceptionOptions) {          

type HTTPExceptionOptions = { res?: Response; message?: string; cause?: unknown; } Options for creating an HTTPException.

@property — res - Optional response object to use.

@property — message - Optional custom error message.

@property — cause - Optional cause of the error.

super(options?

(parameter) options: HTTPExceptionOptions | undefined - Additional options for the exception.

@param options — Additional options for the exception.

.message, {

(property) message?: string | undefined

cause:

(property) ErrorOptions.cause?: unknown

options?

(parameter) options: HTTPExceptionOptions | undefined - Additional options for the exception.

@param options — Additional options for the exception.

.cause })          

(property) cause?: unknown

this.res =

(property) HTTPException.res?: Response | undefined

options?

(parameter) options: HTTPExceptionOptions | undefined - Additional options for the exception.

@param options — Additional options for the exception.

.res          

(property) res?: Response | undefined

this.status =

(property) HTTPException.status: StatusCode

status          

(parameter) status: StatusCode - HTTP status code for the exception. Defaults to 500.

@param status — HTTP status code for the exception. Defaults to 500.

} /** * Returns the response object associated with the exception. * If a response object is not provided, a new response is created with the error message and status code. * @returns The response object. */ getResponse():

(method) HTTPException.getResponse(): Response Returns the response object associated with the exception. If a response object is not provided, a new response is created with the error message and status code.

@returns — The response object.

Response {          

interface Response This Fetch API interface represents the response to a request.

MDN Reference

if (this.res) {          

(property) HTTPException.res?: Response | undefined

const newResponse = new

const newResponse: Response

Response(this

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

.res

(property) HTTPException.res?: Response

.body, {          

(property) Body.body: ReadableStream<Uint8Array> | null MDN Reference

status: this

(property) ResponseInit.status?: number | undefined

.status,          

(property) HTTPException.status: StatusCode

headers: this

(property) ResponseInit.headers?: HeadersInit | undefined

.res

(property) HTTPException.res?: Response

.headers,          

(property) Response.headers: Headers MDN Reference

}) return newResponse          

const newResponse: Response

} return new Response(this

var Response: new (body?: BodyInit | null, init?: ResponseInit) => Response This Fetch API interface represents the response to a request.

MDN Reference

.message, {          

(property) Error.message: string

status: this

(property) ResponseInit.status?: number | undefined

.status,          

(property) HTTPException.status: StatusCode

}) } }
src/index.ts
            
                /**
                 * @module
                 *
                 * Hono - Web Framework built on Web Standards
                 *
                 * @example
                 * ```ts
                 * import { Hono } from 'hono'
                 * const app = new Hono()
                 *
                 * app.get('/', (c) => c.text('Hono!'))
                 *
                 * export default app
                 * ```
                 */
                
                import { Hono } from './hono'
                
                /**
                 * Types for environment variables, error handlers, handlers, middleware handlers, and more.
                 */
                export type {
                  Env,          

(alias) type Env = { Bindings?: Bindings; Variables?: Variables; } export Env

ErrorHandler,          

(alias) type ErrorHandler<E extends Env = any> = (err: Error | HTTPResponseError, c: Context<E>) => Response | Promise<Response> export ErrorHandler

Handler,          

(alias) type Handler<E extends Env = any, P extends string = any, I extends Input = BlankInput, R extends HandlerResponse<any> = any> = (c: Context<E, P, I>, next: Next) => R export Handler

MiddlewareHandler,          

(alias) type MiddlewareHandler<E extends Env = any, P extends string = string, I extends Input = {}> = (c: Context<E, P, I>, next: Next) => Promise<Response | void> export MiddlewareHandler

Next,          

(alias) type Next = () => Promise<void> export Next

NotFoundHandler,          

(alias) type NotFoundHandler<E extends Env = any> = (c: Context<E>) => Response | Promise<Response> export NotFoundHandler

ValidationTargets,          

(alias) type ValidationTargets<T extends FormValue = ParsedFormValue, P extends string = string> = { json: any; form: Record<string, T | T[]>; query: Record<string, string | string[]>; param: Record<P, P extends `${infer _}?` ? string | undefined : string>; header: Record<string, string>; cookie: Record<string, string>; } export ValidationTargets

Input,          

(alias) type Input = { in?: {}; out?: {}; outputFormat?: ResponseFormat; } export Input

Schema,          

(alias) type Schema = { [Path: string]: { [Method: `$${Lowercase<string>}`]: Endpoint; }; } export Schema

ToSchema,          

(alias) type ToSchema<M extends string, P extends string, I extends Input | Input["in"], RorO> = { [KeyType in keyof { [K in P]: { [K2 in M as `$${Lowercase<K2>}`]: { [KeyType in keyof ({ input: AddParam<ExtractInput<I>, P>; } & (IsAny<RorO> extends true ? { ...; } : RorO extends TypedResponse<...> ? { ...; } : { ...; }))]: ({ input: AddParam<ExtractInput<I>, P>; } & (IsAny<RorO> extends true ? { ...; } : RorO extends TypedResponse<...> ? { ...; } : { ...; }))[KeyType]; }; }; }]: { [K in P]: { [K2 in M as `$${Lowercase<K2>}`]: { [KeyType in keyof ({ input: AddParam<ExtractInput<I>, P>; } & (IsAny<RorO> extends true ? { ...; } : RorO extends TypedResponse<...> ? { ...; } : { ...; }))]: ({ input: AddParam<ExtractInput<I>, P>; } & (IsAny<RorO> extends true ? { ...; } : RorO extends TypedResponse<...> ? { ...; } : { ...; }))[KeyType]; }; }; }[KeyType]; } export ToSchema

TypedResponse,          

(alias) type TypedResponse<T = unknown, U extends StatusCode = StatusCode, F extends ResponseFormat = T extends string ? "text" : T extends JSONValue ? "json" : string> = { _data: T; _status: U; _format: F; } export TypedResponse

} from './types' /** * Types for context, context variable map, context renderer, and execution context. */ export type { Context,

(alias) class Context<E extends Env = any, P extends string = any, I extends Input = {}> export Context

ContextVariableMap,

(alias) interface ContextVariableMap export ContextVariableMap Interface for context variable mapping.

ContextRenderer,

(alias) interface ContextRenderer export ContextRenderer Interface for context renderer.

ExecutionContext } from './context'          

(alias) interface ExecutionContext export ExecutionContext Interface for the execution context in a web worker or similar environment.

/** * Type for HonoRequest. */ export type { HonoRequest } from './request'          

(alias) class HonoRequest<P extends string = "/", I extends Input["out"] = {}> export HonoRequest

/** * Types for inferring request and response types and client request options. */ export type { InferRequestType,

(alias) type InferRequestType<T> = T extends (args: infer R, options: any | undefined) => Promise<ClientResponse<unknown>> ? NonNullable<R> : never export InferRequestType

InferResponseType,

(alias) type InferResponseType<T, U extends StatusCode = StatusCode> = InferEndpointType<T> extends { output: infer O; status: infer S; } ? S extends U ? O : never : never export InferResponseType

ClientRequestOptions } from './client'          

(alias) type ClientRequestOptions<T = unknown> = { fetch?: typeof fetch | ((input: RequestInfo | URL, requestInit?: RequestInit, Env?: any, executionCtx?: ExecutionContext) => Response | Promise<Response>); webSocket?: (...args: ConstructorParameters<typeof WebSocket>) => WebSocket; init?: RequestInit; } & (keyof T extends never ? { ...; } : { ...; }) export ClientRequestOptions

/** * Hono framework for building web applications. */ export { Hono }          

(alias) class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> export Hono The Hono class extends the functionality of the HonoBase class. It sets up routing and allows for custom options to be passed.

@template E — The environment type.

@template S — The schema type.

@template BasePath — The base path type.

src/jsx/base.ts
            
                import { raw } from '../helper/html'
                import { escapeToBuffer, resolveCallbackSync, stringBufferToString } from '../utils/html'
                import type { HtmlEscaped, HtmlEscapedString, StringBufferWithCallbacks } from '../utils/html'
                import { DOM_RENDERER } from './constants'
                import type { Context } from './context'
                import { createContext, globalContexts, useContext } from './context'
                import { domRenderers } from './intrinsic-element/common'
                import * as intrinsicElementTags from './intrinsic-element/components'
                import type {
                  JSX as HonoJSX,
                  IntrinsicElements as IntrinsicElementsDefined,
                } from './intrinsic-elements'
                import { normalizeIntrinsicElementKey, styleObjectForEach } from './utils'
                
                // eslint-disable-next-line @typescript-eslint/no-explicit-any
                export type Props =

type Props = { [x: string]: any; }

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

export type FC

type FC<P = Props> = { (props: P): HtmlEscapedString | Promise<HtmlEscapedString> | null; defaultProps?: Partial<P> | undefined; displayName?: string | undefined; }

<P =

(type parameter) P in type FC<P = Props>

Props> = {          

type Props = { [x: string]: any; }

(props:

(parameter) props: P = Props

P):

(type parameter) P in type FC<P = Props>

HtmlEscapedString |

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<HtmlEscapedString> | null          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

defaultProps?:

(property) defaultProps?: Partial<P> | undefined

Partial

type Partial<T> = { [P in keyof T]?: T[P] | undefined; } Make all properties in T optional

<P> | undefined          

(type parameter) P in type FC<P = Props>

displayName?: string | undefined          

(property) displayName?: string | undefined

} export type DOMAttributes =

type DOMAttributes = HonoJSX.HTMLAttributes

HonoJSX

(alias) namespace HonoJSX import HonoJSX This code is based on React. https://github.com/facebook/react MIT License Copyright (c) Meta Platforms, Inc. and affiliates.

.HTMLAttributes          

interface JSX.HTMLAttributes

// eslint-disable-next-line @typescript-eslint/no-namespace export namespace JSX {          

namespace JSX

export type Element =

type JSX.Element = HtmlEscapedString | Promise<HtmlEscapedString>

HtmlEscapedString |

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<HtmlEscapedString>          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

export interface ElementChildrenAttribute {          

interface JSX.ElementChildrenAttribute

children:

(property) JSX.ElementChildrenAttribute.children: Child

Child          

type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined

} export interface IntrinsicElements extends

interface JSX.IntrinsicElements

IntrinsicElementsDefined {          

(alias) interface IntrinsicElementsDefined import IntrinsicElementsDefined

[tagName: string]:

(parameter) tagName: string

Props          

type Props = { [x: string]: any; }

} export interface IntrinsicAttributes {          

interface JSX.IntrinsicAttributes

key?: string | number | bigint | null | undefined          

(property) JSX.IntrinsicAttributes.key?: string | number | bigint | null | undefined

} } let nameSpaceContext:

let nameSpaceContext: Context<string> | undefined

Context | undefined = undefined          

(alias) interface Context<T> import Context

export const getNameSpaceContext = () =>

const getNameSpaceContext: () => Context<string> | undefined

nameSpaceContext          

let nameSpaceContext: Context<string> | undefined

const toSVGAttributeName =

const toSVGAttributeName: (key: string) => string

(key: string): string =>          

(parameter) key: string

/[A-Z]/.test

(method) RegExp.test(string: string): boolean Returns a Boolean value that indicates whether or not a pattern exists in a searched string.

@param string — String on which to perform the search.

(key) &&          

(parameter) key: string

// Presentation attributes are findable in style object. "clip-path", "font-size", "stroke-width", etc. // Or other un-deprecated kebab-case attributes. "overline-position", "paint-order", "strikethrough-position", etc. key

(parameter) key: string

.match(          

(method) String.match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null (+1 overload) Matches a string or an object that supports being matched against, and returns an array containing the results of that search, or null if no matches are found.

@param matcher — An object that supports being matched against.

/^(?:al|basel|clip(?:Path|Rule)$|co|do|fill|fl|fo|gl|let|lig|i|marker[EMS]|o|pai|pointe|sh|st[or]|text[^L]|tr|u|ve|w)/ ) ? key

(parameter) key: string

.replace(/([A-Z])/g, '-$1')

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

.toLowerCase()          

(method) String.toLowerCase(): string Converts all the alphabetic characters in a string to lowercase.

: key          

(parameter) key: string

const emptyTags = [          

const emptyTags: string[]

'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr', ] export const booleanAttributes = [          

const booleanAttributes: string[]

'allowfullscreen', 'async', 'autofocus', 'autoplay', 'checked', 'controls', 'default', 'defer', 'disabled', 'download', 'formnovalidate', 'hidden', 'inert', 'ismap', 'itemscope', 'loop', 'multiple', 'muted', 'nomodule', 'novalidate', 'open', 'playsinline', 'readonly', 'required', 'reversed', 'selected', ] const childrenToStringToBuffer =

const childrenToStringToBuffer: (children: Child[], buffer: StringBufferWithCallbacks) => void

(children:

(parameter) children: Child[]

Child[],

type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined

buffer:

(parameter) buffer: StringBufferWithCallbacks

StringBufferWithCallbacks): void => {          

(alias) type StringBufferWithCallbacks = StringBuffer & { callbacks: HtmlEscapedCallback[]; } import StringBufferWithCallbacks

for (let i = 0,

let i: number

len =

let len: number

children

(parameter) children: Child[]

.length;

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

i <

let i: number

len;

let len: number

i++) {          

let i: number

const child =

const child: Child

children

(parameter) children: Child[]

[i]          

let i: number

if (typeof child === 'string') {          

const child: Child

escapeToBuffer

(alias) escapeToBuffer(str: string, buffer: StringBuffer): void import escapeToBuffer

(child,

const child: string

buffer)          

(parameter) buffer: StringBufferWithCallbacks

} else if (typeof child === 'boolean' ||

const child: number | boolean | Promise<string> | JSXNode | Child[] | null | undefined

child === null ||

const child: number | Promise<string> | JSXNode | Child[] | null | undefined

child === undefined) {          

const child: number | Promise<string> | JSXNode | Child[] | undefined

continue } else if (child instanceof

const child: number | Promise<string> | JSXNode | Child[]

JSXNode) {          

class JSXNode

child

const child: JSXNode

.toStringToBuffer

(method) JSXNode.toStringToBuffer(buffer: StringBufferWithCallbacks): void

(buffer)          

(parameter) buffer: StringBufferWithCallbacks

} else if ( typeof child === 'number' ||          

const child: number | Promise<string> | Child[]

(child as unknown as {

const child: Promise<string> | Child[]

isEscaped: boolean })

(property) isEscaped: boolean

.isEscaped          

(property) isEscaped: boolean

) { ;(buffer[0] as string) +=

(parameter) buffer: StringBufferWithCallbacks

child          

const child: number | Promise<string> | Child[]

} else if (child instanceof

const child: Promise<string> | Child[]

Promise) {          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

buffer

(parameter) buffer: StringBufferWithCallbacks

.unshift('',

(method) Array<string | Promise<string>>.unshift(...items: (string | Promise<string>)[]): number Inserts new elements at the start of an array, and returns the new length of the array.

@param items — Elements to insert at the start of the array.

child)          

const child: Promise<string>

} else { // `child` type is `Child[]`, so stringify recursively childrenToStringToBuffer

const childrenToStringToBuffer: (children: Child[], buffer: StringBufferWithCallbacks) => void

(child,

const child: Child[]

buffer)          

(parameter) buffer: StringBufferWithCallbacks

} } } type LocalContexts =

type LocalContexts = [Context<unknown>, unknown][]

[Context, unknown][]          

(alias) interface Context<T> import Context

export type Child =          

type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined

| string | Promise          

interface Promise<T> Represents the completion of an asynchronous operation

| number | JSXNode          

class JSXNode

| null | undefined | boolean | Child[]          

type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined

export class JSXNode implements

class JSXNode

HtmlEscaped {          

(alias) type HtmlEscaped = { isEscaped: true; callbacks?: HtmlEscapedCallback[]; } import HtmlEscaped

tag: string |

(property) JSXNode.tag: string | Function

Function          

interface Function Creates a new function.

props:

(property) JSXNode.props: Props

Props          

type Props = { [x: string]: any; }

key?: string          

(property) JSXNode.key?: string | undefined

children:

(property) JSXNode.children: Child[]

Child[]          

type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined

isEscaped: true = true as

(property) JSXNode.isEscaped: true

const          

type const = true

localContexts?:

(property) JSXNode.localContexts?: LocalContexts | undefined

LocalContexts          

type LocalContexts = [Context<unknown>, unknown][]

constructor(tag: string |

(parameter) tag: string | Function

Function,

interface Function Creates a new function.

props:

(parameter) props: Props

Props,

type Props = { [x: string]: any; }

children:

(parameter) children: Child[]

Child[]) {          

type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined

this.tag =

(property) JSXNode.tag: string | Function

tag          

(parameter) tag: string | Function

this.props =

(property) JSXNode.props: Props

props          

(parameter) props: Props

this.children =

(property) JSXNode.children: Child[]

children          

(parameter) children: Child[]

} get type(): string |

(getter) JSXNode.type: string | Function

Function {          

interface Function Creates a new function.

return this.tag as string          

(property) JSXNode.tag: string | Function

} // Added for compatibility with libraries that rely on React's internal structure // eslint-disable-next-line @typescript-eslint/no-explicit-any get ref(): any {          

(getter) JSXNode.ref: any

return this.props.ref || null          

(property) JSXNode.props: Props

} toString(): string |

(method) JSXNode.toString(): string | Promise<string> Returns a string representation of an object.

Promise {          

interface Promise<T> Represents the completion of an asynchronous operation

const buffer:

const buffer: StringBufferWithCallbacks

StringBufferWithCallbacks = [''] as

(alias) type StringBufferWithCallbacks = StringBuffer & { callbacks: HtmlEscapedCallback[]; } import StringBufferWithCallbacks

StringBufferWithCallbacks          

(alias) type StringBufferWithCallbacks = StringBuffer & { callbacks: HtmlEscapedCallback[]; } import StringBufferWithCallbacks

this.localContexts?

(property) JSXNode.localContexts?: LocalContexts | undefined

.forEach((

(method) Array<[Context<unknown>, unknown]>.forEach(callbackfn: (value: [Context<unknown>, unknown], index: number, array: [Context<unknown>, unknown][]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

[context,

(parameter) context: Context<unknown>

value]) => {          

(parameter) value: unknown

context

(parameter) context: Context<unknown>

.values

(property) Context<unknown>.values: unknown[]

.push

(method) Array<unknown>.push(...items: unknown[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(value)          

(parameter) value: unknown

}) try { this.toStringToBuffer

(method) JSXNode.toStringToBuffer(buffer: StringBufferWithCallbacks): void

(buffer)          

const buffer: StringBufferWithCallbacks

} finally { this.localContexts?

(property) JSXNode.localContexts?: LocalContexts | undefined

.forEach((

(method) Array<[Context<unknown>, unknown]>.forEach(callbackfn: (value: [Context<unknown>, unknown], index: number, array: [Context<unknown>, unknown][]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

[context]) => {          

(parameter) context: Context<unknown>

context

(parameter) context: Context<unknown>

.values

(property) Context<unknown>.values: unknown[]

.pop()          

(method) Array<unknown>.pop(): unknown Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

}) } return buffer

const buffer: StringBufferWithCallbacks

.length === 1          

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

? 'callbacks' in buffer          

const buffer: StringBufferWithCallbacks

? resolveCallbackSync

(alias) resolveCallbackSync(str: string | HtmlEscapedString): string import resolveCallbackSync

(raw

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

(buffer[0],

const buffer: StringBufferWithCallbacks

buffer

const buffer: StringBufferWithCallbacks

.callbacks))

(property) callbacks: HtmlEscapedCallback[]

.toString()          

(method) String.toString(): string Returns a string representation of a string.

: buffer[0]          

const buffer: never

: stringBufferToString

(alias) stringBufferToString(buffer: StringBuffer, callbacks: HtmlEscapedCallback[] | undefined): Promise<HtmlEscapedString> import stringBufferToString

(buffer,

const buffer: StringBufferWithCallbacks

buffer

const buffer: StringBufferWithCallbacks

.callbacks)          

(property) callbacks: HtmlEscapedCallback[]

} toStringToBuffer

(method) JSXNode.toStringToBuffer(buffer: StringBufferWithCallbacks): void

(buffer:

(parameter) buffer: StringBufferWithCallbacks

StringBufferWithCallbacks): void {          

(alias) type StringBufferWithCallbacks = StringBuffer & { callbacks: HtmlEscapedCallback[]; } import StringBufferWithCallbacks

const tag = this

const tag: string

.tag as string          

(property) JSXNode.tag: string | Function

const props = this

const props: Props

.props          

(property) JSXNode.props: Props

let { children } = this          

let children: Child[]

buffer[0] += `<$

(parameter) buffer: StringBufferWithCallbacks

{tag}`          

const tag: string

const normalizeKey:

const normalizeKey: (key: string) => string

(key: string) => string =          

(parameter) key: string

nameSpaceContext &&

let nameSpaceContext: Context<string> | undefined

useContext

(alias) useContext<string>(context: Context<string>): string import useContext

(nameSpaceContext) === 'svg'          

let nameSpaceContext: Context<string>

? (key) =>

(parameter) key: string

toSVGAttributeName

const toSVGAttributeName: (key: string) => string

(normalizeIntrinsicElementKey

(alias) normalizeIntrinsicElementKey(key: string): string import normalizeIntrinsicElementKey

(key))          

(parameter) key: string

: (key) =>

(parameter) key: string

normalizeIntrinsicElementKey

(alias) normalizeIntrinsicElementKey(key: string): string import normalizeIntrinsicElementKey

(key)          

(parameter) key: string

for (let [key,

let key: string

v] of

let v: any

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.entries

(method) ObjectConstructor.entries<any>(o: { [s: string]: any; } | ArrayLike<any>): [string, any][] (+1 overload) Returns an array of key/values of the enumerable own properties of an object

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(props)) {          

const props: Props

key =

let key: string

normalizeKey

const normalizeKey: (key: string) => string

(key)          

let key: string

if (key === 'children') {          

let key: string

// skip children } else if (key === 'style' && typeof

let key: string

v === 'object') {          

let v: any

// object to style strings let styleStr = ''          

let styleStr: string

styleObjectForEach

(alias) styleObjectForEach(style: Record<string, string | number>, fn: (key: string, value: string | null) => void): void import styleObjectForEach

(v,

let v: any

(property,

(parameter) property: string

value) => {          

(parameter) value: string | null

if (value != null) {          

(parameter) value: string | null

styleStr += `$

let styleStr: string

{styleStr ? ';' : ''}$

let styleStr: string

{property}:$

(parameter) property: string

{value}`          

(parameter) value: string

} }) buffer[0] += ' style="'          

(parameter) buffer: StringBufferWithCallbacks

escapeToBuffer

(alias) escapeToBuffer(str: string, buffer: StringBuffer): void import escapeToBuffer

(styleStr,

let styleStr: string

buffer)          

(parameter) buffer: StringBufferWithCallbacks

buffer[0] += '"'          

(parameter) buffer: StringBufferWithCallbacks

} else if (typeof v === 'string') {          

let v: any

buffer[0] += ` $

(parameter) buffer: StringBufferWithCallbacks

{key}="`          

let key: string

escapeToBuffer

(alias) escapeToBuffer(str: string, buffer: StringBuffer): void import escapeToBuffer

(v,

let v: string

buffer)          

(parameter) buffer: StringBufferWithCallbacks

buffer[0] += '"'          

(parameter) buffer: StringBufferWithCallbacks

} else if (v === null ||

let v: any

v === undefined) {          

let v: any

// Do nothing } else if (typeof v === 'number' ||

let v: any

(v as

let v: any

HtmlEscaped)

(alias) type HtmlEscaped = { isEscaped: true; callbacks?: HtmlEscapedCallback[]; } import HtmlEscaped

.isEscaped) {          

(property) isEscaped: true

buffer[0] += ` $

(parameter) buffer: StringBufferWithCallbacks

{key}="$

let key: string

{v}"`          

let v: any

} else if (typeof v === 'boolean' &&

let v: any

booleanAttributes

const booleanAttributes: string[]

.includes

(method) Array<string>.includes(searchElement: string, fromIndex?: number): boolean Determines whether an array includes a certain element, returning true or false as appropriate.

@param searchElement — The element to search for.

@param fromIndex — The position in this array at which to begin searching for searchElement.

(key)) {          

let key: string

if (v) {          

let v: boolean

buffer[0] += ` $

(parameter) buffer: StringBufferWithCallbacks

{key}=""`          

let key: string

} } else if (key === 'dangerouslySetInnerHTML') {          

let key: string

if (children

let children: Child[]

.length > 0) {          

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

throw 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.' } children =

let children: Child[]

[raw

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

(v.__html)]          

let v: any

} else if (v instanceof

let v: any

Promise) {          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

buffer[0] += ` $

(parameter) buffer: StringBufferWithCallbacks

{key}="`          

let key: string

buffer

(parameter) buffer: StringBufferWithCallbacks

.unshift('"',

(method) Array<string | Promise<string>>.unshift(...items: (string | Promise<string>)[]): number Inserts new elements at the start of an array, and returns the new length of the array.

@param items — Elements to insert at the start of the array.

v)          

let v: Promise<any>

} else if (typeof v === 'function') {          

let v: any

if (!key

let key: string

.startsWith('on')) {          

(method) String.startsWith(searchString: string, position?: number): boolean Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false.

throw `Invalid prop '${key}' of type 'function' supplied to '$

let key: string

{tag}'.`          

const tag: string

} // maybe event handler for client components, just ignore in server components } else { buffer[0] += ` $

(parameter) buffer: StringBufferWithCallbacks

{key}="`          

let key: string

escapeToBuffer

(alias) escapeToBuffer(str: string, buffer: StringBuffer): void import escapeToBuffer

(v.toString(),

let v: any

buffer)          

(parameter) buffer: StringBufferWithCallbacks

buffer[0] += '"'          

(parameter) buffer: StringBufferWithCallbacks

} } if (emptyTags

const emptyTags: string[]

.includes

(method) Array<string>.includes(searchElement: string, fromIndex?: number): boolean Determines whether an array includes a certain element, returning true or false as appropriate.

@param searchElement — The element to search for.

@param fromIndex — The position in this array at which to begin searching for searchElement.

(tag as string) &&

const tag: string

children

let children: Child[]

.length === 0) {          

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

buffer[0] += '/>'          

(parameter) buffer: StringBufferWithCallbacks

return } buffer[0] += '>'          

(parameter) buffer: StringBufferWithCallbacks

childrenToStringToBuffer

const childrenToStringToBuffer: (children: Child[], buffer: StringBufferWithCallbacks) => void

(children,

let children: Child[]

buffer)          

(parameter) buffer: StringBufferWithCallbacks

buffer[0] += `

(parameter) buffer: StringBufferWithCallbacks

{tag}>`          

const tag: string

} } class JSXFunctionNode extends

class JSXFunctionNode

JSXNode {          

class JSXNode

toStringToBuffer

(method) JSXFunctionNode.toStringToBuffer(buffer: StringBufferWithCallbacks): void

(buffer:

(parameter) buffer: StringBufferWithCallbacks

StringBufferWithCallbacks): void {          

(alias) type StringBufferWithCallbacks = StringBuffer & { callbacks: HtmlEscapedCallback[]; } import StringBufferWithCallbacks

const { children } = this          

const children: Child[]

const res = (this

const res: any

.tag as

(property) JSXNode.tag: string | Function

Function)

interface Function Creates a new function.

.call(null, {          

(method) Function.call(this: Function, thisArg: any, ...argArray: any[]): any Calls a method of an object, substituting another object for the current object.

@param thisArg — The object to be used as the current object.

@param argArray — A list of arguments to be passed to the method.

...this.props,          

(property) JSXNode.props: Props

children:

(property) children: Child

children

const children: Child[]

.length <= 1 ?

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

children[0] :

const children: Child[]

children,          

const children: Child[]

}) if (typeof res === 'boolean' ||

const res: any

res == null) {          

const res: any

// boolean or null or undefined return } else if (res instanceof

const res: any

Promise) {          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

if (globalContexts

(alias) const globalContexts: Context<unknown>[] import globalContexts

.length === 0) {          

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

buffer

(parameter) buffer: StringBufferWithCallbacks

.unshift('',

(method) Array<string | Promise<string>>.unshift(...items: (string | Promise<string>)[]): number Inserts new elements at the start of an array, and returns the new length of the array.

@param items — Elements to insert at the start of the array.

res)          

const res: Promise<any>

} else { // save current contexts for resuming const currentContexts:

const currentContexts: LocalContexts

LocalContexts =

type LocalContexts = [Context<unknown>, unknown][]

globalContexts

(alias) const globalContexts: Context<unknown>[] import globalContexts

.map(

(method) Array<Context<unknown>>.map<[Context<unknown>, unknown]>(callbackfn: (value: Context<unknown>, index: number, array: Context<unknown>[]) => [Context<unknown>, unknown], thisArg?: any): [Context<unknown>, unknown][] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(c) =>

(parameter) c: Context<unknown>

[c,

(parameter) c: Context<unknown>

c

(parameter) c: Context<unknown>

.values

(property) Context<unknown>.values: unknown[]

.at(-1)])          

(method) Array<unknown>.at(index: number): unknown Returns the item located at the specified index.

@param index — The zero-based index of the desired code unit. A negative index will count back from the last item.

buffer

(parameter) buffer: StringBufferWithCallbacks

.unshift(          

(method) Array<string | Promise<string>>.unshift(...items: (string | Promise<string>)[]): number Inserts new elements at the start of an array, and returns the new length of the array.

@param items — Elements to insert at the start of the array.

'', res

const res: Promise<any>

.then(

(method) Promise<any>.then<any, string>(onfulfilled?: ((value: any) => any) | null | undefined, onrejected?: ((reason: any) => string | PromiseLike<string>) | null | undefined): Promise<any> Attaches callbacks for the resolution and/or rejection of the Promise.

@param onfulfilled — The callback to execute when the Promise is resolved.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of which ever callback is executed.

(childRes) => {          

(parameter) childRes: any

if (childRes instanceof

(parameter) childRes: any

JSXNode) {          

class JSXNode

childRes

(parameter) childRes: JSXNode

.localContexts =

(property) JSXNode.localContexts?: LocalContexts | undefined

currentContexts          

const currentContexts: LocalContexts

} return childRes          

(parameter) childRes: any

}) ) } } else if (res instanceof

const res: any

JSXNode) {          

class JSXNode

res

const res: JSXNode

.toStringToBuffer

(method) JSXNode.toStringToBuffer(buffer: StringBufferWithCallbacks): void

(buffer)          

(parameter) buffer: StringBufferWithCallbacks

} else if (typeof res === 'number' ||

const res: any

(res as

const res: any

HtmlEscaped)

(alias) type HtmlEscaped = { isEscaped: true; callbacks?: HtmlEscapedCallback[]; } import HtmlEscaped

.isEscaped) {          

(property) isEscaped: true

buffer[0] +=

(parameter) buffer: StringBufferWithCallbacks

res          

const res: any

if (res.callbacks) {          

const res: any

buffer

(parameter) buffer: StringBufferWithCallbacks

.callbacks ||= []          

(property) callbacks: HtmlEscapedCallback[]

buffer

(parameter) buffer: StringBufferWithCallbacks

.callbacks

(property) callbacks: HtmlEscapedCallback[]

.push(..

(method) Array<HtmlEscapedCallback>.push(...items: HtmlEscapedCallback[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

.res.callbacks)          

const res: any

} } else { escapeToBuffer

(alias) escapeToBuffer(str: string, buffer: StringBuffer): void import escapeToBuffer

(res,

const res: any

buffer)          

(parameter) buffer: StringBufferWithCallbacks

} } } export class JSXFragmentNode extends

class JSXFragmentNode

JSXNode {          

class JSXNode

toStringToBuffer

(method) JSXFragmentNode.toStringToBuffer(buffer: StringBufferWithCallbacks): void

(buffer:

(parameter) buffer: StringBufferWithCallbacks

StringBufferWithCallbacks): void {          

(alias) type StringBufferWithCallbacks = StringBuffer & { callbacks: HtmlEscapedCallback[]; } import StringBufferWithCallbacks

childrenToStringToBuffer(this

const childrenToStringToBuffer: (children: Child[], buffer: StringBufferWithCallbacks) => void

.children,

(property) JSXNode.children: Child[]

buffer)          

(parameter) buffer: StringBufferWithCallbacks

} } export const jsx = (          

const jsx: (tag: string | Function, props: Props | null, ...children: (string | number | HtmlEscapedString)[]) => JSXNode

tag: string |

(parameter) tag: string | Function

Function,          

interface Function Creates a new function.

props:

(parameter) props: Props | null

Props | null,          

type Props = { [x: string]: any; }

...children: (string | number |

(parameter) children: (string | number | HtmlEscapedString)[]

HtmlEscapedString)[]          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

): JSXNode => {          

class JSXNode

props ??= {}          

(parameter) props: Props | null

if (children

(parameter) children: (string | number | HtmlEscapedString)[]

.length) {          

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

props.children =

(parameter) props: Props

children

(parameter) children: (string | number | HtmlEscapedString)[]

.length === 1 ?

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

children[0] :

(parameter) children: (string | number | HtmlEscapedString)[]

children          

(parameter) children: (string | number | HtmlEscapedString)[]

} const key =

const key: any

props.key          

(parameter) props: Props

delete props['key']          

(parameter) props: Props

const node =

const node: JSXNode

jsxFn

const jsxFn: (tag: string | Function, props: Props, children: (string | number | HtmlEscapedString)[]) => JSXNode

(tag,

(parameter) tag: string | Function

props,

(parameter) props: Props

children)          

(parameter) children: (string | number | HtmlEscapedString)[]

node

const node: JSXNode

.key =

(property) JSXNode.key?: string | undefined

key          

const key: any

return node          

const node: JSXNode

} let initDomRenderer = false          

let initDomRenderer: boolean

export const jsxFn = (          

const jsxFn: (tag: string | Function, props: Props, children: (string | number | HtmlEscapedString)[]) => JSXNode

tag: string |

(parameter) tag: string | Function

Function,          

interface Function Creates a new function.

props:

(parameter) props: Props

Props,          

type Props = { [x: string]: any; }

children: (string | number |

(parameter) children: (string | number | HtmlEscapedString)[]

HtmlEscapedString)[]          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

): JSXNode => {          

class JSXNode

if (!initDomRenderer) {          

let initDomRenderer: boolean

for (const k in

const k: string

domRenderers) {          

(alias) const domRenderers: Record<string, Function> import domRenderers

// eslint-disable-next-line @typescript-eslint/no-explicit-any ;(intrinsicElementTags[k as keyof typeof intrinsicElementTags] as any)

const k: string

[DOM_RENDERER] =          

(alias) const DOM_RENDERER: typeof DOM_RENDERER import DOM_RENDERER

domRenderers

(alias) const domRenderers: Record<string, Function> import domRenderers

[k]          

const k: string

} initDomRenderer = true          

let initDomRenderer: boolean

} if (typeof tag === 'function') {          

(parameter) tag: string | Function

return new JSXFunctionNode

constructor JSXFunctionNode(tag: string | Function, props: Props, children: Child[]): JSXFunctionNode

(tag,

(parameter) tag: Function

props,

(parameter) props: Props

children)          

(parameter) children: (string | number | HtmlEscapedString)[]

} else if (intrinsicElementTags[tag as keyof typeof intrinsicElementTags]) {          

(parameter) tag: string

return new JSXFunctionNode(          

constructor JSXFunctionNode(tag: string | Function, props: Props, children: Child[]): JSXFunctionNode

intrinsicElementTags[tag as keyof typeof intrinsicElementTags],          

(parameter) tag: string

props,          

(parameter) props: Props

children          

(parameter) children: (string | number | HtmlEscapedString)[]

) } else if (tag === 'svg' ||

(parameter) tag: string

tag === 'head') {          

(parameter) tag: string

nameSpaceContext ||=

let nameSpaceContext: Context<string> | undefined

createContext('')          

(alias) createContext<string>(defaultValue: string): Context<string> import createContext

return new JSXNode

constructor JSXNode(tag: string | Function, props: Props, children: Child[]): JSXNode

(tag,

(parameter) tag: "head" | "svg"

props, [          

(parameter) props: Props

new JSXFunctionNode(          

constructor JSXFunctionNode(tag: string | Function, props: Props, children: Child[]): JSXFunctionNode

nameSpaceContext,          

let nameSpaceContext: Context<string>

{ value:

(property) value: string

tag,          

(parameter) tag: "head" | "svg"

}, children          

(parameter) children: (string | number | HtmlEscapedString)[]

), ]) } else { return new JSXNode

constructor JSXNode(tag: string | Function, props: Props, children: Child[]): JSXNode

(tag,

(parameter) tag: string

props,

(parameter) props: Props

children)          

(parameter) children: (string | number | HtmlEscapedString)[]

} } const shallowEqual =

const shallowEqual: (a: Props, b: Props) => boolean

(a:

(parameter) a: Props

Props,

type Props = { [x: string]: any; }

b:

(parameter) b: Props

Props): boolean => {          

type Props = { [x: string]: any; }

if (a ===

(parameter) a: Props

b) {          

(parameter) b: Props

return true } const aKeys =

const aKeys: string[]

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.keys

(method) ObjectConstructor.keys(o: {}): string[] (+1 overload) Returns the names of the enumerable string properties and methods of an object.

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(a)

(parameter) a: Props

.sort()          

(method) Array<string>.sort(compareFn?: ((a: string, b: string) => number) | undefined): string[] Sorts an array in place. This method mutates the array and returns a reference to the same array.

@param compareFn
Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. ts [11,2,22,1].sort((a, b) => a - b)

const bKeys =

const bKeys: string[]

Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.keys

(method) ObjectConstructor.keys(o: {}): string[] (+1 overload) Returns the names of the enumerable string properties and methods of an object.

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(b)

(parameter) b: Props

.sort()          

(method) Array<string>.sort(compareFn?: ((a: string, b: string) => number) | undefined): string[] Sorts an array in place. This method mutates the array and returns a reference to the same array.

@param compareFn
Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. ts [11,2,22,1].sort((a, b) => a - b)

if (aKeys

const aKeys: string[]

.length !==

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

bKeys

const bKeys: string[]

.length) {          

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

return false } for (let i = 0,

let i: number

len =

let len: number

aKeys

const aKeys: string[]

.length;

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

i <

let i: number

len;

let len: number

i++) {          

let i: number

if ( aKeys

const aKeys: string[]

[i] === 'children' &&          

let i: number

bKeys

const bKeys: string[]

[i] === 'children' &&          

let i: number

!a.children?.length &&          

(parameter) a: Props

!b.children?.length          

(parameter) b: Props

) { continue } else if (a

(parameter) a: Props

[aKeys

const aKeys: string[]

[i]] !==

let i: number

b

(parameter) b: Props

[aKeys

const aKeys: string[]

[i]]) {          

let i: number

return false } } return true } export const memo =

const memo: <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean) => FC<T>

<T>(          

(type parameter) T in <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean): FC<T>

component:

(parameter) component: FC<T>

FC

type FC<P = Props> = { (props: P): HtmlEscapedString | Promise<HtmlEscapedString> | null; defaultProps?: Partial<P> | undefined; displayName?: string | undefined; }

<T>,          

(type parameter) T in <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean): FC<T>

propsAreEqual:

(parameter) propsAreEqual: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean

(prevProps:

(parameter) prevProps: Readonly<T>

Readonly

type Readonly<T> = { readonly [P in keyof T]: T[P]; } Make all properties in T readonly

<T>,

(type parameter) T in <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean): FC<T>

nextProps:

(parameter) nextProps: Readonly<T>

Readonly

type Readonly<T> = { readonly [P in keyof T]: T[P]; } Make all properties in T readonly

<T>) => boolean =

(type parameter) T in <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean): FC<T>

shallowEqual          

const shallowEqual: (a: Props, b: Props) => boolean

): FC

type FC<P = Props> = { (props: P): HtmlEscapedString | Promise<HtmlEscapedString> | null; defaultProps?: Partial<P> | undefined; displayName?: string | undefined; }

<T> => {          

(type parameter) T in <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean): FC<T>

let computed:

let computed: HtmlEscapedString | Promise<HtmlEscapedString> | null

ReturnType

type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any Obtain the return type of a function type

<FC

type FC<P = Props> = { (props: P): HtmlEscapedString | Promise<HtmlEscapedString> | null; defaultProps?: Partial<P> | undefined; displayName?: string | undefined; }

<T>> = null          

(type parameter) T in <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean): FC<T>

let prevProps:

let prevProps: T | undefined

T | undefined = undefined          

(type parameter) T in <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean): FC<T>

return ((props) => {          

(parameter) props: T

if (prevProps &&

let prevProps: T | undefined

!propsAreEqual

(parameter) propsAreEqual: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean

(prevProps,

let prevProps: NonNullable<T>

props)) {          

(parameter) props: T

computed = null          

let computed: HtmlEscapedString | Promise<HtmlEscapedString> | null

} prevProps =

let prevProps: T | undefined

props          

(parameter) props: T

return (computed ||=

let computed: HtmlEscapedString | Promise<HtmlEscapedString> | null

component

(parameter) component: (props: T) => HtmlEscapedString | Promise<HtmlEscapedString> | null

(props))          

(parameter) props: T

}) as FC

type FC<P = Props> = { (props: P): HtmlEscapedString | Promise<HtmlEscapedString> | null; defaultProps?: Partial<P> | undefined; displayName?: string | undefined; }

<T>          

(type parameter) T in <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean): FC<T>

} export const Fragment = ({          

const Fragment: ({ children, }: { key?: string; children?: Child | HtmlEscapedString; }) => HtmlEscapedString

children,          

(parameter) children: Child | HtmlEscapedString

}: { key?: string          

(property) key?: string | undefined

children?:

(property) children?: Child | HtmlEscapedString

Child |

type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined

HtmlEscapedString          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

}): HtmlEscapedString => {          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

return new JSXFragmentNode(          

constructor JSXFragmentNode(tag: string | Function, props: Props, children: Child[]): JSXFragmentNode

'', { children,          

(property) children: Child | HtmlEscapedString

}, Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(children) ?

(parameter) children: Child | HtmlEscapedString

children :

(parameter) children: Child[]

children ?

(parameter) children: string | number | boolean | Promise<string> | JSXNode | HtmlEscapedString | null | undefined

[children] : []          

(parameter) children: string | number | true | Promise<string> | JSXNode | HtmlEscapedString

) as never } export const isValidElement =

const isValidElement: (element: unknown) => element is JSXNode

(element: unknown):

(parameter) element: unknown

element is

(parameter) element: unknown

JSXNode => {          

class JSXNode

return !!(element && typeof

(parameter) element: unknown

element === 'object' && 'tag' in

(parameter) element: {}

element && 'props' in

(parameter) element: object

element)          

(parameter) element: object & Record<"tag", unknown>

} export const cloneElement =

const cloneElement: <T extends JSXNode | JSX.Element>(element: T, props: Partial<Props>, ...children: Child[]) => T

<T extends

(type parameter) T in <T extends JSXNode | JSX.Element>(element: T, props: Partial<Props>, ...children: Child[]): T

JSXNode |

class JSXNode

JSX

namespace JSX

.Element>(          

type JSX.Element = HtmlEscapedString | Promise<HtmlEscapedString>

element:

(parameter) element: T extends JSXNode | JSX.Element

T,          

(type parameter) T in <T extends JSXNode | JSX.Element>(element: T, props: Partial<Props>, ...children: Child[]): T

props:

(parameter) props: Partial<Props>

Partial

type Partial<T> = { [P in keyof T]?: T[P] | undefined; } Make all properties in T optional

<Props>,          

type Props = { [x: string]: any; }

...children:

(parameter) children: Child[]

Child[]          

type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined

): T => {          

(type parameter) T in <T extends JSXNode | JSX.Element>(element: T, props: Partial<Props>, ...children: Child[]): T

return jsx(          

const jsx: (tag: string | Function, props: Props | null, ...children: (string | number | HtmlEscapedString)[]) => JSXNode

(element as

(parameter) element: JSXNode | JSX.Element

JSXNode)

class JSXNode

.tag,          

(property) JSXNode.tag: string | Function

{ ...(element as

(parameter) element: JSXNode | JSX.Element

JSXNode)

class JSXNode

.props, ..

(property) JSXNode.props: Props

.props },          

(parameter) props: Partial<Props>

...(children as (string | number |

(parameter) children: Child[]

HtmlEscapedString)[])          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

) as T          

(type parameter) T in <T extends JSXNode | JSX.Element>(element: T, props: Partial<Props>, ...children: Child[]): T

} export const reactAPICompatVersion = '19.0.0-hono-jsx'          

const reactAPICompatVersion: "19.0.0-hono-jsx"

src/jsx/children.test.ts
            
                import { Children } from './children'
                import { createElement } from '.'
                
                describe('map', () => {
                  it('should map children', () => {
                    const element =

const element: JSXNode

createElement('div', null, 1, 2, 3)          

(alias) createElement(tag: string | Function, props: Props | null, ...children: (string | number | HtmlEscapedString)[]): JSXNode import createElement

const result =

const result: Child[]

Children

(alias) const Children: { map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[]; forEach: (children: Child[], fn: (child: Child, index: number) => void) => void; count: (children: Child[]) => number; only: (_children: Child[]) => Child; toArray: (children: Child) => Child[]; } import Children

.map

(property) map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[]

(element

const element: JSXNode

.children,

(property) JSXNode.children: Child[]

(child) =>

(parameter) child: Child

(child as number) * 2)          

(parameter) child: Child

expect(result).toEqual([2, 4, 6])          

const result: Child[]

}) }) describe('forEach', () => { it('should iterate children', () => { const element =

const element: JSXNode

createElement('div', null, 1, 2, 3)          

(alias) createElement(tag: string | Function, props: Props | null, ...children: (string | number | HtmlEscapedString)[]): JSXNode import createElement

const result: number[] = []          

const result: number[]

Children

(alias) const Children: { map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[]; forEach: (children: Child[], fn: (child: Child, index: number) => void) => void; count: (children: Child[]) => number; only: (_children: Child[]) => Child; toArray: (children: Child) => Child[]; } import Children

.forEach

(property) forEach: (children: Child[], fn: (child: Child, index: number) => void) => void

(element

const element: JSXNode

.children,

(property) JSXNode.children: Child[]

(child) => {          

(parameter) child: Child

result

const result: number[]

.push

(method) Array<number>.push(...items: number[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(child as number)          

(parameter) child: Child

}) expect(result).toEqual([1, 2, 3])          

const result: number[]

}) }) describe('count', () => { it('should count children', () => { const element =

const element: JSXNode

createElement('div', null, 1, 2, 3)          

(alias) createElement(tag: string | Function, props: Props | null, ...children: (string | number | HtmlEscapedString)[]): JSXNode import createElement

const result =

const result: number

Children

(alias) const Children: { map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[]; forEach: (children: Child[], fn: (child: Child, index: number) => void) => void; count: (children: Child[]) => number; only: (_children: Child[]) => Child; toArray: (children: Child) => Child[]; } import Children

.count

(property) count: (children: Child[]) => number

(element

const element: JSXNode

.children)          

(property) JSXNode.children: Child[]

expect(result).toBe(3)          

const result: number

}) }) describe('only', () => { it('should return the only child', () => { const element =

const element: JSXNode

createElement('div', null, 1)          

(alias) createElement(tag: string | Function, props: Props | null, ...children: (string | number | HtmlEscapedString)[]): JSXNode import createElement

const result =

const result: Child

Children

(alias) const Children: { map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[]; forEach: (children: Child[], fn: (child: Child, index: number) => void) => void; count: (children: Child[]) => number; only: (_children: Child[]) => Child; toArray: (children: Child) => Child[]; } import Children

.only

(property) only: (_children: Child[]) => Child

(element

const element: JSXNode

.children)          

(property) JSXNode.children: Child[]

expect(result).toBe(1)          

const result: Child

}) it('should throw an error if there are multiple children', () => { const element =

const element: JSXNode

createElement('div', null, 1, 2)          

(alias) createElement(tag: string | Function, props: Props | null, ...children: (string | number | HtmlEscapedString)[]): JSXNode import createElement

expect(() => Children

(alias) const Children: { map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[]; forEach: (children: Child[], fn: (child: Child, index: number) => void) => void; count: (children: Child[]) => number; only: (_children: Child[]) => Child; toArray: (children: Child) => Child[]; } import Children

.only

(property) only: (_children: Child[]) => Child

(element

const element: JSXNode

.children)).toThrowError(          

(property) JSXNode.children: Child[]

'Children.only() expects only one child' ) }) }) describe('toArray', () => { it('should convert children to an array', () => { const element =

const element: JSXNode

createElement('div', null, 1, 2, 3)          

(alias) createElement(tag: string | Function, props: Props | null, ...children: (string | number | HtmlEscapedString)[]): JSXNode import createElement

const result =

const result: Child[]

Children

(alias) const Children: { map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[]; forEach: (children: Child[], fn: (child: Child, index: number) => void) => void; count: (children: Child[]) => number; only: (_children: Child[]) => Child; toArray: (children: Child) => Child[]; } import Children

.toArray

(property) toArray: (children: Child) => Child[]

(element

const element: JSXNode

.children)          

(property) JSXNode.children: Child[]

expect(result).toEqual([1, 2, 3])          

const result: Child[]

}) })
src/jsx/children.ts
            
                import type { Child } from './base'
                
                export const toArray = 

const toArray: (children: Child) => Child[]

(children:

(parameter) children: Child

Child):

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

Child[] =>          

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(children) ?

(parameter) children: Child

children :

(parameter) children: Child[]

[children]          

(parameter) children: string | number | boolean | Promise<string> | JSXNode | null | undefined

export const Children = {          

const Children: { map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[]; forEach: (children: Child[], fn: (child: Child, index: number) => void) => void; count: (children: Child[]) => number; only: (_children: Child[]) => Child; toArray: (children: Child) => Child[]; }

map:

(property) map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[]

(children:

(parameter) children: Child[]

Child[],

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

fn:

(parameter) fn: (child: Child, index: number) => Child

(child:

(parameter) child: Child

Child,

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

index: number) =>

(parameter) index: number

Child):

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

Child[] =>          

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

toArray

const toArray: (children: Child) => Child[]

(children)

(parameter) children: Child[]

.map

(method) Array<Child>.map<Child>(callbackfn: (value: Child, index: number, array: Child[]) => Child, thisArg?: any): Child[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(fn),          

(parameter) fn: (child: Child, index: number) => Child

forEach:

(property) forEach: (children: Child[], fn: (child: Child, index: number) => void) => void

(children:

(parameter) children: Child[]

Child[],

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

fn:

(parameter) fn: (child: Child, index: number) => void

(child:

(parameter) child: Child

Child,

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

index: number) => void): void => {          

(parameter) index: number

toArray

const toArray: (children: Child) => Child[]

(children)

(parameter) children: Child[]

.forEach

(method) Array<Child>.forEach(callbackfn: (value: Child, index: number, array: Child[]) => void, thisArg?: any): void Performs the specified action for each element in an array.

@param callbackfn — A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(fn)          

(parameter) fn: (child: Child, index: number) => void

}, count:

(property) count: (children: Child[]) => number

(children:

(parameter) children: Child[]

Child[]): number =>

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

toArray

const toArray: (children: Child) => Child[]

(children)

(parameter) children: Child[]

.length,          

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

only:

(property) only: (_children: Child[]) => Child

(_children:

(parameter) _children: Child[]

Child[]):

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

Child => {          

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

const children =

const children: Child[]

toArray

const toArray: (children: Child) => Child[]

(_children)          

(parameter) _children: Child[]

if (children

const children: Child[]

.length !== 1) {          

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

throw new Error('Children.only() expects only one child')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

} return children[0]          

const children: Child[]

}, toArray,          

(property) toArray: (children: Child) => Child[]

}
src/jsx/components.ts
            
                import { raw } from '../helper/html'
                import type { HtmlEscapedCallback, HtmlEscapedString } from '../utils/html'
                import { HtmlEscapedCallbackPhase, resolveCallback } from '../utils/html'
                import { DOM_RENDERER } from './constants'
                import { ErrorBoundary as ErrorBoundaryDomRenderer } from './dom/components'
                import type { HasRenderToDom } from './dom/render'
                import type { Child, FC, PropsWithChildren } from './'
                
                let errorBoundaryCounter = 0          

let errorBoundaryCounter: number

export const childrenToString = async

const childrenToString: (children: Child[]) => Promise<HtmlEscapedString[]>

(children:

(parameter) children: Child[]

Child[]):

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<HtmlEscapedString[]> => {          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

try { return children          

(parameter) children: Child[]

.flat()          

(method) Array<Child>.flat<Child[], 1>(this: Child[], depth?: 1 | undefined): Child[] Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

@param depth — The maximum recursion depth

.map(

(method) Array<Child>.map<string | Promise<string>>(callbackfn: (value: Child, index: number, array: Child[]) => string | Promise<string>, thisArg?: any): (string | Promise<...>)[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(c) =>

(parameter) c: Child

(c == null || typeof

(parameter) c: Child

c === 'boolean' ? '' :

(parameter) c: string | number | boolean | Promise<string> | JSXNode | Child[]

c

(parameter) c: string | number | Promise<string> | JSXNode | Child[]

.toString())) as

(method) toString(): string | Promise<string> (+1 overload) Returns a string representation of a string.

HtmlEscapedString[]          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

} catch (e) {          

(local var) e: unknown

if (e instanceof

(local var) e: unknown

Promise) {          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

await e          

(local var) e: Promise<any>

return childrenToString

const childrenToString: (children: Child[]) => Promise<HtmlEscapedString[]>

(children)          

(parameter) children: Child[]

} else { throw e          

(local var) e: unknown

} } } export type ErrorHandler =

type ErrorHandler = (error: Error) => void

(error:

(parameter) error: Error

Error) => void          

interface Error

export type FallbackRender =

type FallbackRender = (error: Error) => Child

(error:

(parameter) error: Error

Error) =>

interface Error

Child          

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

/** * @experimental * `ErrorBoundary` is an experimental feature. * The API might be changed. */ export const ErrorBoundary:

const ErrorBoundary: FC<PropsWithChildren<{ fallback?: Child; fallbackRender?: FallbackRender; onError?: ErrorHandler; }>>

@experimental
ErrorBoundary is an experimental feature. The API might be changed.

FC<          

(alias) type FC<P = Props> = { (props: P): HtmlEscapedString | Promise<HtmlEscapedString> | null; defaultProps?: Partial<P> | undefined; displayName?: string | undefined; } import FC

PropsWithChildren<{          

(alias) type PropsWithChildren<P = unknown> = P & { children?: Child | undefined; } import PropsWithChildren

fallback?:

(property) fallback?: Child

Child          

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

fallbackRender?:

(property) fallbackRender?: FallbackRender | undefined

FallbackRender          

type FallbackRender = (error: Error) => Child

onError?:

(property) onError?: ErrorHandler | undefined

ErrorHandler          

type ErrorHandler = (error: Error) => void

}> > = async ({ children,

(parameter) children: Child

fallback,

(parameter) fallback: Child

fallbackRender,

(parameter) fallbackRender: FallbackRender | undefined

onError }) => {          

(parameter) onError: ErrorHandler | undefined

if (!children) {          

(parameter) children: Child

return raw('')          

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

} if (!Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(children)) {          

(parameter) children: string | number | true | Promise<string> | JSXNode | Child[]

children =

(parameter) children: Child

[children]          

(parameter) children: string | number | true | Promise<string> | JSXNode

} let fallbackStr: string | undefined          

let fallbackStr: string | undefined

const fallbackRes =

const fallbackRes: (error: Error) => HtmlEscapedString

(error:

(parameter) error: Error

Error):

interface Error

HtmlEscapedString => {          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

onError?.

(parameter) onError: ErrorHandler | undefined

(error)          

(parameter) error: Error

return (fallbackStr ||

let fallbackStr: string | undefined

fallbackRender?.

(parameter) fallbackRender: FallbackRender | undefined

(error) || '')

(parameter) error: Error

.toString() as

(method) toString(): string | Promise<string> (+1 overload) Returns a string representation of a string.

HtmlEscapedString          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

} let resArray:

let resArray: HtmlEscapedString[] | Promise<HtmlEscapedString[]>[]

HtmlEscapedString[] |

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<HtmlEscapedString[]>[] = []          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

try { resArray =

let resArray: HtmlEscapedString[] | Promise<HtmlEscapedString[]>[]

children

(parameter) children: Child[]

.map(

(method) Array<Child>.map<string | Promise<string>>(callbackfn: (value: Child, index: number, array: Child[]) => string | Promise<string>, thisArg?: any): (string | Promise<...>)[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(c) =>          

(parameter) c: Child

c == null || typeof

(parameter) c: Child

c === 'boolean' ? '' :

(parameter) c: string | number | boolean | Promise<string> | JSXNode | Child[]

c

(parameter) c: string | number | Promise<string> | JSXNode | Child[]

.toString()          

(method) toString(): string | Promise<string> (+1 overload) Returns a string representation of a string.

) as HtmlEscapedString[]          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

} catch (e) {          

(local var) e: unknown

fallbackStr = await

let fallbackStr: string | undefined

fallback?

(parameter) fallback: Child

.toString()          

(method) toString(): string | Promise<string> (+1 overload) Returns a string representation of a string.

if (e instanceof

(local var) e: unknown

Promise) {          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

resArray = [          

let resArray: HtmlEscapedString[] | Promise<HtmlEscapedString[]>[]

e

(local var) e: Promise<any>

.then(() =>

(method) Promise<any>.then<HtmlEscapedString[], never>(onfulfilled?: ((value: any) => HtmlEscapedString[] | PromiseLike<HtmlEscapedString[]>) | null | undefined, onrejected?: ((reason: any) => PromiseLike<...>) | ... 1 more ... | undefined): Promise<...> Attaches callbacks for the resolution and/or rejection of the Promise.

@param onfulfilled — The callback to execute when the Promise is resolved.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of which ever callback is executed.

childrenToString

const childrenToString: (children: Child[]) => Promise<HtmlEscapedString[]>

(children as

(parameter) children: Child[]

Child[]))

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

.catch(

(method) Promise<HtmlEscapedString[]>.catch<HtmlEscapedString>(onrejected?: ((reason: any) => HtmlEscapedString | PromiseLike<HtmlEscapedString>) | null | undefined): Promise<...> Attaches a callback for only the rejection of the Promise.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of the callback.

(e) =>

(parameter) e: any

fallbackRes

const fallbackRes: (error: Error) => HtmlEscapedString

(e)),          

(parameter) e: any

] as Promise

interface Promise<T> Represents the completion of an asynchronous operation

<HtmlEscapedString[]>[]          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

} else { resArray =

let resArray: HtmlEscapedString[] | Promise<HtmlEscapedString[]>[]

[fallbackRes

const fallbackRes: (error: Error) => HtmlEscapedString

(e as

(local var) e: unknown

Error)]          

interface Error

} } if (resArray

let resArray: HtmlEscapedString[] | Promise<HtmlEscapedString[]>[]

.some(

(method) Array<T>.some(predicate: ((value: HtmlEscapedString, index: number, array: HtmlEscapedString[]) => unknown) & ((value: Promise<HtmlEscapedString[]>, index: number, array: Promise<...>[]) => unknown), thisArg?: any): boolean Determines whether the specified callback function returns true for any element of an array.

@param predicate
A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

@param thisArg
An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

(res) =>

(parameter) res: HtmlEscapedString | Promise<HtmlEscapedString[]>

(res as {}) instanceof

(parameter) res: HtmlEscapedString | Promise<HtmlEscapedString[]>

Promise)) {          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

fallbackStr ||= await

let fallbackStr: string | undefined

fallback?

(parameter) fallback: Child

.toString()          

(method) toString(): string | Promise<string> (+1 overload) Returns a string representation of a string.

const index =

const index: number

errorBoundaryCounter++          

let errorBoundaryCounter: number

const replaceRe =

const replaceRe: RegExp

RegExp(`(.*?)(.*?)()`)          

const index: number

const caught = false          

const caught: false

const catchCallback = ({

const catchCallback: ({ error, buffer }: { error: Error; buffer?: [string]; }) => string

error,

(parameter) error: Error

buffer }: {

(parameter) buffer: [string] | undefined

error:

(property) error: Error

Error;

interface Error

buffer?: [string] }) => {          

(property) buffer?: [string] | undefined

if (caught) {          

const caught: false

return '' } const fallbackResString =

const fallbackResString: HtmlEscapedString

fallbackRes

const fallbackRes: (error: Error) => HtmlEscapedString

(error)          

(parameter) error: Error

if (buffer) {          

(parameter) buffer: [string] | undefined

buffer[0] =

(parameter) buffer: [string]

buffer[0]

(parameter) buffer: [string]

.replace

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

(replaceRe,

const replaceRe: RegExp

fallbackResString)          

const fallbackResString: HtmlEscapedString

} return buffer          

(parameter) buffer: [string] | undefined

? '' : `` } let error: unknown          

let error: unknown

const promiseAll =

const promiseAll: Promise<any>

Promise

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

.all

(method) PromiseConstructor.all<HtmlEscapedString[] | Promise<HtmlEscapedString[]>[]>(values: HtmlEscapedString[] | Promise<HtmlEscapedString[]>[]): Promise<...> (+1 overload) Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

@param values — An array of Promises.

@returns — A new Promise.

(resArray)

let resArray: HtmlEscapedString[] | Promise<HtmlEscapedString[]>[]

.catch(

(method) Promise<HtmlEscapedString[] | HtmlEscapedString[][]>.catch<any>(onrejected?: ((reason: any) => any) | null | undefined): Promise<any> Attaches a callback for only the rejection of the Promise.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of the callback.

(e) =>

(parameter) e: any

(error =

let error: unknown

e))          

(parameter) e: any

return raw(``, [          

const index: number

({ phase,

(parameter) phase: 2 | 1 | 3

buffer,

(parameter) buffer: [string] | undefined

context }) => {          

(parameter) context: object

if (phase ===

(parameter) phase: 2 | 1 | 3

HtmlEscapedCallbackPhase

(alias) const HtmlEscapedCallbackPhase: { readonly Stringify: 1; readonly BeforeStream: 2; readonly Stream: 3; } import HtmlEscapedCallbackPhase

@module — HTML utility.

.BeforeStream) {          

(property) BeforeStream: 2

return } return promiseAll          

const promiseAll: Promise<any>

.then(async

(method) Promise<any>.then<string, never>(onfulfilled?: ((value: any) => string | PromiseLike<string>) | null | undefined, onrejected?: ((reason: any) => PromiseLike<never>) | null | undefined): Promise<...> Attaches callbacks for the resolution and/or rejection of the Promise.

@param onfulfilled — The callback to execute when the Promise is resolved.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of which ever callback is executed.

(htmlArray:

(parameter) htmlArray: HtmlEscapedString[]

HtmlEscapedString[]) => {          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

if (error) {          

let error: unknown

throw error          

let error: {}

} htmlArray =

(parameter) htmlArray: HtmlEscapedString[]

htmlArray

(parameter) htmlArray: HtmlEscapedString[]

.flat()          

(method) Array<HtmlEscapedString>.flat<HtmlEscapedString[], 1>(this: HtmlEscapedString[], depth?: 1 | undefined): HtmlEscapedString[] Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

@param depth — The maximum recursion depth

const content =

const content: string

htmlArray

(parameter) htmlArray: HtmlEscapedString[]

.join('')          

(method) Array<HtmlEscapedString>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

let html =

let html: string

buffer          

(parameter) buffer: [string] | undefined

? '' : `` if (htmlArray

(parameter) htmlArray: HtmlEscapedString[]

.every(

(method) Array<HtmlEscapedString>.every(predicate: (value: HtmlEscapedString, index: number, array: HtmlEscapedString[]) => unknown, thisArg?: any): boolean (+1 overload) Determines whether all the members of an array satisfy the specified test.

@param predicate
A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

@param thisArg
An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

(html) => !

(parameter) html: HtmlEscapedString

(html as

(parameter) html: HtmlEscapedString

HtmlEscapedString)

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

.callbacks?

(property) callbacks?: HtmlEscapedCallback[] | undefined

.length)) {          

(property) Array<T>.length: number | undefined Gets or sets the length of the array. This is a number one higher than the highest index in the array.

if (buffer) {          

(parameter) buffer: [string] | undefined

buffer[0] =

(parameter) buffer: [string]

buffer[0]

(parameter) buffer: [string]

.replace

(method) String.replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string (+3 overloads) Passes a string and replaceValue to the [Symbol.replace] method on searchValue. This method is expected to implement its own replacement algorithm.

@param searchValue — An object that supports searching for and replacing matches within a string.

@param replaceValue — The replacement text.

(replaceRe,

const replaceRe: RegExp

content)          

const content: string

} return html          

let html: string

} if (buffer) {          

(parameter) buffer: [string] | undefined

buffer[0] =

(parameter) buffer: [string]

buffer[0]

(parameter) buffer: [string]

.replace(          

(method) String.replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string (+3 overloads) Replaces text in a string, using an object that supports replacement within a string.

@param searchValue — A object can search for and replace matches within a string.

@param replacer — A function that returns the replacement text.

replaceRe,          

const replaceRe: RegExp

(_all,

(parameter) _all: string

pre,

(parameter) pre: any

_,

(parameter) _: any

post) => `$

(parameter) post: any

{pre}$

(parameter) pre: any

{content}$

const content: string

{post}`          

(parameter) post: any

) } const callbacks =

const callbacks: HtmlEscapedCallback[]

htmlArray          

(parameter) htmlArray: HtmlEscapedString[]

.map(

(method) Array<HtmlEscapedString>.map<HtmlEscapedCallback[]>(callbackfn: (value: HtmlEscapedString, index: number, array: HtmlEscapedString[]) => HtmlEscapedCallback[], thisArg?: any): HtmlEscapedCallback[][] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

(html) =>

(parameter) html: HtmlEscapedString

(html as

(parameter) html: HtmlEscapedString

HtmlEscapedString)

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

.callbacks || [])          

(property) callbacks?: HtmlEscapedCallback[] | undefined

.flat()          

(method) Array<HtmlEscapedCallback[]>.flat<HtmlEscapedCallback[][], 1>(this: HtmlEscapedCallback[][], depth?: 1 | undefined): HtmlEscapedCallback[] Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

@param depth — The maximum recursion depth

if (phase ===

(parameter) phase: 1 | 3

HtmlEscapedCallbackPhase

(alias) const HtmlEscapedCallbackPhase: { readonly Stringify: 1; readonly BeforeStream: 2; readonly Stream: 3; } import HtmlEscapedCallbackPhase

@module — HTML utility.

.Stream) {          

(property) Stream: 3

html = await

let html: string

resolveCallback(          

(alias) resolveCallback(str: string | HtmlEscapedString | Promise<string>, phase: (typeof HtmlEscapedCallbackPhase)[keyof typeof HtmlEscapedCallbackPhase], preserveCallbacks: boolean, context: object, buffer?: [string]): Promise<string> import resolveCallback

html,          

let html: string

HtmlEscapedCallbackPhase

(alias) const HtmlEscapedCallbackPhase: { readonly Stringify: 1; readonly BeforeStream: 2; readonly Stream: 3; } import HtmlEscapedCallbackPhase

@module — HTML utility.

.BeforeStream,          

(property) BeforeStream: 2

true, context          

(parameter) context: object

) } let resolvedCount = 0          

let resolvedCount: number

const promises =

const promises: HtmlEscapedCallback[]

callbacks

const callbacks: HtmlEscapedCallback[]

.map

(method) Array<HtmlEscapedCallback>.map<HtmlEscapedCallback>(callbackfn: (value: HtmlEscapedCallback, index: number, array: HtmlEscapedCallback[]) => HtmlEscapedCallback, thisArg?: any): HtmlEscapedCallback[] Calls a defined callback function on each element of an array, and returns an array that contains the results.

@param callbackfn — A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

@param thisArg — An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

<HtmlEscapedCallback>(          

(alias) type HtmlEscapedCallback = (opts: HtmlEscapedCallbackOpts) => Promise<string> | undefined import HtmlEscapedCallback

(c) =>          

(parameter) c: HtmlEscapedCallback

(...args) =>          

(parameter) args: [opts: HtmlEscapedCallbackOpts]

c(..

(parameter) c: (opts: HtmlEscapedCallbackOpts) => Promise<string> | undefined

.args)          

(parameter) args: [opts: HtmlEscapedCallbackOpts]

?.then(

(method) Promise<string>.then<TResult1, TResult2>(onfulfilled?: ((value: string) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined): Promise<...> Attaches callbacks for the resolution and/or rejection of the Promise.

@param onfulfilled — The callback to execute when the Promise is resolved.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of which ever callback is executed.

(content) => {          

(parameter) content: string

resolvedCount++          

let resolvedCount: number

if (buffer) {          

(parameter) buffer: [string] | undefined

if (resolvedCount ===

let resolvedCount: number

callbacks

const callbacks: HtmlEscapedCallback[]

.length) {          

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

buffer[0] =

(parameter) buffer: [string]

buffer[0]

(parameter) buffer: [string]

.replace

(method) String.replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string (+3 overloads) Replaces text in a string, using an object that supports replacement within a string.

@param searchValue — A object can search for and replace matches within a string.

@param replacer — A function that returns the replacement text.

(replaceRe,

const replaceRe: RegExp

(_all,

(parameter) _all: string

_pre,

(parameter) _pre: any

content) =>

(parameter) content: any

content)          

(parameter) content: any

} buffer[0] +=

(parameter) buffer: [string]

content          

(parameter) content: string

return raw('',

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

(content as

(parameter) content: string

HtmlEscapedString)

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

.callbacks)          

(property) callbacks?: HtmlEscapedCallback[] | undefined

} return raw(          

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

content +          

(parameter) content: string

(resolvedCount !==

let resolvedCount: number

callbacks

const callbacks: HtmlEscapedCallback[]

.length          

(property) Array<T>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

? '' : ``), (content as

(parameter) content: string

HtmlEscapedString)

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

.callbacks          

(property) callbacks?: HtmlEscapedCallback[] | undefined

) }) .catch(

(method) Promise<HtmlEscapedString>.catch<TResult>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<HtmlEscapedString | TResult> Attaches a callback for only the rejection of the Promise.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of the callback.

(error) =>

(parameter) error: any

catchCallback({

const catchCallback: ({ error, buffer }: { error: Error; buffer?: [string]; }) => string

error,

(property) error: Error

buffer }))          

(property) buffer?: [string] | undefined

) // eslint-disable-next-line @typescript-eslint/no-explicit-any return raw

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

(html,

let html: string

promises as any)          

const promises: HtmlEscapedCallback[]

}) .catch(

(method) Promise<string>.catch<string>(onrejected?: ((reason: any) => string | PromiseLike<string>) | null | undefined): Promise<string> Attaches a callback for only the rejection of the Promise.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of the callback.

(error) =>

(parameter) error: any

catchCallback({

const catchCallback: ({ error, buffer }: { error: Error; buffer?: [string]; }) => string

error,

(property) error: Error

buffer }))          

(property) buffer?: [string] | undefined

}, ]) } else { return raw

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

(resArray

let resArray: HtmlEscapedString[] | Promise<HtmlEscapedString[]>[]

.join(''))          

(method) Array<T>.join(separator?: string): string Adds all the elements of an array into a string, separated by the specified separator string.

@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

} } ;(ErrorBoundary as

const ErrorBoundary: FC<PropsWithChildren<{ fallback?: Child; fallbackRender?: FallbackRender; onError?: ErrorHandler; }>>

@experimental
ErrorBoundary is an experimental feature. The API might be changed.

HasRenderToDom)

(alias) type HasRenderToDom = FC<any> & { [DOM_RENDERER]: FC<any>; } import HasRenderToDom

[DOM_RENDERER] =

(alias) const DOM_RENDERER: typeof DOM_RENDERER import DOM_RENDERER

ErrorBoundaryDomRenderer          

(alias) const ErrorBoundaryDomRenderer: FC<PropsWithChildren<{ fallback?: Child; fallbackRender?: FallbackRender; onError?: ErrorHandler; }>> import ErrorBoundaryDomRenderer

src/jsx/constants.ts
            
                export const DOM_RENDERER =

const DOM_RENDERER: typeof DOM_RENDERER

Symbol('RENDERER')          

var Symbol: SymbolConstructor (description?: string | number) => symbol Returns a new unique Symbol value.

@param description — Description of the new Symbol object.

export const DOM_ERROR_HANDLER =

const DOM_ERROR_HANDLER: typeof DOM_ERROR_HANDLER

Symbol('ERROR_HANDLER')          

var Symbol: SymbolConstructor (description?: string | number) => symbol Returns a new unique Symbol value.

@param description — Description of the new Symbol object.

export const DOM_STASH =

const DOM_STASH: typeof DOM_STASH

Symbol('STASH')          

var Symbol: SymbolConstructor (description?: string | number) => symbol Returns a new unique Symbol value.

@param description — Description of the new Symbol object.

export const DOM_INTERNAL_TAG =

const DOM_INTERNAL_TAG: typeof DOM_INTERNAL_TAG

Symbol('INTERNAL')          

var Symbol: SymbolConstructor (description?: string | number) => symbol Returns a new unique Symbol value.

@param description — Description of the new Symbol object.

export const PERMALINK =

const PERMALINK: typeof PERMALINK

Symbol('PERMALINK')          

var Symbol: SymbolConstructor (description?: string | number) => symbol Returns a new unique Symbol value.

@param description — Description of the new Symbol object.

src/jsx/context.ts
            
                import { raw } from '../helper/html'
                import type { HtmlEscapedString } from '../utils/html'
                import { JSXFragmentNode } from './base'
                import { DOM_RENDERER } from './constants'
                import { createContextProviderFunction } from './dom/context'
                import type { FC, PropsWithChildren } from './'
                
                export interface Context

interface Context<T>

<T> extends

(type parameter) T in Context<T>

FC

(alias) type FC<P = Props> = { (props: P): HtmlEscapedString | Promise<HtmlEscapedString> | null; defaultProps?: Partial<P> | undefined; displayName?: string | undefined; } import FC

<PropsWithChildren<{

(alias) type PropsWithChildren<P = unknown> = P & { children?: Child | undefined; } import PropsWithChildren

value:

(property) value: T

T }>> {          

(type parameter) T in Context<T>

values:

(property) Context<T>.values: T[]

T[]          

(type parameter) T in Context<T>

Provider:

(property) Context<T>.Provider: FC<PropsWithChildren<{ value: T; }>>

FC

(alias) type FC<P = Props> = { (props: P): HtmlEscapedString | Promise<HtmlEscapedString> | null; defaultProps?: Partial<P> | undefined; displayName?: string | undefined; } import FC

<PropsWithChildren<{

(alias) type PropsWithChildren<P = unknown> = P & { children?: Child | undefined; } import PropsWithChildren

value:

(property) value: T

T }>>          

(type parameter) T in Context<T>

} export const globalContexts:

const globalContexts: Context<unknown>[]

Context[] = []          

interface Context<T>

export const createContext =

const createContext: <T>(defaultValue: T) => Context<T>

<T>

(type parameter) T in <T>(defaultValue: T): Context<T>

(defaultValue:

(parameter) defaultValue: T

T):

(type parameter) T in <T>(defaultValue: T): Context<T>

Context

interface Context<T>

<T> => {          

(type parameter) T in <T>(defaultValue: T): Context<T>

const values =

const values: T[]

[defaultValue]          

(parameter) defaultValue: T

const context:

const context: Context<T>

Context

interface Context<T>

<T> = (

(type parameter) T in <T>(defaultValue: T): Context<T>

(props):

(parameter) props: PropsWithChildren<{ value: T; }>

HtmlEscapedString |

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

Promise

interface Promise<T> Represents the completion of an asynchronous operation

<HtmlEscapedString> => {          

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

values

const values: T[]

.push

(method) Array<T>.push(...items: T[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(props

(parameter) props: PropsWithChildren<{ value: T; }>

.value)          

(property) value: T

let string          

let string: any

try { string =

let string: any

props

(parameter) props: PropsWithChildren<{ value: T; }>

.children          

(property) children?: Child

? (Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(props

(parameter) props: PropsWithChildren<{ value: T; }>

.children)          

(property) children?: string | number | true | Promise<string> | JSXNode | Child[]

? new JSXFragmentNode('', {},

(alias) new JSXFragmentNode(tag: string | Function, props: Props, children: Child[]): JSXFragmentNode import JSXFragmentNode

props

(parameter) props: PropsWithChildren<{ value: T; }>

.children)          

(property) children?: Child[]

: props

(parameter) props: PropsWithChildren<{ value: T; }>

.children          

(property) children?: string | number | true | Promise<string> | JSXNode

).toString()          

(method) toString(): string | Promise<string> (+1 overload) Returns a string representation of a string.

: '' } finally { values

const values: T[]

.pop()          

(method) Array<T>.pop(): T | undefined Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

} if (string instanceof

let string: string | Promise<string>

Promise) {          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

return string

let string: Promise<string>

.then(

(method) Promise<string>.then<HtmlEscapedString, HtmlEscapedString>(onfulfilled?: ((value: string) => HtmlEscapedString | PromiseLike<HtmlEscapedString>) | null | undefined, onrejected?: ((reason: any) => HtmlEscapedString | PromiseLike<...>) | ... 1 more ... | undefined): Promise<...> Attaches callbacks for the resolution and/or rejection of the Promise.

@param onfulfilled — The callback to execute when the Promise is resolved.

@param onrejected — The callback to execute when the Promise is rejected.

@returns — A Promise for the completion of which ever callback is executed.

(resString) =>

(parameter) resString: string

raw

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

(resString,

(parameter) resString: string

(resString as

(parameter) resString: string

HtmlEscapedString)

(alias) type HtmlEscapedString = string & HtmlEscaped import HtmlEscapedString

.callbacks))          

(property) callbacks?: HtmlEscapedCallback[] | undefined

} else { return raw

(alias) raw(value: unknown, callbacks?: HtmlEscapedCallback[]): HtmlEscapedString import raw

(string)          

let string: string

} }) as Context

interface Context<T>

<T>          

(type parameter) T in <T>(defaultValue: T): Context<T>

context

const context: Context<T>

.values =

(property) Context<T>.values: T[]

values          

const values: T[]

context

const context: Context<T>

.Provider =

(property) Context<T>.Provider: FC<PropsWithChildren<{ value: T; }>>

context          

const context: Context<T>

// eslint-disable-next-line @typescript-eslint/no-explicit-any ;(context as any)

const context: Context<T>

[DOM_RENDERER] =

(alias) const DOM_RENDERER: typeof DOM_RENDERER import DOM_RENDERER

createContextProviderFunction

(alias) createContextProviderFunction<T>(values: T[]): Function import createContextProviderFunction

(values)          

const values: T[]

globalContexts

const globalContexts: Context<unknown>[]

.push

(method) Array<Context<unknown>>.push(...items: Context<unknown>[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(context as

const context: Context<T>

Context)          

interface Context<T>

return context          

const context: Context<T>

} export const useContext =

const useContext: <T>(context: Context<T>) => T

<T>

(type parameter) T in <T>(context: Context<T>): T

(context:

(parameter) context: Context<T>

Context

interface Context<T>

<T>):

(type parameter) T in <T>(context: Context<T>): T

T => {          

(type parameter) T in <T>(context: Context<T>): T

return context

(parameter) context: Context<T>

.values

(property) Context<T>.values: T[]

.at(-1) as

(method) Array<T>.at(index: number): T | undefined Returns the item located at the specified index.

@param index — The zero-based index of the desired code unit. A negative index will count back from the last item.

T          

(type parameter) T in <T>(context: Context<T>): T

}
src/jsx/dom/client.ts
            
                /**
                 * @module
                 * This module provides APIs for `hono/jsx/dom/client`, which is compatible with `react-dom/client`.
                 */
                
                import type { Child } from '../base'
                import { useState } from '../hooks'
                import { buildNode, renderNode } from './render'
                import type { NodeObject } from './render'
                
                export interface Root {          

interface Root

render

(method) Root.render(children: Child): void

(children:

(parameter) children: Child

Child): void          

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

unmount(): void          

(method) Root.unmount(): void

} export type RootOptions =

type RootOptions = { [x: string]: unknown; }

Record          

type Record<K extends keyof any, T> = { [P in K]: T; } Construct a type with a set of properties K of type T

/** * Create a root object for rendering * @param element Render target * @param options Options for createRoot (not supported yet) * @returns Root object has `render` and `unmount` methods */ export const createRoot = (          

const createRoot: (element: HTMLElement | DocumentFragment, options?: RootOptions) => Root Create a root object for rendering

@param element — Render target

@param options — Options for createRoot (not supported yet)

@returns — Root object has render and unmount methods

element:

(parameter) element: HTMLElement | DocumentFragment Render target

@param element — Render target

HTMLElement |

interface HTMLElement Any HTML element. Some elements directly implement this interface, while others implement it via an interface that inherits it.

MDN Reference

DocumentFragment,          

interface DocumentFragment A minimal document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document. The key difference is that because the document fragment isn't part of the active document tree structure, changes made to the fragment don't affect the document, cause reflow, or incur any performance impact that can occur when changes are made.

MDN Reference

options:

(parameter) options: RootOptions Options for createRoot (not supported yet)

@param options — Options for createRoot (not supported yet)

RootOptions = {}          

type RootOptions = { [x: string]: unknown; }

): Root => {          

interface Root

let setJsxNode:          

let setJsxNode: ((jsxNode: unknown) => void) | null | undefined

| undefined // initial state | ((jsxNode: unknown) => void) // rendered          

(parameter) jsxNode: unknown

| null = // unmounted undefined if (Object

var Object: ObjectConstructor Provides functionality common to all JavaScript objects.

.keys

(method) ObjectConstructor.keys(o: {}): string[] (+1 overload) Returns the names of the enumerable string properties and methods of an object.

@param o — Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.

(options)

(parameter) options: RootOptions Options for createRoot (not supported yet)

@param options — Options for createRoot (not supported yet)

.length > 0) {          

(property) Array<string>.length: number Gets or sets the length of the array. This is a number one higher than the highest index in the array.

console

var console: Console

.warn('createRoot options are not supported yet')          

(method) Console.warn(...data: any[]): void MDN Reference

} return { render

(method) Root.render(children: Child): void

(jsxNode: unknown) {          

(parameter) jsxNode: unknown

if (setJsxNode === null) {          

let setJsxNode: ((jsxNode: unknown) => void) | null | undefined

// unmounted throw new Error('Cannot update an unmounted root')          

var Error: ErrorConstructor new (message?: string, options?: ErrorOptions) => Error (+1 overload)

} if (setJsxNode) {          

let setJsxNode: ((jsxNode: unknown) => void) | undefined

// rendered setJsxNode

let setJsxNode: (jsxNode: unknown) => void

(jsxNode)          

(parameter) jsxNode: unknown

} else { renderNode(          

(alias) renderNode(node: NodeObject, container: Container): void import renderNode

buildNode({          

(alias) buildNode(node: Child): Node | undefined import buildNode

tag: () => {          

(property) tag: () => unknown

const [_jsxNode,

const _jsxNode: unknown

_setJsxNode] =

const _setJsxNode: UpdateStateFunction<unknown>

useState

(alias) useState<unknown>(initialState: unknown): [unknown, UpdateStateFunction<unknown>] (+1 overload) import useState

(jsxNode)          

(parameter) jsxNode: unknown

setJsxNode =

let setJsxNode: ((jsxNode: unknown) => void) | null | undefined

_setJsxNode          

const _setJsxNode: UpdateStateFunction<unknown>

return _jsxNode          

const _jsxNode: unknown

}, props: {},          

(property) props: {}

// eslint-disable-next-line @typescript-eslint/no-explicit-any } as any) as NodeObject,          

(alias) type NodeObject = { pP: Props | undefined; nN: Node | undefined; vC: Node[]; pC?: Node[]; vR: Node[]; n?: string; f?: boolean; s?: boolean; c: Container | undefined; e: SupportedElement | Text | undefined; p?: PreserveNodeType; a?: boolean; [DOM_STASH]: [number, any[][], LocalJSXContexts, [Context, Function, NodeObject]] | [number, any[][]]; } & JSXNode import NodeObject

element          

(parameter) element: HTMLElement | DocumentFragment Render target

@param element — Render target

) } }, unmount() {          

(method) Root.unmount(): void

setJsxNode?.(null)          

let setJsxNode: ((jsxNode: unknown) => void) | null | undefined

setJsxNode = null          

let setJsxNode: ((jsxNode: unknown) => void) | null | undefined

}, } } /** * Create a root object and hydrate app to the target element. * In hono/jsx/dom, hydrate is equivalent to render. * @param element Render target * @param reactNode A JSXNode to render * @param options Options for createRoot (not supported yet) * @returns Root object has `render` and `unmount` methods */ export const hydrateRoot = (          

const hydrateRoot: (element: HTMLElement | DocumentFragment, reactNode: Child, options?: RootOptions) => Root Create a root object and hydrate app to the target element. In hono/jsx/dom, hydrate is equivalent to render.

@param element — Render target

@param reactNode — A JSXNode to render

@param options — Options for createRoot (not supported yet)

@returns — Root object has render and unmount methods

element:

(parameter) element: HTMLElement | DocumentFragment Render target

@param element — Render target

HTMLElement |

interface HTMLElement Any HTML element. Some elements directly implement this interface, while others implement it via an interface that inherits it.

MDN Reference

DocumentFragment,          

interface DocumentFragment A minimal document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document. The key difference is that because the document fragment isn't part of the active document tree structure, changes made to the fragment don't affect the document, cause reflow, or incur any performance impact that can occur when changes are made.

MDN Reference

reactNode:

(parameter) reactNode: Child A JSXNode to render

@param reactNode — A JSXNode to render

Child,          

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

options:

(parameter) options: RootOptions Options for createRoot (not supported yet)

@param options — Options for createRoot (not supported yet)

RootOptions = {}          

type RootOptions = { [x: string]: unknown; }

): Root => {          

interface Root

const root =

const root: Root

createRoot

const createRoot: (element: HTMLElement | DocumentFragment, options?: RootOptions) => Root Create a root object for rendering

@param element — Render target

@param options — Options for createRoot (not supported yet)

@returns — Root object has render and unmount methods

(element,

(parameter) element: HTMLElement | DocumentFragment Render target

@param element — Render target

options)          

(parameter) options: RootOptions Options for createRoot (not supported yet)

@param options — Options for createRoot (not supported yet)

root

const root: Root

.render

(method) Root.render(children: Child): void

(reactNode)          

(parameter) reactNode: Child A JSXNode to render

@param reactNode — A JSXNode to render

return root          

const root: Root

} export default { createRoot,          

(property) createRoot: (element: HTMLElement | DocumentFragment, options?: RootOptions) => Root

hydrateRoot,          

(property) hydrateRoot: (element: HTMLElement | DocumentFragment, reactNode: Child, options?: RootOptions) => Root

}
src/jsx/dom/components.ts
            
                import type { Child, FC, PropsWithChildren } from '../'
                import type { ErrorHandler, FallbackRender } from '../components'
                import { DOM_ERROR_HANDLER } from '../constants'
                import { Fragment } from './jsx-runtime'
                
                /* eslint-disable @typescript-eslint/no-explicit-any */
                export const ErrorBoundary:

const ErrorBoundary: FC<PropsWithChildren<{ fallback?: Child; fallbackRender?: FallbackRender; onError?: ErrorHandler; }>>

FC<          

(alias) type FC<P = Props> = { (props: P): HtmlEscapedString | Promise<HtmlEscapedString> | null; defaultProps?: Partial<P> | undefined; displayName?: string | undefined; } import FC

PropsWithChildren<{          

(alias) type PropsWithChildren<P = unknown> = P & { children?: Child | undefined; } import PropsWithChildren

fallback?:

(property) fallback?: Child

Child          

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

fallbackRender?:

(property) fallbackRender?: FallbackRender | undefined

FallbackRender          

(alias) type FallbackRender = (error: Error) => Child import FallbackRender

onError?:

(property) onError?: ErrorHandler | undefined

ErrorHandler          

(alias) type ErrorHandler = (error: Error) => void import ErrorHandler

}> > = (({ children,

(parameter) children: any

fallback,

(parameter) fallback: any

fallbackRender,

(parameter) fallbackRender: any

onError }: any) => {          

(parameter) onError: any

const res =

const res: JSXNode

Fragment({

(alias) Fragment(props: Record<string, unknown>): JSXNode import Fragment

children })          

(property) children: any

;(res as any)

const res: JSXNode

[DOM_ERROR_HANDLER] =

(alias) const DOM_ERROR_HANDLER: typeof DOM_ERROR_HANDLER import DOM_ERROR_HANDLER

(err: any) => {          

(parameter) err: any

if (err instanceof

(parameter) err: any

Promise) {          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

throw err          

(parameter) err: Promise<any>

} onError?.

(parameter) onError: any

(err)          

(parameter) err: any

return fallbackRender?.

(parameter) fallbackRender: any

(err) ||

(parameter) err: any

fallback          

(parameter) fallback: any

} return res          

const res: JSXNode

}) as any export const Suspense:

const Suspense: FC<PropsWithChildren<{ fallback: any; }>>

FC

(alias) type FC<P = Props> = { (props: P): HtmlEscapedString | Promise<HtmlEscapedString> | null; defaultProps?: Partial<P> | undefined; displayName?: string | undefined; } import FC

<PropsWithChildren<{

(alias) type PropsWithChildren<P = unknown> = P & { children?: Child | undefined; } import PropsWithChildren

fallback: any }>> = (({          

(property) fallback: any

children,          

(parameter) children: any

fallback,          

(parameter) fallback: any

}: any) => { const res =

const res: JSXNode

Fragment({

(alias) Fragment(props: Record<string, unknown>): JSXNode import Fragment

children })          

(property) children: any

;(res as any)

const res: JSXNode

[DOM_ERROR_HANDLER] =

(alias) const DOM_ERROR_HANDLER: typeof DOM_ERROR_HANDLER import DOM_ERROR_HANDLER

(err: any,

(parameter) err: any

retry: () => void) => {          

(parameter) retry: () => void

if (!(err instanceof

(parameter) err: any

Promise)) {          

var Promise: PromiseConstructor Represents the completion of an asynchronous operation

throw err          

(parameter) err: any

} err

(parameter) err: Promise<any>

.finally

(method) Promise<any>.finally(onfinally?: (() => void) | null | undefined): Promise<any> Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.

@param onfinally — The callback to execute when the Promise is settled (fulfilled or rejected).

@returns — A Promise for the completion of the callback.

(retry)          

(parameter) retry: () => void

return fallback          

(parameter) fallback: any

} return res          

const res: JSXNode

}) as any /* eslint-enable @typescript-eslint/no-explicit-any */
src/jsx/dom/context.ts
            
                import type { Child } from '../base'
                import { DOM_ERROR_HANDLER } from '../constants'
                import type { Context } from '../context'
                import { globalContexts } from '../context'
                import { setInternalTagFlag } from './utils'
                
                export const createContextProviderFunction =          

const createContextProviderFunction: <T>(values: T[]) => Function

<T>

(type parameter) T in <T>(values: T[]): Function

(values:

(parameter) values: T[]

T[]):

(type parameter) T in <T>(values: T[]): Function

Function =>          

interface Function Creates a new function.

({ value,

(parameter) value: T

children }: {

(parameter) children: Child[]

value:

(property) value: T

T;

(type parameter) T in <T>(values: T[]): Function

children:

(property) children: Child[]

Child[] }) => {          

(alias) type Child = string | number | boolean | Promise<string> | JSXNode | Child[] | null | undefined import Child

if (!children) {          

(parameter) children: Child[]

return undefined } // eslint-disable-next-line @typescript-eslint/no-explicit-any const props: {

const props: { children: any; }

children: any } = {          

(property) children: any

children: [          

(property) children: any

{ tag:

(property) tag: Function

setInternalTagFlag(() => {          

(alias) setInternalTagFlag(fn: Function): Function import setInternalTagFlag

values

(parameter) values: T[]

.push

(method) Array<T>.push(...items: T[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(value)          

(parameter) value: T

}), props: {},          

(property) props: {}

}, ], } if (Array

var Array: ArrayConstructor

.isArray

(method) ArrayConstructor.isArray(arg: any): arg is any[]

(children)) {          

(parameter) children: Child[]

props

const props: { children: any; }

.children.push(..

(property) children: any

.children

(parameter) children: Child[]

.flat())          

(method) Array<Child>.flat<Child[], 1>(this: Child[], depth?: 1 | undefined): Child[] Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

@param depth — The maximum recursion depth

} else { props

const props: { children: any; }

.children.push

(property) children: any

(children)          

(parameter) children: never

} props

const props: { children: any; }

.children.push({          

(property) children: any

tag:

(property) tag: Function

setInternalTagFlag(() => {          

(alias) setInternalTagFlag(fn: Function): Function import setInternalTagFlag

values

(parameter) values: T[]

.pop()          

(method) Array<T>.pop(): T | undefined Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

}), props: {},          

(property) props: {}

}) const res = {

const res: { tag: string; props: { children: any; }; type: string; }

tag: '',

(property) tag: string

props,

(property) props: { children: any; }

type: '' }          

(property) type: string

// eslint-disable-next-line @typescript-eslint/no-explicit-any ;(res as any)

const res: { tag: string; props: { children: any; }; type: string; }

[DOM_ERROR_HANDLER] =

(alias) const DOM_ERROR_HANDLER: typeof DOM_ERROR_HANDLER import DOM_ERROR_HANDLER

(err: unknown) => {          

(parameter) err: unknown

values

(parameter) values: T[]

.pop()          

(method) Array<T>.pop(): T | undefined Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

throw err          

(parameter) err: unknown

} return res          

const res: { tag: string; props: { children: any; }; type: string; }

} export const createContext =

const createContext: <T>(defaultValue: T) => Context<T>

<T>

(type parameter) T in <T>(defaultValue: T): Context<T>

(defaultValue:

(parameter) defaultValue: T

T):

(type parameter) T in <T>(defaultValue: T): Context<T>

Context

(alias) interface Context<T> import Context

<T> => {          

(type parameter) T in <T>(defaultValue: T): Context<T>

const values =

const values: T[]

[defaultValue]          

(parameter) defaultValue: T

const context:

const context: Context<T>

Context

(alias) interface Context<T> import Context

<T> =

(type parameter) T in <T>(defaultValue: T): Context<T>

createContextProviderFunction

const createContextProviderFunction: <T>(values: T[]) => Function

(values) as

const values: T[]

Context

(alias) interface Context<T> import Context

<T>          

(type parameter) T in <T>(defaultValue: T): Context<T>

context

const context: Context<T>

.values =

(property) Context<T>.values: T[]

values          

const values: T[]

context

const context: Context<T>

.Provider =

(property) Context<T>.Provider: FC<PropsWithChildren<{ value: T; }>>

context          

const context: Context<T>

globalContexts

(alias) const globalContexts: Context<unknown>[] import globalContexts

.push

(method) Array<Context<unknown>>.push(...items: Context<unknown>[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(context as

const context: Context<T>

Context)          

(alias) interface Context<T> import Context

return context          

const context: Context<T>

}
src/jsx/dom/css.ts
            
                /**
                 * @module
                 * This module provides APIs that enable `hono/jsx/dom` to support.
                 */
                
                import type { FC, PropsWithChildren } from '../'
                import type { CssClassName, CssVariableType } from '../../helper/css/common'
                import {
                  CLASS_NAME,
                  DEFAULT_STYLE_ID,
                  PSEUDO_GLOBAL_SELECTOR,
                  SELECTOR,
                  SELECTORS,
                  STYLE_STRING,
                  cssCommon,
                  cxCommon,
                  keyframesCommon,
                  viewTransitionCommon,
                } from '../../helper/css/common'
                export { rawCssString } from '../../helper/css/common'          

(alias) const rawCssString: (value: string) => CssEscapedString export rawCssString

@experimental
rawCssString is an experimental feature. The API might be changed.

const splitRule =

const splitRule: (rule: string) => string[]

(rule: string): string[] => {          

(parameter) rule: string

const result: string[] = []          

const result: string[]

let startPos = 0          

let startPos: number

let depth = 0          

let depth: number

for (let i = 0,

let i: number

len =

let len: number

rule

(parameter) rule: string

.length;

(property) String.length: number Returns the length of a String object.

i <

let i: number

len;

let len: number

i++) {          

let i: number

const char =

const char: string

rule

(parameter) rule: string

[i]          

let i: number

// consume quote // eslint-disable-next-line quotes if (char === "'" ||

const char: string

char === '"') {          

const char: string

const quote =

const quote: "\"" | "'"

char          

const char: "\"" | "'"

i++          

let i: number

for (; i <

let i: number

len;

let len: number

i++) {          

let i: number

if (rule

(parameter) rule: string

[i] === '\\') {          

let i: number

i++          

let i: number

continue } if (rule

(parameter) rule: string

[i] ===

let i: number

quote) {          

const quote: "\"" | "'"

break } } continue } // comments are removed from the rule in advance if (char === '{') {          

const char: string

depth++          

let depth: number

continue } if (char === '}') {          

const char: string

depth--          

let depth: number

if (depth === 0) {          

let depth: number

result

const result: string[]

.push

(method) Array<string>.push(...items: string[]): number Appends new elements to the end of an array, and returns the new length of the array.

@param items — New elements to add to the array.

(rule

(parameter) rule: string

.slice

(method) String.slice(start?: number, end?: number): string Returns a section of a string.

@param start — The index to the beginning of the specified portion of stringObj.

@param end
The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. If this value is not specified, the substring continues to the end of stringObj.

(startPos,

let startPos: number

i + 1))          

let i: number

startPos =

let startPos: number

i + 1          

let i: number

} continue } } return result          

const result: string[]

} interface CreateCssJsxDomObjectsType {          

interface CreateCssJsxDomObjectsType

(args: {

(parameter) args: { id: Readonly<string>; }

id:

(property) id: string

Readonly }): readonly [          

type Readonly<T> = { readonly [P in keyof T]: T[P]; } Make all properties in T readonly

{ toString

(method) toString(this: CssClassName): string

(this:

(parameter) this: CssClassName

CssClassName): string          

(alias) interface CssClassName import CssClassName

}, FC

(alias) type FC<P = Props> = { (props: P): HtmlEscapedString | Promise<HtmlEscapedString> | null; defaultProps?: Partial<P> | undefined; displayName?: string | undefined; } import FC

<PropsWithChildren>          

(alias) type PropsWithChildren<P = unknown> = P & { children?: Child | undefined; } import PropsWithChildren

] } export const createCssJsxDomObjects:

const createCssJsxDomObjects: CreateCssJsxDomObjectsType

CreateCssJsxDomObjectsType = ({

interface CreateCssJsxDomObjectsType

id }) => {          

(parameter) id: string

let styleSheet:

let styleSheet: CSSStyleSheet | null | undefined

CSSStyleSheet | null | undefined = undefined          

interface CSSStyleSheet A single CSS style sheet. It inherits properties and methods from its parent, StyleSheet.

MDN Reference

const findStyleSheet = ():

const findStyleSheet: () => [CSSStyleSheet, Set<string>] | []

[CSSStyleSheet,

interface CSSStyleSheet A single CSS style sheet. It inherits properties and methods from its parent, StyleSheet.

MDN Reference

Set] | [] => {          

interface Set<T>

if (!styleSheet) {          

let styleSheet: CSSStyleSheet | null | undefined

styleSheet =

let styleSheet: CSSStyleSheet | null | undefined

document

var document: Document MDN Reference

.querySelector

(method) ParentNode.querySelector<HTMLStyleElement>(selectors: string): HTMLStyleElement | null (+4 overloads) Returns the first element that is a descendant of node that matches selectors.

MDN Reference

<HTMLStyleElement>(`style#$

interface HTMLStyleElement A