http-advanced
workflowv1.0.0Advanced HTTP client: auth, retries, custom headers, streaming, and webhooks
Install
kdeps registry install http-advanced
Then run locally:
kdeps exec http-advanced
Configure LLM provider in ~/.kdeps/config.yaml (created automatically on first run).
README
Advanced HTTP Client Features
This example demonstrates advanced HTTP client capabilities in KDeps v2:
๐ Advanced Features
๐ Authentication
- Bearer Token: Automatic
Authorization: Bearer <token>headers - API Key: Custom header-based API key authentication
- Basic Auth: Username/password with base64 encoding
- OAuth2: Token-based authentication (extensible)
๐ Retry Logic
- Exponential Backoff: Configurable retry delays
- Status Code Retries: Retry on specific HTTP status codes (5xx, 429, etc.)
- Max Attempts: Configurable retry limits
- Backoff Limits: Maximum delay caps
๐พ Response Caching
- Memory Caching: Fast in-memory response caching
- TTL Support: Time-based cache expiration
- Custom Keys: Configurable cache keys
- Request Deduplication: Avoid duplicate API calls
๐ Advanced Configuration
- Proxy Support: HTTP/SOCKS proxy configuration
- TLS Configuration: Custom certificates and verification
- Redirect Control: Follow or reject redirects
- Timeout Management: Per-request timeouts
๐ API Endpoints
GET /api/v1/http-demo
Bearer Token Authentication with Caching:
- Calls
https://httpbin.org/bearerwith Bearer token auth - Responses cached for 5 minutes
- Automatic retries on server errors
Response:
{
"statusCode": 200,
"headers": {
"content-type": "application/json",
"authorization": "[REDACTED]"
},
"body": {
"authenticated": true,
"token": "your-bearer-token-here"
},
"url": "https://httpbin.org/bearer",
"method": "GET"
}
POST /api/v1/http-demo
API Key Authentication with POST Data:
- Sends JSON payload to
https://httpbin.org/post - Uses
X-API-Keyheader for authentication - Includes custom headers and request body
- Aggressive retry strategy for resilience
Request Body:
{
"message": "Hello from KDeps!",
"timestamp": "2024-01-15T10:30:00Z",
"user_id": "12345"
}
Response:
{
"statusCode": 200,
"headers": {
"content-type": "application/json"
},
"body": {
"data": {
"message": "Hello from KDeps!",
"timestamp": "2024-01-15T10:30:00Z",
"user_id": "12345"
},
"headers": {
"X-Api-Key": "[REDACTED]"
}
}
}
โ๏ธ Configuration Examples
Bearer Token Authentication
httpClient:
auth:
type: bearer
token: "{{ get('api_token') }}"
API Key Authentication
httpClient:
auth:
type: api_key
key: "X-API-Key"
value: "{{ get('api_key') }}"
Advanced Retry Configuration
httpClient:
retry:
maxAttempts: 5
backoff: 500ms # Initial delay
maxBackoff: 10s # Maximum delay
retryOn: [429, 500, 502, 503] # Status codes to retry
Response Caching
httpClient:
cache:
enabled: true
ttl: 5m
key: "custom_cache_key"
Proxy and TLS Configuration
httpClient:
proxy: "http://proxy.company.com:8080"
tls:
insecureSkipVerify: false
certFile: "/path/to/client.crt"
keyFile: "/path/to/client.key"
caFile: "/path/to/ca.crt"
followRedirects: false
๐งช Testing the Features
- Bearer Token Authentication:
curl "http://localhost:16395/api/v1/http-demo"
# Uses cached response on subsequent calls
- API Key Authentication:
curl -X POST "http://localhost:16395/api/v1/http-demo" \
-H "Content-Type: application/json" \
-d '{"custom_header": "test-value"}'
- Simulate Failures (for retry testing):
# Temporarily change URLs to non-existent endpoints
# Watch logs for retry attempts with exponential backoff
๐ง Environment Variables
Set these environment variables for authentication:
export API_TOKEN="your-bearer-token-here"
export API_KEY="your-api-key-here"
Or pass them as query parameters:
curl "http://localhost:16395/api/v1/http-demo?api_token=your-token&api_key=your-key"
๐ Performance Benefits
- Caching: Reduces API calls and improves response times
- Retries: Automatic recovery from transient failures
- Connection Reuse: Efficient HTTP client pooling
- Timeout Management: Prevents hanging requests
๐ Security Features
- Token Masking: Sensitive headers are redacted in logs
- TLS Verification: Configurable certificate validation
- Proxy Support: Enterprise proxy compatibility
- Header Sanitization: Safe header value handling
๐ Monitoring & Debugging
Each HTTP response includes:
- Status code and headers
- Request URL and method
- Response body (JSON parsed or raw)
- Timing information
- Retry attempt counts
This enables comprehensive monitoring of API interactions and debugging of integration issues.
Versions
| Version | Published | Status |
|---|---|---|
| 1.0.0 | 4/11/2026 | active |
Details
- Author
- kdeps
- License
- Apache-2.0
- Latest Version
- 1.0.0
- Published
- 4/11/2026
Tags
httpclientadvanced