VTCode HTTP Client Utilities (src/http.rs)

vtcode · crates/common/vtcode-commons/src/http.rs · rust · Apache-2.0
infra, integration, tag:client

Provides utilities for creating HTTP clients with various configurations

// Source: https://github.com/vinhnx/vtcode | License: Apache-2.0 | Copyright 2025 Vinh Nguyen
// Provided via justclaw.it.com; keep this notice with the code.
//! HTTP client utilities

use reqwest::{Client, ClientBuilder};
use std::time::Duration;

const DEFAULT_TIMEOUT: Duration = Duration::from_secs(30);
const SHORT_TIMEOUT: Duration = Duration::from_secs(5);
pub const LONG_TIMEOUT: Duration = Duration::from_secs(300);

fn apply_platform_proxy_policy(builder: ClientBuilder) -> ClientBuilder {
    #[cfg(target_os = "macos")]
    {
        // Avoid system proxy discovery on macOS because it can panic in restricted environments.
        builder.no_proxy()
    }
    #[cfg(not(target_os = "macos"))]
    {
        builder
    }
}

/// Try to build an HTTP client, returning an error if both p

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key