Function execute_request

Source
pub async fn execute_request(
    spec: &CachedSpec,
    matches: &ArgMatches,
    base_url: Option<&str>,
    dry_run: bool,
    idempotency_key: Option<&str>,
    global_config: Option<&GlobalConfig>,
    output_format: &OutputFormat,
    jq_filter: Option<&str>,
    cache_config: Option<&CacheConfig>,
) -> Result<(), Error>
Expand description

Executes HTTP requests based on parsed CLI arguments and cached spec data.

This module handles the mapping from CLI arguments back to API operations, resolves authentication secrets, builds HTTP requests, and validates responses.

§Arguments

  • spec - The cached specification containing operation details
  • matches - Parsed CLI arguments from clap
  • base_url - Optional base URL override. If None, uses BaseUrlResolver
  • dry_run - If true, show request details without executing
  • idempotency_key - Optional idempotency key for safe retries
  • global_config - Optional global configuration for URL resolution
  • output_format - Format for response output (json, yaml, table)
  • jq_filter - Optional JQ filter expression to apply to response
  • cache_config - Optional cache configuration for response caching

§Returns

  • Ok(()) - Request executed successfully or dry-run completed
  • Err(Error) - Request failed or validation error

§Errors

Returns errors for authentication failures, network issues, response validation, or JQ filter errors

§Panics

Panics if JSON serialization of dry-run information fails (extremely unlikely)