httputil

package
v1.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadRawResponse

func ReadRawResponse[T any](response *http.Response) (*T, error)

Reads the raw HTTP response and attempt to convert it into the specified type. Typically used in conjunction with runtime.WithCaptureResponse(...) to get access to the underlying HTTP response of the SDK API call.

ReadRawResponse fully drains the response body via io.ReadAll but does not close it. Callers that return the response to the azcore poller framework must leave the body unclosed.

func RetryAfter

func RetryAfter(resp *http.Response) time.Duration

RetryAfter returns the retry after duration from the response headers. If none exists, a zero value is returned. Headers are checked in the following order: retry-after-ms, x-ms-retry-after-ms, retry-after

func TlsEnabledTransport

func TlsEnabledTransport(derBytes string) (*http.Transport, error)

TlsEnabledTransport returns a http.Transport that has TLS configured to use the provided Base64 DER-encoded certificate. The returned http.Transport inherits defaults from http.DefaultTransport.

func TunedTransport added in v1.24.0

func TunedTransport() *http.Transport

TunedTransport returns an http.Transport cloned from http.DefaultTransport with connection pooling parameters optimized for Azure CLI workloads. The key tuning is MaxIdleConnsPerHost (raised from Go's default of 2) to avoid unnecessary TLS handshakes when making many concurrent requests to ARM endpoints. MaxConnsPerHost is left at 0 (unlimited) — the Go default — to avoid artificial bottlenecks; the pool is bounded by MaxIdleConns instead. Keep-alive must remain enabled (the default) for connection reuse.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL