requests

package module
v0.0.0-...-6ac54c9 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version = "1.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request interface {
	SetHeader(string, ...string) Request
	Headers() map[string][]string

	SetQueryParam(string, ...string) Request
	QueryParams() map[string][]string
	UrlPath() string
	SetJSON(string) Request
	SetRawBody([]byte) Request

	SetFormParam(string, ...string) Request
	FormParams() map[string][]string

	AddFile(string, string, []byte) Request

	Send() (Response, error)
}

func Delete

func Delete(urlPath string) (Request, error)

func Get

func Get(urlPath string) (Request, error)
func Head(urlPath string) (Request, error)

func Method

func Method(method string, urlPath string) (Request, error)

Thread-safe version implementations of the seven HTTP methods, but also do not have a cookiejar

func Options

func Options(urlPath string) (Request, error)

func Patch

func Patch(urlPath string) (Request, error)

func Post

func Post(urlPath string) (Request, error)

func Put

func Put(urlPath string) (Request, error)

type Response

type Response interface {
	StatusCode() int
	Headers() map[string][]string
	Protocol() string
	Body() []byte
	ContentLength() int64
}

type Session

type Session interface {
	// TODO: implement timeout
	// SetTimeout(time.Duration) Session
	// Timeout() time.Duration
	SetCookies(map[string]string) Session
	Cookies() map[string]string

	Method(string, string) (Request, error)
	Get(string) (Request, error)
	Post(string) (Request, error)
	Put(string) (Request, error)
	Delete(string) (Request, error)
	Head(string) (Request, error)
	Options(string) (Request, error)
	Patch(string) (Request, error)
}

func NewSession

func NewSession() Session

Create a session

Jump to

Keyboard shortcuts

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