httputils

package module
Version: v0.0.0-...-ba21fc6 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2019 License: MIT Imports: 8 Imported by: 2

README

GoDoc Go Report Card

HTTP Client Library for Go

net/http wrapper for easy outbound http requests in go.

How to use

Documentation isn't written yet. This wrapper was purpose-built for this project, making it a great place to look for code samples.

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAuth

func AddAuth(username string, password string) option

AddAuth adds basic authentication to the client

Types

type Client

type Client struct {
	Username string
	Password string
}

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

func New

func New(options ...option) *Client

New creates and returns a new Client with custom options

func (*Client) Delete

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

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

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL