httpx

package
v0.0.0-...-089ce19 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package http provides a simpler http.Client abstraction and derivative uses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicClient

type BasicClient interface {
	Do(*http.Request) (*http.Response, error)
}

BasicClient is a simpler http.Client that only requires a Do method.

type CachedClient

type CachedClient struct {
	BasicClient
	// contains filtered or unexported fields
}

CachedClient is a BasicClient that caches responses.

func NewCachedClient

func NewCachedClient(client BasicClient, c cache.Cache) *CachedClient

NewCachedClient returns a new CachedClient.

func (*CachedClient) Do

func (cc *CachedClient) Do(req *http.Request) (*http.Response, error)

Do attempts to fetch from cache (if applicable) or fulfills the request using the underlying client.

type WithUserAgent

type WithUserAgent struct {
	BasicClient
	UserAgent string
}

WithUserAgent is a basic HTTP client that adds a User-Agent header.

func (*WithUserAgent) Do

func (c *WithUserAgent) Do(req *http.Request) (*http.Response, error)

Do adds the User-Agent header and sends the request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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