## Index

### Variables

- DOUBLE_SPACE_REGEXP
- NEWLINE_REGEXP

### Functions

- createHtmlDocument
- finalHandler
- getErrorHeaders
- getErrorMessage
- getErrorStatusCode
- getResourceName
- getResponseStatusCode
- send
- setHeaders

## Variables

### Const DOUBLE_SPACE_REGEXP

DOUBLE_SPACE_REGEXP: RegExp = /\x20{2}/g

- Defined in home/runner/work/opine/opine/src/utils/finalHandler.ts:40

### Const NEWLINE_REGEXP

NEWLINE_REGEXP: RegExp = /\n/g

- Defined in home/runner/work/opine/opine/src/utils/finalHandler.ts:41

## Functions

### Private createHtmlDocument

- createHtmlDocument(message: string): string

- - Defined in home/runner/work/opine/opine/src/utils/finalHandler.ts:49

  Create a minimal HTML document.

  #### Parameters

  - ##### message: string

  #### Returns string

### finalHandler

- finalHandler(req: OpineRequest, res: OpineResponse): NextFunction

- - Defined in home/runner/work/opine/opine/src/utils/finalHandler.ts:78

  Create a function to handle the final response.

  #### Parameters

  - ##### req: OpineRequest

  - ##### res: OpineResponse

  #### Returns NextFunction

### Private getErrorHeaders

- getErrorHeaders(err?: any): any

- - Defined in home/runner/work/opine/opine/src/utils/finalHandler.ts:120

  Get headers from Error object.

  #### Parameters

  - ##### Optional err: any

  #### Returns any

### Private getErrorMessage

- getErrorMessage(err: any, status: Status): string

- - Defined in home/runner/work/opine/opine/src/utils/finalHandler.ts:145

  Get message from Error object, fallback to status message.

  #### Parameters

  - ##### err: any

  - ##### status: Status

  #### Returns string

### Private getErrorStatusCode

- getErrorStatusCode(err: any): number | undefined

- - Defined in home/runner/work/opine/opine/src/utils/finalHandler.ts:164

  Get status code from Error object.

  #### Parameters

  - ##### err: any

  #### Returns number | undefined

### Private getResourceName

- getResourceName(req: OpineRequest): string

- - Defined in home/runner/work/opine/opine/src/utils/finalHandler.ts:183

  Get resource name for the request.

  This is typically just the original pathname of the request but will fallback to "resource" is that cannot be determined.

  #### Parameters

  - ##### req: OpineRequest

  #### Returns string

### Private getResponseStatusCode

- getResponseStatusCode(res: OpineResponse): number

- - Defined in home/runner/work/opine/opine/src/utils/finalHandler.ts:198

  Get status code from response.

  #### Parameters

  - ##### res: OpineResponse

  #### Returns number

### Private send

- send(req: OpineRequest, res: OpineResponse, status: Status, headers: any, message: any): void

- - Defined in home/runner/work/opine/opine/src/utils/finalHandler.ts:219

  Send response.

  #### Parameters

  - ##### req: OpineRequest

  - ##### res: OpineResponse

  - ##### status: Status

  - ##### headers: any

  - ##### message: any

  #### Returns void

### Private setHeaders

- setHeaders(res: OpineResponse, headers: any): void

- - Defined in home/runner/work/opine/opine/src/utils/finalHandler.ts:259

  Set response headers from an object.

  #### Parameters

  - ##### res: OpineResponse

  - ##### headers: any

  #### Returns void

Generated using TypeDoc