{"modulePath":"github.com/blackbirdworks/semaphore","version":"v1.2.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package httpsink\n\nPackage httpsink is a local HTTP endpoint for tests: it answers every request with a fixed status and keeps what it received, so a test drives a component through its real HTTP client and checks the request it sent.\n\n## Functions\n\n```go\nfunc Unreachable(tb testing.TB) string\n```\nUnreachable returns the URL of an endpoint that is not listening: a call to it fails with \"connection refused\". The port is fixed, not a closed test server, because the port of a closed server is soon given to another one.\n\n## Types\n\n```go\ntype Request struct {\n\tHeader http.Header\n\tMethod string\n\tPath   string\n\tQuery  string\n\tBody   string\n}\n```\nRequest is what the sink received.\n\n```go\ntype Sink struct {\n\tURL string\n\t// contains filtered or unexported fields\n}\n```\nSink is a running endpoint; it stops with the test.\n\n```go\nfunc New(tb testing.TB, status int) *Sink\n```\nNew starts an endpoint that answers every request with the status.\n\n```go\nfunc (s *Sink) Requests() []Request\n```\nRequests returns the requests received so far, oldest first.\n\n","path":"github.com/blackbirdworks/semaphore/testhelpers/httpsink","name":"httpsink","synopsis":"Package httpsink is a local HTTP endpoint for tests: it answers every request with a fixed status and keeps what it received, so a test drives a component through its real HTTP client and checks the request it sent.","isRedistributable":true}
