// WaitRequest waits at most `timeout` for a request to be sent to the server.
//
// It returns the request pointer, the body of the request and a nil error in
// case of success, or an error if the operation times out.
//
// Example of call:
//
//     req, body, err := server.WaitRequest(10e9)
//
// The call above will wait at most 10 seconds for a request to come to the
// server.
WaitRequest waits at most `timeout` for a request to be sent to the server.

It returns the request pointer, the body of the request and a nil error in
case of success, or an error if the operation times out.

Example of call.

req, body, err := server.WaitRequest(10e9)

The call above will wait at most 10 seconds for a request to come to the
server.
// WaitRequest waits at most ` timeout ` for a request to be sent to the server . // // It returns the request pointer the body of the request and a nil error in // case of success or an error if the operation times out . // // Example of call : // // req body err : = server . WaitRequest ( 10e9 ) // // The call above will wait at most 10 seconds for a request to come to the // server .
func (s *TestHTTPServer) WaitRequest(timeout time.Duration) (*http.Request, []byte, error) {
	select {
	case req := <-s.Request:
		b := <-s.body
		return req, b, nil
	case <-time.After(timeout):
	}
	return nil, nil, errors.New("timed out")
}
func ( s * TestHTTPServer ) WaitRequest ( timeout time . Duration ) ( * http . Request , [ ] byte , error ) { select { case req := <- s . Request : b := <- s . body return req , b , nil case <- time . After ( timeout ) : } return nil , nil , errors . New ( " " ) }
WaitRequest waits at most `timeout` for a request to be sent to the server.
WaitRequest waits at most ` timeout ` for a request to be sent to the server .