# Accept

**Kind:** Interface

**Source:** [`src/helper/accepts/accepts.ts`](https://github.com/honojs/hono/blob/main/src/helper/accepts/accepts.ts#L5)

**Part of:** [Helper](subsystem-src-helper)

`Accept` represents a parsed accepted media type, including its type string, media parameters, and quality value. It can be used by content negotiation helpers when comparing client preferences against available response formats.

## Properties

| Property | Type |
|---|---|
| `type` | `string` |
| `params` | `Record<string, string>` |
| `q` | `number` |

## Diagram

```mermaid
graph LR
  Header[Accept header entry] --> Accept[Accept]
  Accept --> Type[type: string]
  Accept --> Params[params: Record<string, string>]
  Accept --> Quality[q: number]
```

## Usage

```ts
import type { Accept } from "./helper/accepts/accepts";

const requestedQuality = "0.9";

const acceptedType: Accept = {
  type: "application/json",
  params: {
    charset: "utf-8",
  },
  q: Number.parseFloat(requestedQuality),
};

if (acceptedType.type === "application/json") {
  console.log(`Serving ${acceptedType.type}`);
}
```

## AI Coding Instructions

- Keep `type` as the parsed media type, such as `application/json`.
- Store media-type parameters in `params` as string values.
- Preserve the parsed quality value in `q` for preference comparisons.
- Handle missing or invalid quality values in the parsing layer before constructing an `Accept` object.

## Relationships

- IMPORTS → `parseAccept`
