# COMPOSED_HANDLER

**Kind:** Constant

**Source:** [`src/utils/constants.ts`](https://github.com/honojs/hono/blob/main/src/utils/constants.ts#L4)

**Part of:** [Utils](subsystem-src-utils)

Constant used to mark a composed handler.

`COMPOSED_HANDLER` is a shared marker for handlers created through composition. Code that creates or inspects composed handlers can use this constant to apply and detect the same marker consistently.

## Definition

```ts
'__COMPOSED_HANDLER'
```

## Value

```ts
'__COMPOSED_HANDLER'
```

## Diagram

```mermaid
graph LR
  A[Handler composition] --> B[Composed handler]
  B --> C[COMPOSED_HANDLER marker]
  C --> D[Handler detection logic]
```

## Usage

```ts
import { COMPOSED_HANDLER } from './utils/constants';

function isComposedHandler(handler: object): boolean {
  return COMPOSED_HANDLER in handler;
}

// A handler created by composition is marked with COMPOSED_HANDLER.
if (isComposedHandler(handler)) {
  // Apply composed-handler behavior.
}
```

## AI Coding Instructions

- Import `COMPOSED_HANDLER` from `src/utils/constants.ts` instead of duplicating its marker value.
- Apply the marker where handlers are composed, not where ordinary handlers are created.
- Check for the marker before running behavior that is specific to composed handlers.
- Keep marker creation and marker detection aligned so both paths use `COMPOSED_HANDLER`.

## Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (2)

- `HonoOptions` — `src/hono-base.ts`:46
- `isMiddleware` — `src/utils/handler.ts`:8
