goreq

package module
v0.0.0-...-b6b6f54 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2018 License: MIT Imports: 9 Imported by: 0

README

goreq

A simplified HTTP request library

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(URL string, opt *Option) (*http.Response, error)

func Post

func Post(URL string, opt *Option) (*http.Response, error)

Types

type File

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

type Option

type Option struct {
	Header  map[string]string
	Timeout time.Duration
	Proxy   string
	Data    url.Values
	Param   url.Values
	Json    map[string]interface{}
}

type Session

type Session struct {
	Client    *http.Client
	Transport *http.Transport
}

func NewSession

func NewSession() *Session

initiate a session

func (Session) Get

func (s Session) Get(URL string, opt *Option) (*http.Response, error)

wrap a GET method

func (Session) Post

func (s Session) Post(URL string, opt *Option) (*http.Response, error)

wrap a POST method

func (*Session) Request

func (s *Session) Request(method, URL string, opt *Option) (*http.Response, error)

build a new Request

Jump to

Keyboard shortcuts

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