httpx

package
v0.10.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: 7 Imported by: 0

Documentation

Overview

Package httpx 提供各引擎共用的 HTTP Client 默认值(超时等)。

Index

Constants

View Source
const DefaultTimeout = 3 * time.Minute

DefaultTimeout 为未显式配置 Timeout 时的默认请求超时(含连接+TLS+首包+整体)。

Variables

This section is empty.

Functions

func DoJSON added in v0.9.0

func DoJSON(ctx context.Context, hc *http.Client, method, url, apiKey string, body []byte, prefix string) ([]byte, error)

DoJSON sends a JSON request and returns the response body. It sets Authorization (Bearer) and Content-Type headers automatically. Non-2xx responses are converted to *aigoerr.Error.

func OrDefault

func OrDefault(c *http.Client, defaultTimeout time.Duration) *http.Client

OrDefault 返回可用的 *http.Client:nil 或 Timeout==0 时使用 defaultTimeout。 若 c 已有 Timeout>0,原样返回 c。

Types

This section is empty.

Jump to

Keyboard shortcuts

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