http

package
v0.0.0-...-d3b0170 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config is used to specify configuration for httpwrapper

func NewConfig

func NewConfig() *Config

NewConfig Creates and initialises config to default values

func (*Config) AddHeader

func (c *Config) AddHeader(k, v string)

AddHeader is used to add new HTTP header for all requests. k - key of header (Authorisation etc.) v - Value of the header

func (*Config) SetRetries

func (c *Config) SetRetries(retries int)

SetRetries is used to set number of reties

func (*Config) SetRetryFactor

func (c *Config) SetRetryFactor(factor float64)

SetRetryFactor is used to set retry factor for exponential backoff

func (*Config) SetTimeout

func (c *Config) SetTimeout(timeout int)

SetTimeout is used to Set timeout for each HTTP requests

type HttpWrapper

type HttpWrapper interface {
	MakeRequest(method, url, name string, req, res interface{}) (int, error)
}

HttpWrapper is the abstracted interface of http

func New

func New(config *Config, l *log.Logger) HttpWrapper

New is used to get new HTTP wrapper object

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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