httpx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNot2xx = errors.New("non-2xx response")

Functions

func ApplyConfiguredHeaders

func ApplyConfiguredHeaders(req *http.Request)

func Decode

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

func DecodeWithLimit

func DecodeWithLimit(res *http.Response, maxBytes int64) ([]byte, error)

func DoRequestWithOptions

func DoRequestWithOptions(cl *http.Client, rq *http.Request, op RequestOptions) ([]byte, int, error)

func DownloadToFile

func DownloadToFile(cl *http.Client, rq *http.Request, dst string, max int64) (int64, int, error)

func DownloadToFileWithTimeout

func DownloadToFileWithTimeout(cl *http.Client, rq *http.Request, dst string, max int64, per time.Duration) (int64, int, error)
func Head(cl *http.Client, raw, ref string) (http.Header, int64, string, int, error)

func InferExt

func InferExt(ct, raw, mt string) string

func NewInspectorTransport

func NewInspectorTransport(base http.RoundTripper, logPath string, hideSensitive bool) (http.RoundTripper, error)

func StreamDecode

func StreamDecode(res *http.Response) (io.ReadCloser, error)

Types

type DebouncedFn

type DebouncedFn[T any] struct {
	// contains filtered or unexported fields
}

func NewDebouncedFn

func NewDebouncedFn[T any](interval time.Duration, leading bool, fn func(T)) *DebouncedFn[T]

func (*DebouncedFn[T]) Call

func (d *DebouncedFn[T]) Call(arg T)

type GraphQLGetClient

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

func NewGraphQLGetClient

func NewGraphQLGetClient(baseURL string, timeout time.Duration, defaultHeaders map[string]string) *GraphQLGetClient

func (*GraphQLGetClient) Do

type GraphQLGetOptions

type GraphQLGetOptions struct {
	Path          string
	OperationName string
	Variables     map[string]any
	Features      map[string]any
	Headers       map[string]string
	Timeout       time.Duration
}

type GraphQLGetResponse

type GraphQLGetResponse struct {
	StatusCode int
	Headers    http.Header
	RawBody    []byte
	JSON       any
}

type HeaderEntry

type HeaderEntry struct {
	Name  string
	Value string
}

type InspectorTransport

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

func (*InspectorTransport) RoundTrip

func (t *InspectorTransport) RoundTrip(req *http.Request) (*http.Response, error)

type RequestOptions

type RequestOptions struct {
	Decode       bool
	MaxBytes     int64
	Accept       func(int) bool
	DebugLogPath string
}

type RequestOptionsRuntime

type RequestOptionsRuntime struct {
	Method      string
	URI         string
	Params      url.Values
	Headers     http.Header
	Body        []byte
	Timeout     time.Duration
	WithCookies bool
}

type Response

type Response struct {
	StatusCode int
	Status     string
	Headers    http.Header
	Body       []byte
}

func DoRequest

func DoRequest(ctx context.Context, client *http.Client, opt RequestOptionsRuntime) (*Response, error)

Jump to

Keyboard shortcuts

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