http

package
v1.1.29 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpRequestor

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

HttpRequestor implements the Requestor interface

func (*HttpRequestor) DoRequest

func (r *HttpRequestor) DoRequest(ctx context.Context, method, url string, options RequestOptions) (RequestResponse, error)

DoRequest executes and parsed the response of an http request

type RequestOptions

type RequestOptions struct {
	Body    []byte
	Headers http.Header
	Cookies []*http.Cookie
}

RequestOptions is the data to configure an http request sent by a Requestor

type RequestResponse

type RequestResponse struct {
	Body        []byte
	ContentType string
	StatusCode  int
	Headers     http.Header
}

RequestResponse is the data returned by a Requestor

type Requestor

type Requestor interface {
	DoRequest(ctx context.Context, method, url string, options RequestOptions) (RequestResponse, error)
}

Requestor is an interface for making http requests

func NewRequestor

func NewRequestor(c *http.Client) Requestor

NewRequestor returns a Requestor with a default client if one is not passed

Jump to

Keyboard shortcuts

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