Request-Level Overrides
The adapter's global configuration (retry policy, circuit breaker, interceptors) applies to every request by default. For cases where a single request needs different behaviour, RequestBuilder exposes per-request overrides that take full precedence over the global config — without affecting any other request.
Retry Policy
import { RetryPolicies } from '@yildizpay/http-adapter';
// Override: use a specific policy for this request
const highStakesRequest = new RequestBuilder('https://api.example.com')
.setEndpoint('/v1/payments')
.withRetryPolicy(RetryPolicies.decorrelatedJitter(5))
.build();
// Disable: no retries for this request, regardless of global policy
const idempotentSensitiveRequest = new RequestBuilder('https://api.example.com')
.setEndpoint('/v1/refunds')
.withoutRetry()
.build();When to use withoutRetry()
Use it for non-idempotent operations where a retry could cause duplicate side effects (e.g., creating a charge, sending a notification). Even if your global policy is set to retry on 5xx, a duplicate charge on a retried POST is far worse than a failed request.
Circuit Breaker
// Override: use a dedicated circuit breaker instance for this endpoint
const request = new RequestBuilder('https://api.example.com')
.setEndpoint('/v1/payments')
.withCircuitBreaker(new CircuitBreaker({ failureThreshold: 3, resetTimeoutMs: 15_000 }))
.build();
// Bypass: skip the circuit breaker entirely for this request
const healthProbe = new RequestBuilder('https://api.example.com')
.setEndpoint('/health')
.withoutCircuitBreaker()
.build();When to use withoutCircuitBreaker()
Use it for health check or readiness probe endpoints where you want to know the service is down — not get a cached CircuitBreakerOpenException.
Interceptor Exclusion
Exclude by Class
Removes all instances of an interceptor class from this request's pipeline:
// Skip logging for this sensitive request (e.g., contains PII in the response)
const sensitiveRequest = new RequestBuilder('https://api.example.com')
.setEndpoint('/v1/users/profile')
.withoutInterceptor(LoggingInterceptor)
.build();Exclude by Instance
Useful when multiple instances of the same interceptor class are registered with different configurations:
const paymentLogger = new LoggingInterceptor('payments');
const generalLogger = new LoggingInterceptor('general');
const adapter = HttpAdapter.builder()
.withInterceptor(paymentLogger, generalLogger)
.build();
// Skip only the payment logger for this request
const request = new RequestBuilder('https://api.example.com')
.setEndpoint('/v1/internal')
.withoutInterceptorInstance(paymentLogger)
.build();Combining Overrides
All overrides can be combined on a single request:
const criticalRequest = new RequestBuilder('https://api.example.com')
.setEndpoint('/v1/critical-operation')
.setMethod(HttpMethod.POST)
.setBody(payload)
.withRetryPolicy(RetryPolicies.exponential(5))
.withCircuitBreaker(new CircuitBreaker({ failureThreshold: 2, resetTimeoutMs: 10_000 }))
.withoutInterceptor(LoggingInterceptor)
.withCorrelationId('x-critical-trace-id')
.build();