[**@wocart/storefront v3.1.0**](../../README)

***

[@wocart/storefront](../../README) / [astro](../README) / ProxyEndpointConfig

# Interface: ProxyEndpointConfig\<TInput, TOutput\>

Configuration for creating a proxy endpoint

## Type Parameters

### TInput

`TInput`

### TOutput

`TOutput`

## Properties

### client

> **client**: [`ProxyClientFn`](../type-aliases/ProxyClientFn)\<`TInput`, `TOutput`\>

Client function that calls the server — usually a `StoreClient` method.

***

### csrfProtection?

> `optional` **csrfProtection?**: `boolean`

Enable CSRF protection (cross-origin check)
Default: true for POST, false for GET

***

### errorStatus?

> `optional` **errorStatus?**: `number`

Status code for every upstream failure. Leave it unset: the status then
follows the failure's `domainError` — 400 for a validation refusal, 422 for
a business refusal, 429 when the server named a wait, 504 for a timeout and
502 for anything the shopper cannot fix (a bad store key, a server fault,
a dropped connection, or a failure that carries no `domainError`).

***

### forwardAttribution?

> `optional` **forwardAttribution?**: `boolean`

Forward attribution headers (User-Agent, X-Forwarded-For)
Default: false

***

### inputSchema?

> `optional` **inputSchema?**: `Schema`\<`TInput`\>

Input validation schema (optional for GET without query validation)

***

### method

> **method**: `"GET"` \| `"POST"` \| `"PUT"`

HTTP method: 'GET', 'POST', or 'PUT' (a raw body, read by `readInput`).

***

### noContent?

> `optional` **noContent?**: `boolean`

Return 204 No Content on success instead of JSON
Default: false

***

### pathParams?

> `optional` **pathParams?**: `Record`\<`string`, `"string"` \| `"number"`\>

Path parameter substitution for dynamic URLs
Example: { wilayaId: 'number' } will parse params.wilayaId as number

***

### queryParams?

> `optional` **queryParams?**: `string`[]

Query parameter names for GET requests
Example: ['wilayaId'] will extract { wilayaId: '42' } from ?wilayaId=42

***

### readInput?

> `optional` **readInput?**: (`request`) => `unknown`

Read the input from the request instead of parsing JSON — for a body that
is a file, passed on as a stream. Its result still goes through
`inputSchema`.

#### Parameters

##### request

`Request`

#### Returns

`unknown`

***

### successBody?

> `optional` **successBody?**: (`data`) => `unknown`

Shape the success response body (default: `(data) => ({ data })`).
Use when the browser contract carries more than `{data}` — e.g.
`(d) => ({ success: true, data: d })` for cart validation, or
`({ rows, total }) => ({ data: rows, total })` for review pagination.

#### Parameters

##### data

`TOutput`

#### Returns

`unknown`

***

### successStatus?

> `optional` **successStatus?**: `number`

Success status code (default: 200)
