httpclient

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package httpclient is a minimal JSON HTTP client vendored into the engine so the fh-backend capability implementation has no dependency on the closed fh-backend module. It mirrors the small surface the backend client used: NewClient(baseURL, authHeader, authValue) + Do(ctx, ...).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a JSON-over-HTTP client that attaches a fixed auth header to every request.

func NewClient

func NewClient(baseURL, authHeader, authValue string) *Client

NewClient builds a Client. authHeader/authValue are sent on every request (e.g. "Agent-Key", <secret>); pass "" for authHeader to disable auth.

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, query url.Values, body, out any) error

Do executes method baseURL+path. body, when non-nil, is JSON-encoded as the request body. out, when non-nil, receives the JSON-decoded response. A non-2xx status returns an error carrying the status and response snippet. Per-call deadlines come from ctx (callers wrap with context.WithTimeout).

Jump to

Keyboard shortcuts

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