httputil

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: Apache-2.0 Imports: 9 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoOptions

type DoOptions struct {
	Data      interface{}
	Context   context.Context
	Headers   map[string]string
	ForceJSON bool
}

DoOptions are options passed to the HTTPClient.Do function

type Error

type Error struct {
	Status  int
	Message string
}

Error is a custom HTTP error structure

func (*Error) Error

func (e *Error) Error() string

Error implemented to match Error interface

type HTTPClient

type HTTPClient struct {
	HTTPClient *http.Client
}

HTTPClient returns an HTTP Client struct that can execute HTTP requests

func NewHTTPClient

func NewHTTPClient() *HTTPClient

NewHTTPClient returns a new HTTP Client

func (*HTTPClient) Do

func (c *HTTPClient) Do(method, path string, doOptions *DoOptions) (*http.Response, error)

Do executes the given HTTP request and returns the HTTP Response

type HTTPResponse

type HTTPResponse struct {
	Raw  *http.Response
	Body string
}

HTTPResponse houses respnse object

Jump to

Keyboard shortcuts

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