Documentation
¶
Overview ¶
Package client implements HTTP API tools with a caller-supplied template expander.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateToolSet ¶
func CreateToolSet[E Expander](toolset latest.Toolset, runConfig *config.RuntimeConfig, newExpander func(environment.Provider) E, options ...Option) (tools.ToolSet, error)
CreateToolSet builds a configured HTTP tool with the supplied expander.
func Creator ¶
func Creator[E Expander](newExpander func(environment.Provider) E, options ...Option) func(context.Context, latest.Toolset, string, *config.RuntimeConfig, string) (tools.ToolSet, error)
Creator returns a teamloader.ToolsetCreator using the supplied expander. Pass teamloader.NewEnvExpander to support placeholders without JavaScript.
Types ¶
type Expander ¶
type Expander interface {
Expand(ctx context.Context, text string, values map[string]string) string
ExpandMap(ctx context.Context, values map[string]string) map[string]string
}
Expander resolves endpoint and header templates at request time. Both js.Expander and teamloader.NewEnvExpander satisfy this interface.
type Option ¶
type Option func(*ToolSet)
Option configures an api ToolSet.
func WithAllowPrivateIPs ¶
WithAllowPrivateIPs disables SSRF dial-time protection so the api tool may dial loopback / RFC1918 / link-local addresses. Operators opt in via `allow_private_ips: true` when the configured endpoint legitimately targets internal services. Tests use this to talk to httptest.NewServer.
func WithHeaderResolver ¶
WithHeaderResolver resolves headers after template expansion on every request. Pass upstream.ResolveHeaders to enable upstream JavaScript header templates.
func WithTimeout ¶
WithTimeout overrides the default HTTP client timeout (see httpclient.DefaultToolHTTPTimeout).
type ToolSet ¶
type ToolSet struct {
// contains filtered or unexported fields
}