httpclient

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package httpclient ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadBody

func ReadBody(body *io.ReadCloser) ([]byte, error)

ReadBody read body without draining it

func RequestFromFile

func RequestFromFile(filepath string) (*http.Request, error)

RequestFromFile loads request data from file and creates a new http.Request request file should be in HTTP/1.x wire representation format

Types

type HTTPClient

type HTTPClient struct {
	Client *http.Client
	// contains filtered or unexported fields
}

HTTPClient keeps client and its configuration

func New

func New(timeout time.Duration, ua useragent.UserAgent, noFollow bool) HTTPClient

New creates a new HTTPClient

func (*HTTPClient) NewRequest

func (h *HTTPClient) NewRequest(method string, url *url.URL, body io.Reader) (*http.Request, error)

NewRequest creates a new http.Request

func (*HTTPClient) NewRequestFromFile

func (h *HTTPClient) NewRequestFromFile(filepath string) (*http.Request, error)

NewRequestFromFile calls RequestFromFile

func (*HTTPClient) ReadBody

func (h *HTTPClient) ReadBody(body *io.ReadCloser) ([]byte, error)

ReadBody reads body without draining it

Jump to

Keyboard shortcuts

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