Documentation ¶
Index ¶
Constants ¶
const (
UUIDHeaderName = "HTTP-Sub-UUID"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReceivedRequest ¶
type ReceivedRequest struct { // The request the subscriber received Request *http.Request // The receipt time Time time.Time // Unique identifier of the request. will be returned as UUIDHeaderName in each // response that the subscriber sends UUID string }
ReceivedRequest represents a request that the subscriber received.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a HTTP server that you can send real HTTP requests to in your unit tests. Each request is handled by a http.Handler that you specify, and the server records each request after your handler finishes execution. You can later retreive details about each received request
func StartServer ¶
StartServer starts the server listening in the background. All requests sent to the server at s.URLStr() are sent to handler, flushed and then recorded for later retrieval using the AcceptN func
func (*Server) AcceptN ¶
func (s *Server) AcceptN(n int, maxWait time.Duration) []*ReceivedRequest
AcceptN consumes and returns up to n requests that were sent to the server before maxWait is up. returns all of the requests received. each individual request returned will not be returned by this func again.