httpx

package
v0.0.0-...-0e61348 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package httpx implements HTTP helper types and functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToJSON

func ToJSON(v any) requests.ResponseHandler

ToJSON is like requests.ToJSON but verifies that only a single value is decoded.

Types

type Client

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

Client is an HTTP client with context helpers.

This type is similar to ctxhttp's functions, but does not copy requests unnecessarily.

func NewClient

func NewClient(cli *http.Client, name string, opts ...Option) Client

func (*Client) AsOAuth2Client

func (c *Client) AsOAuth2Client(ctx context.Context) context.Context

AsOAuth2Client registers the client as the client to use in the OAuth2 library. The context returned by this function should be used when calling OAuth2 related functions.

func (*Client) NewRequest

func (c *Client) NewRequest(url string) *requests.Builder

func (*Client) NewRequestToJSON

func (c *Client) NewRequestToJSON(url string, v any) *requests.Builder

type Option

type Option func(*Client)

func WithBrowserUserAgent

func WithBrowserUserAgent() Option

func WithRetryOnServerError

func WithRetryOnServerError() Option

Jump to

Keyboard shortcuts

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