httpx

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package httpx is the HTTP plumbing adapters share: base URLs from svc:// addresses, JSON calls with auth.

Index

Constants

This section is empty.

Variables

View Source
var Default = &http.Client{Timeout: 30 * time.Second}

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Addr     string            `yaml:"addr"`
	User     string            `yaml:"user"`
	Password string            `yaml:"password"`
	Token    string            `yaml:"token"`
	Headers  map[string]string `yaml:"headers"`
}

Endpoint is an HTTP API an adapter talks to, given as a URL or svc://service:port.

func (Endpoint) Base

func (e Endpoint) Base(ctx context.Context, env core.Env) (string, error)

Base resolves the address through env and returns it with a scheme and without a trailing slash.

func (Endpoint) Do

func (e Endpoint) Do(ctx context.Context, env core.Env, method, path string, body any, out any) error

Do sends a request to base+path and decodes a JSON answer into out (when out is not nil).

func (Endpoint) DoURL

func (e Endpoint) DoURL(ctx context.Context, method, url string, body any, out any) error

Jump to

Keyboard shortcuts

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