test_server

package
v0.0.0-...-6609015 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombineHandlers

func CombineHandlers(handlers ...http.HandlerFunc) http.HandlerFunc

func Respond

func Respond(statusCode int, body string) http.HandlerFunc

func RespondPtr

func RespondPtr(statusCode *int, body *string) http.HandlerFunc

func VerifyBasicAuth

func VerifyBasicAuth(username string, password string) http.HandlerFunc

func VerifyContentType

func VerifyContentType(contentType string) http.HandlerFunc

func VerifyHeader

func VerifyHeader(header http.Header) http.HandlerFunc

func VerifyJSON

func VerifyJSON(expectedJSON string) http.HandlerFunc

func VerifyRequest

func VerifyRequest(method string, path string, rawQuery ...string) http.HandlerFunc

Types

type Server

type Server struct {
	HTTPTestServer *httptest.Server

	AllowUnhandledRequests     bool
	UnhandledRequestStatusCode int
	// contains filtered or unexported fields
}

func New

func New() *Server

func NewTLS

func NewTLS() *Server

func (*Server) Append

func (s *Server) Append(handlers ...http.HandlerFunc)

func (*Server) Close

func (s *Server) Close()

func (*Server) Get

func (s *Server) Get(index int) http.HandlerFunc

func (*Server) ReceivedRequestsCount

func (s *Server) ReceivedRequestsCount() int

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Server) Set

func (s *Server) Set(index int, handler http.HandlerFunc)

func (*Server) URL

func (s *Server) URL() string

func (*Server) Wrap

func (s *Server) Wrap(index int, handler http.HandlerFunc)

Jump to

Keyboard shortcuts

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