Versions in this module Expand all Collapse all v0 v0.0.2 Aug 30, 2026 Changes in this version + const DefaultMaxResponseBytes + const DefaultTimeout + const MaxRequestTimeout + var ErrEmptyURL = errors.New("httpreq: url must not be empty") + var ErrHostNotAllowed = errors.New("httpreq: host is not allowed by client policy") + var ErrInvalidClientConfig = errors.New("httpreq: client configuration is invalid") + var ErrInvalidHostPattern = errors.New("httpreq: host pattern is invalid") + var ErrInvalidMethod = errors.New("httpreq: method must be GET, HEAD, POST, PUT, PATCH, or DELETE") + var ErrInvalidRequestTimeout = errors.New("httpreq: timeout_ms must be between 1 and 120000 when set") + var ErrInvalidURL = errors.New("httpreq: url must be an absolute http(s) URL") + var ErrMethodNotAllowed = errors.New("httpreq: method is not allowed by client policy") + var ErrMissingAllowedHosts = errors.New(...) + var ErrNilClient = errors.New("httpreq: client must not be nil") + var ErrNilRequest = errors.New("httpreq: request must not be nil") + var ErrRedirectLimitReached = errors.New("httpreq: redirect limit reached") + type Allowlist struct + func NewAllowlist(hosts []string) (Allowlist, error) + func (allowlist Allowlist) Allows(host string) bool + type Client struct + func NewClient(config ClientConfig) (*Client, error) + func (client *Client) Do(ctx context.Context, request *Request) (*Response, error) + type ClientConfig struct + AllowedHosts []string + AllowedMethods []Method + DefaultHeaders map[string]string + DefaultTimeout time.Duration + HTTPClient *http.Client + MaxResponseBytes int64 + func (config ClientConfig) Validate() error + type Method string + const MethodDELETE + const MethodGET + const MethodHEAD + const MethodPATCH + const MethodPOST + const MethodPUT + func (method Method) Normalize() Method + func (method Method) Validate() error + type Request struct + Body string + Headers map[string]string + Method Method + Query map[string]string + TimeoutMS int + URL string + func (request *Request) Validate() error + type Response struct + Body string + Duration string + Headers map[string][]string + Status int + Truncated bool + type Tool struct + func NewTool(client *Client) (*Tool, error) + func (t *Tool) Call(ctx context.Context, invocation toolcontract.Invocation) (chat.ToolOutput, error) + func (t *Tool) Definition() chat.ToolDefinition v0.0.1 Aug 27, 2026