httprequest

package
v0.0.0-...-37004a0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

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

func New

func New(method string, url string, body io.Reader) (*Request, error)

New creates a new request with the given method, url and body.

func (*Request) Do

func (r *Request) Do() (*http.Response, error)

Do sends the request and returns the response.

func (*Request) GetBody

func (r *Request) GetBody() (*bytes.Buffer, error)

GetBody reads the request body and returns it as a bytes.Buffer. The request body is then reset to its original state.

func (*Request) SetHeader

func (r *Request) SetHeader(key string, value string)

SetHeader sets the header with the given key and value.

func (*Request) Sign

func (r *Request) Sign(privateKeyPEM []byte, actorURI string) error

Sign adds required headers and signs the request with the given private key. In order for this function to work properly make sure that the request URL and body are set.

Jump to

Keyboard shortcuts

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