http

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUDSHTTPClient

func NewUDSHTTPClient(socketPath string) *http.Client

NewUDSHTTPClient creates a new HTTP client configured to connect to a Unix Domain Socket (UDS) specified by the provided socketPath. The returned client uses custom transport that dials via the UDS, and is set to have a default timeout as specified in the cli.CommandTimeout.

func ReadResponse

func ReadResponse(res *http.Response) ([]byte, error)

ReadResponse attempts to read the body of an HTTP response. It unmarshals any error message in the response body if the status code indicates an error. If the status code is not in the 2xx range, an error is returned.

Types

type ErrorMessage

type ErrorMessage struct {
	Message string
}

Jump to

Keyboard shortcuts

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