---
title: "Echoes each query parameter as a response header and in the JSON body."
url: "https://developer.rucho.org/apis/rucho/versions/5bdf1bcb-8db4-40f1-a293-72c7198e26c8/operations/response_headers_handler"
---

> Full API specification: https://developer.rucho.org/apis/rucho/versions/5bdf1bcb-8db4-40f1-a293-72c7198e26c8.md

# Echoes each query parameter as a response header and in the JSON body.

`GET` `/response-headers`

Operation ID: `response_headers_handler`

`GET /response-headers?x-rate-limit=100&cache-control=no-store` returns: - Response headers `x-rate-limit: 100` and `cache-control: no-store` - JSON body `{"x-rate-limit": "100", "cache-control": "no-store"}` Duplicate keys emit multiple response headers (HTTP's repeat-header model) and collapse to a JSON array in the body. Invalid header names or values return 400. User-supplied headers replace any defaults — setting `content-type` overrides the default `application/json` (body remains JSON regardless; the mismatch is intentional for plugin-testing scenarios).

## Responses

- `200` - Echoes query params as response headers and a JSON body
- `400` - Invalid header name or value

## OpenAPI definition

```yaml
openapi: 3.0.3
info:
  title: rucho
  version: 1.6.0
servers:
  - url: https://rucho.org
    description: Production (EKS us-east-2, behind Kong)
paths:
  /response-headers:
    get:
      tags:
        - crate::routes::response_headers
      summary: Echoes each query parameter as a response header and in the JSON body.
      description: >-
        `GET /response-headers?x-rate-limit=100&cache-control=no-store` returns:

        - Response headers `x-rate-limit: 100` and `cache-control: no-store`

        - JSON body `{"x-rate-limit": "100", "cache-control": "no-store"}`


        Duplicate keys emit multiple response headers (HTTP's repeat-header
        model)

        and collapse to a JSON array in the body. Invalid header names or values

        return 400.


        User-supplied headers replace any defaults — setting `content-type`

        overrides the default `application/json` (body remains JSON regardless;

        the mismatch is intentional for plugin-testing scenarios).
      operationId: response_headers_handler
      responses:
        "200":
          description: Echoes query params as response headers and a JSON body
        "400":
          description: Invalid header name or value
```
