package http
import "github.com/stretchr/testify/http"
A set of tools to make testing http activity using the Go testing system easier.
Index ¶
- type TestResponseWriter
- func (rw *TestResponseWriter) Header() http.Header
- func (rw *TestResponseWriter) Write(bytes []byte) (int, error)
- func (rw *TestResponseWriter) WriteHeader(i int)
- type TestRoundTripper
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 ¶
func (*TestRoundTripper) RoundTrip ¶
Source Files ¶
doc.go test_response_writer.go test_round_tripper.go
- Version
- v1.1.2
- Published
- Jan 9, 2016
- Platform
- js/wasm
- Imports
- 2 packages
- Last checked
- 1 minute ago –
Tools for package owners.