webtest

package
v0.0.0-...-06b8776 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package webtest provides helpers for testing web applications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type W

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

W holds the configuration for a web test.

func New

func New(t *testing.T, host string) *W

New creates a web test for a given a host tring (e.g. "localhost:8080")

func (*W) Get

func (w *W) Get(path string) (*http.Response, error)

Get performs a GET request to a given path.

func (*W) GetBody

func (w *W) GetBody(path string) (body string, resp *http.Response, err error)

GetBody performs a GET request to a given path.

func (*W) NewRequest

func (w *W) NewRequest(method, path string, body io.Reader) *http.Request

NewRequest constructs a http.Request for the web tests's host.

func (*W) Post

func (w *W) Post(path, bodyType string, body io.Reader) (*http.Response, error)

Post performs a POST request to a given path.

func (*W) PostForm

func (w *W) PostForm(path string, v url.Values) (*http.Response, error)

PostForm performs a POST request to a given path.

func (*W) WaitForNet

func (w *W) WaitForNet()

WaitForNet waits for the host to come live. After a 30s timeout, it will call t.Fatal

Jump to

Keyboard shortcuts

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