http

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2016 License: MIT, MIT Imports: 2 Imported by: 0

Documentation

Overview

A set of tools to make testing http activity using the Go testing system easier.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestResponseWriter

type TestResponseWriter struct {

	// StatusCode is the last int written by the call to WriteHeader(int)
	StatusCode int

	// Output is a string containing the written bytes using the Write([]byte) func.
	Output string
	// contains filtered or unexported fields
}

TestResponseWriter is a http.ResponseWriter object that keeps track of all activity allowing you to make assertions about how it was used.

DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead.

func (*TestResponseWriter) Header

func (rw *TestResponseWriter) Header() http.Header

Header gets the http.Header describing the headers that were set in this response.

func (*TestResponseWriter) Write

func (rw *TestResponseWriter) Write(bytes []byte) (int, error)

Write writes the specified bytes to Output.

func (*TestResponseWriter) WriteHeader

func (rw *TestResponseWriter) WriteHeader(i int)

WriteHeader stores the HTTP status code in the StatusCode.

type TestRoundTripper

type TestRoundTripper struct {
	mock.Mock
}

func (*TestRoundTripper) RoundTrip

func (t *TestRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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