Documentation ¶
Index ¶
- Constants
- type Expectation
- func (e *Expectation) Handle(fn http.HandlerFunc)
- func (e *Expectation) Header(k, v string) *Expectation
- func (e *Expectation) Returns(status int, body []byte)
- func (e *Expectation) ReturnsStatus(status int)
- func (e *Expectation) ReturnsString(status int, body string)
- func (e *Expectation) Times(times int) *Expectation
- type Server
Constants ¶
View Source
const (
// Anything is used where the expectation should not be considered.
Anything = "httpx/httptest.Anything"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expectation ¶
type Expectation struct {
// contains filtered or unexported fields
}
Expectation represents an http request expectation.
func (*Expectation) Handle ¶
func (e *Expectation) Handle(fn http.HandlerFunc)
Handle sets the HTTP handler function to be run on the request.
func (*Expectation) Header ¶
func (e *Expectation) Header(k, v string) *Expectation
Header sets the HTTP headers that should be returned.
func (*Expectation) Returns ¶
func (e *Expectation) Returns(status int, body []byte)
Returns sets the HTTP stats and body bytes to return.
func (*Expectation) ReturnsStatus ¶
func (e *Expectation) ReturnsStatus(status int)
ReturnsStatus sets the HTTP stats code to return.
func (*Expectation) ReturnsString ¶
func (e *Expectation) ReturnsString(status int, body string)
ReturnsString sets the HTTP stats and body string to return.
func (*Expectation) Times ¶
func (e *Expectation) Times(times int) *Expectation
Times sets the number of times the request can be made.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents a mock http server.
func (*Server) AssertExpectations ¶
func (s *Server) AssertExpectations()
AssertExpectations asserts all expectations have been met.
func (*Server) On ¶
func (s *Server) On(method, path string) *Expectation
On creates an expectation of a request on the server.
Click to show internal directories.
Click to hide internal directories.