Documentation ¶
Overview ¶
Package httpmultibin is indended only for use in tests, do not import in production code!
Index ¶
- func GetTLSClientConfig(t testing.TB, srv *httptest.Server) *tls.Config
- type GRPCStub
- func (s *GRPCStub) EmptyCall(ctx context.Context, req *grpctest.Empty) (*grpctest.Empty, error)
- func (*GRPCStub) FullDuplexCall(grpctest.TestService_FullDuplexCallServer) error
- func (*GRPCStub) HalfDuplexCall(grpctest.TestService_HalfDuplexCallServer) error
- func (*GRPCStub) StreamingInputCall(grpctest.TestService_StreamingInputCallServer) error
- func (*GRPCStub) StreamingOutputCall(*grpctest.StreamingOutputCallRequest, ...) error
- func (s *GRPCStub) UnaryCall(ctx context.Context, req *grpctest.SimpleRequest) (*grpctest.SimpleResponse, error)
- type HTTPMultiBin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GRPCStub ¶ added in v0.32.0
type GRPCStub struct { grpctest.TestServiceServer EmptyCallFunc func(context.Context, *grpctest.Empty) (*grpctest.Empty, error) UnaryCallFunc func(context.Context, *grpctest.SimpleRequest) (*grpctest.SimpleResponse, error) }
GRPCStub is an easily customisable TestServiceServer
func (*GRPCStub) EmptyCall ¶ added in v0.32.0
EmptyCall implements the interface for the gRPC TestServiceServer
func (*GRPCStub) FullDuplexCall ¶ added in v0.32.0
func (*GRPCStub) FullDuplexCall(grpctest.TestService_FullDuplexCallServer) error
FullDuplexCall implements the interface for the gRPC TestServiceServer
func (*GRPCStub) HalfDuplexCall ¶ added in v0.32.0
func (*GRPCStub) HalfDuplexCall(grpctest.TestService_HalfDuplexCallServer) error
HalfDuplexCall implements the interface for the gRPC TestServiceServer
func (*GRPCStub) StreamingInputCall ¶ added in v0.32.0
func (*GRPCStub) StreamingInputCall(grpctest.TestService_StreamingInputCallServer) error
StreamingInputCall implements the interface for the gRPC TestServiceServer
func (*GRPCStub) StreamingOutputCall ¶ added in v0.32.0
func (*GRPCStub) StreamingOutputCall(*grpctest.StreamingOutputCallRequest, grpctest.TestService_StreamingOutputCallServer, ) error
StreamingOutputCall implements the interface for the gRPC TestServiceServer
func (*GRPCStub) UnaryCall ¶ added in v0.32.0
func (s *GRPCStub) UnaryCall(ctx context.Context, req *grpctest.SimpleRequest) (*grpctest.SimpleResponse, error)
UnaryCall implements the interface for the gRPC TestServiceServer
type HTTPMultiBin ¶
type HTTPMultiBin struct { Mux *http.ServeMux ServerHTTP *httptest.Server ServerHTTPS *httptest.Server ServerHTTP2 *httptest.Server ServerGRPC *grpc.Server GRPCStub *GRPCStub Replacer *strings.Replacer TLSClientConfig *tls.Config Dialer *netext.Dialer HTTPTransport *http.Transport Context context.Context }
HTTPMultiBin can be used as a local alternative of httpbin.org. It offers both http and https servers, as well as real domains
func NewHTTPMultiBin ¶
func NewHTTPMultiBin(t testing.TB) *HTTPMultiBin
NewHTTPMultiBin returns a fully configured and running HTTPMultiBin