httpheaders

package
v0.38.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package httpheaders provides shared User-Agent resolution for all HTTP-based providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallHeaders added in v0.36.0

func CallHeaders(headers map[string]string) (map[string]string, bool)

CallHeaders resolves per-call headers. It returns the headers map and true if per-call headers should be applied, or nil and false if the client-level headers should be used as-is.

func CallUserAgent

func CallUserAgent(callUA string) (string, bool)

CallUserAgent resolves the User-Agent for a single API call. It returns the resolved UA string and true if a per-call override should be applied, or empty string and false if the client-level UA should be used as-is.

func DefaultUserAgent

func DefaultUserAgent(version string) string

DefaultUserAgent returns the default User-Agent string for the SDK. The result is "Charm Fantasy/<version>".

func ResolveHeaders

func ResolveHeaders(headers map[string]string, explicitUA, defaultUA string) map[string]string

ResolveHeaders returns a new header map, with a User-Agent field.

Setting the value via WithUserAgent() takes precedence, however the user agent can also be set via HTTP headers (i.e. WithHeaders()). Otherwise, the default user agent will be used, i.e. Charm Fantasy/0.11.0.

Also note that the input map is never mutated.

Types

This section is empty.

Jump to

Keyboard shortcuts

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