testutils

package
v0.0.0-...-bf0e6ba Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2018 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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