Skip to main content

Request Options Reference

This page documents all request-level options available in Solvix.

These options allow fine-grained control over how each request behaves, overriding client-level configuration when needed.

Basic usage

await client.get("/users", {
headers: {
Authorization: "Bearer token",
},
timeout: 2000,
});

Request options structure

{
method?: string,
headers?: Record<string, string>,
body?: any,
query?: Record<string, any>,
timeout?: number,
retry?: RetryOptions,
rateLimit?: RateLimitOptions,
circuitBreaker?: CircuitBreakerOptions,
security?: SecurityOptions,
shadow?: ShadowOptions,
priority?: number,
dedupeKey?: string,
dependsOn?: string[],
signal?: AbortSignal
}

Core options

headers

Override or extend request headers.

headers: {
Authorization: "Bearer token";
}

body

Request payload (auto JSON serialized).

body: {
name: "Aditya";
}

query

Query parameters.

query: {
page: 1,
limit: 10
}

timeout

Override request timeout.

timeout: 3000;

Retry options

retry: {
retries: 2,
baseDelay: 200
}

Rate limiting

rateLimit: {
maxRequests: 5,
perMilliseconds: 1000
}

Circuit breaker

circuitBreaker: {
failureThreshold: 3;
}

Security overrides

security: {
enforceHTTPS: true;
}

Shadow mode

shadow: {
enabled: true,
secondaryBaseURL: "https://shadow.api"
}

Advanced options

priority

Controls execution priority (used in queue).

priority: 10;

dedupeKey

Prevents duplicate in-flight requests.

dedupeKey: "get-users";

dependsOn

Wait for other requests to complete.

dependsOn: ["auth-request"];

signal

Abort request manually.

const controller = new AbortController();

await client.get("/users", {
signal: controller.signal,
});

Example: full request

await client.post("/users", {
body: { name: "Aditya" },
headers: { Authorization: "Bearer token" },
timeout: 2000,
retry: { retries: 2 },
priority: 5,
});

Best practices

  • Use minimal overrides
  • Prefer global config for consistency
  • Use dedupe for high-frequency requests
  • Use dependsOn for safe orchestration

Summary

Request options give you full control over individual requests without affecting global behavior.