---
title: "Request Handling"
description: "In Hono, request handling revolves around the `HonoRequest` object, which is accessible via the context object (`c.req`) inside your route handlers. It provides a robust, developer-friendly interfa..."
last_updated: "2026-07-02T09:15:05.217039+00:00"
canonical_url: "https://www.doc0.app/docs/552ca36e-f67e-41c3-a07a-def9bd9551b0/guide/core-concepts/request-handling"
---

In Hono, request handling revolves around the `HonoRequest` object, which is accessible via the context object (`c.req`) inside your route handlers. It provides a robust, developer-friendly interface to extract data from incoming HTTP requests, including path parameters, query strings, headers, cookies, and various body formats.

## Accessing Request Data

You can retrieve data from the request using simple method calls on `c.req`.

| Method | Description | Example |
| :--- | :--- | :--- |
| `c.req.param()` | Get path parameters | `c.req.param('id')` |
| `c.req.query()` | Get query parameters | `c.req.query('q')` |
| `c.req.queries()` | Get multiple values for a query key | `c.req.queries('tags')` |
| `c.req.header()` | Get a specific request header | `c.req.header('User-Agent')` |
| `c.req.json()` | Parse request body as JSON | `await c.req.json()` |
| `c.req.text()` | Parse request body as plain text | `await c.req.text()` |

> [!NOTE]
> When calling methods like `.json()`, `.text()`, or `.formData()`, always use `await` as these operations are asynchronous.

## Handling Cookies

The `hono/helper/cookie` module provides utilities to read and set cookies easily.

1. **Reading Cookies**: Use `getCookie(c, 'name')` to retrieve a specific cookie value, or `getCookie(c)` to get all cookies.
2. **Setting Cookies**: Use `setCookie(c, 'name', 'value')` to add a `Set-Cookie` header to the response.
3. **Deleting Cookies**: Use `deleteCookie(c, 'name')` to clear a cookie by setting its `maxAge` to 0.

> [!TIP]
> Use `getSignedCookie` and `setSignedCookie` if you need to cryptographically sign your cookies to prevent tampering.

## Request Validation

You can validate incoming data using the `validator` middleware. This function intercepts the request, parses the specified target (like `json`, `query`, or `form`), runs your validation logic, and adds the result to the request object.

```typescript
import { validator } from 'hono/validator'

app.post('/user', validator('json', (value, c) => {
  if (!value.name) {
    return c.json({ error: 'Name is required' }, 400)
  }
  return value
}), (c) => {
  const data = c.req.valid('json')
  return c.json({ success: true, user: data.name })
})
```

> [!WARNING]
> If you consume a request body (e.g., calling `c.req.json()`) multiple times, Hono caches the result. Do not attempt to read the raw `c.req.raw.body` directly if you plan to use Hono's body parsing methods, as this may interfere with request cloning and middleware functionality.

## Cloning Requests

If you need to process a request body multiple times or pass a request to an external service, you can use `cloneRawRequest(req)`.

```typescript
import { cloneRawRequest } from 'hono/request'

app.post('/forward', async (c) => {
  const cloned = await cloneRawRequest(c.req)
  return fetch('https://external-service.com', cloned)
})
```

> [!IMPORTANT]
> `cloneRawRequest` only works if the body has been consumed via Hono's request methods (`.json()`, `.text()`, etc.). If the body was consumed elsewhere without caching, cloning will fail.

## Related

- [Context API](https://www.doc0.app/docs/552ca36e-f67e-41c3-a07a-def9bd9551b0/guide/core-concepts/context-api)
- [Response Handling](https://www.doc0.app/docs/552ca36e-f67e-41c3-a07a-def9bd9551b0/guide/core-concepts/response-handling)


## Sitemap

See the full [sitemap](https://www.doc0.app/docs/552ca36e-f67e-41c3-a07a-def9bd9551b0/llms.txt) for all pages in this wiki.
