@wocart/storefront / astro / ProxyEndpointConfig
Interface: ProxyEndpointConfig<TInput, TOutput>
Configuration for creating a proxy endpoint
Type Parameters
TInput
TInput
TOutput
TOutput
Properties
client
client:
ProxyClientFn<TInput,TOutput>
Client function that calls the server — usually a StoreClient method.
csrfProtection?
optionalcsrfProtection?:boolean
Enable CSRF protection (cross-origin check) Default: true for POST, false for GET
errorStatus?
optionalerrorStatus?: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?
optionalforwardAttribution?:boolean
Forward attribution headers (User-Agent, X-Forwarded-For) Default: false
inputSchema?
optionalinputSchema?: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?
optionalnoContent?:boolean
Return 204 No Content on success instead of JSON Default: false
pathParams?
optionalpathParams?:Record<string,"string"|"number">
Path parameter substitution for dynamic URLs Example: { wilayaId: 'number' } will parse params.wilayaId as number
queryParams?
optionalqueryParams?:string[]
Query parameter names for GET requests Example: ['wilayaId'] will extract { wilayaId: '42' } from ?wilayaId=42
readInput?
optionalreadInput?: (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?
optionalsuccessBody?: (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?
optionalsuccessStatus?:number
Success status code (default: 200)