request

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BearerAuthorization = "Bearer"
)

Variables

View Source
var (
	HeaderUserAgent     = http.CanonicalHeaderKey("User-Agent")
	HeaderAuthorization = http.CanonicalHeaderKey("Authorization")
	HeaderLocation      = http.CanonicalHeaderKey("Location")
)
View Source
var (
	ErrUnauthorized  = errors.New("unauthorized")
	ErrForbidden     = errors.New("forbidden")
	ErrClientError   = errors.New("client error")
	ErrServerError   = errors.New("server error")
	ErrNoRedirection = errors.New("no redirection")
)

Functions

func Get

func Get(context Context, uri string, result interface{}) error

func GetLocation

func GetLocation(context Context, uri string) (*url.URL, error)

func Patch

func Patch(context Context, uri string, body interface{}, result interface{}) error

func Post

func Post(context Context, uri string, body interface{}, result interface{}) error

Types

type Context

type Context interface {
	Endpoint() string
	Headers() Headers
}

type Headers

type Headers map[string]string

func NewHeaders

func NewHeaders() Headers

func (Headers) Authorization

func (h Headers) Authorization(bearer string) Headers

func (Headers) UserAgent

func (h Headers) UserAgent(value string) Headers

Jump to

Keyboard shortcuts

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