http

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserAgent string

Keeps once created User-Agent string

Functions

This section is empty.

Types

type Error

type Error struct {
	StatusCode int
	Code       string
	Message    string
	Err        error
	RetryAfter uint
}

Error represent error response from InfluxDBServer or http error

func NewError

func NewError(err error) *Error

NewError returns newly created Error initialised with nested error and default values

func (*Error) Error

func (e *Error) Error() string

Error fulfils error interface

type RequestCallback

type RequestCallback func(req *http.Request)

Http operation callbacks

type ResponseCallback

type ResponseCallback func(resp *http.Response) error

type Service

type Service interface {
	PostRequest(ctx context.Context, url string, body io.Reader, requestCallback RequestCallback, responseCallback ResponseCallback) *Error
	GetRequest(ctx context.Context, url string, requestCallback RequestCallback, responseCallback ResponseCallback) *Error
	DoHttpRequest(req *http.Request, requestCallback RequestCallback, responseCallback ResponseCallback) *Error
	DoHttpRequestWithResponse(req *http.Request, requestCallback RequestCallback) (*http.Response, error)
	SetAuthorization(authorization string)
	Authorization() string
	HttpClient() *http.Client
	ServerApiUrl() string
	ServerUrl() string
}

Service handles HTTP operations with taking care of mandatory request headers

func NewService

func NewService(serverUrl, authorization string, httpOptions *http2.Options) Service

NewService creates instance of http Service with given parameters

Jump to

Keyboard shortcuts

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