http

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrResourceNotFound       = errors.New("resource not found")
	ErrAuthenticationRequired = errors.New("authentication required")
	ErrAuthorizationFailed    = errors.New("authorization failed")
)

Functions

func ClientFromOpts

func ClientFromOpts(opts ClientOpts) *http.Client

func NewErr

func NewErr(r *http.Response) error

NewErr returns a new Err based on a http response

Types

type ClientOpts

type ClientOpts struct {
	Verbose  bool
	Insecure bool
	Timeout  time.Duration
}

type Err

type Err struct {
	Response *http.Response
}

Err is a dedicated error to return errors based on status code

func (*Err) Error

func (e *Err) Error() string

func (*Err) StatusCode

func (e *Err) StatusCode() int

StatusCode returns the status code of the response

type UnexpectedError

type UnexpectedError struct {
	Err error
}

func NewUnexpectedError

func NewUnexpectedError(err error) *UnexpectedError

func (*UnexpectedError) Error

func (e *UnexpectedError) Error() string

Jump to

Keyboard shortcuts

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