testutils

package
v0.0.0-...-8d49f51 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(url string, opts ...ReqOption) (*http.Response, []byte, error)

func MakeRequest

func MakeRequest(url string, opts ...ReqOption) (*http.Response, []byte, error)

func NewHandler

func NewHandler(handler http.HandlerFunc) *httptest.Server

func NewResponder

func NewResponder(response string) *httptest.Server

func ParseURI

func ParseURI(uri string) *url.URL

ParseURI is the version of url.ParseRequestURI that panics if incorrect, helpful to shorten the tests

Types

type ReqOption

type ReqOption func(o *ReqOpts) error

func BasicAuth

func BasicAuth(username, password string) ReqOption

func Body

func Body(b string) ReqOption
func Header(name, val string) ReqOption

func Headers

func Headers(h http.Header) ReqOption

func Host

func Host(h string) ReqOption

func Method

func Method(m string) ReqOption

type ReqOpts

type ReqOpts struct {
	Host    string
	Method  string
	Body    string
	Headers http.Header
	Auth    *utils.BasicAuth
}

Jump to

Keyboard shortcuts

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