httputils: github.com/Bimde/httputils Index | Files

package httputils

import "github.com/Bimde/httputils"

Package httputils is a net/http wrapper for easy outbound http requests.

Index

Package Files

methods.go options.go service.go

func AddAuth Uses

func AddAuth(username string, password string) option

AddAuth adds basic authentication to the client

type Client Uses

type Client struct {
    Username string
    Password string
}

Client provides storage for data that doesn't need to change between requests

func New Uses

func New(options ...option) *Client

New creates and returns a new Client with custom options

func (*Client) Delete Uses

func (c *Client) Delete(log *logrus.Entry, path string, body interface{}, output interface{}) error

Delete performs a DELETE request using the net/http client. Logging is done to the provided logger

func (*Client) Get Uses

func (c *Client) Get(log *logrus.Entry, path string, body interface{}, output interface{}) error

Get performs a GET request using the net/http client. Logging is done to the provided logger

func (*Client) Post Uses

func (c *Client) Post(log *logrus.Entry, path string, body interface{}, output interface{}) error

Post performs a POST request using the net/http client. Logging is done to the provided logger

func (*Client) Put Uses

func (c *Client) Put(log *logrus.Entry, path string, body interface{}, output interface{}) error

Put performs a PUT request using the net/http client. Logging is done to the provided logger

Package httputils imports 8 packages (graph) and is imported by 2 packages. Updated 2019-07-31. Refresh now. Tools for package owners.