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 GRPCAnyStub
- 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 GRPCAnyStub ¶
type GRPCAnyStub struct { grpcanytesting.AnyTestServiceServer SumFunc func(context.Context, *grpcanytesting.SumRequest) (*grpcanytesting.SumReply, error) }
GRPCAnyStub is an easily customisable AnyTestServiceServer
func (*GRPCAnyStub) Sum ¶
func (s *GRPCAnyStub) Sum(ctx context.Context, req *grpcanytesting.SumRequest) (*grpcanytesting.SumReply, error)
Sum implements the interface for the gRPC AnyTestServiceServer
type GRPCStub ¶
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) FullDuplexCall ¶
func (*GRPCStub) FullDuplexCall(grpctest.TestService_FullDuplexCallServer) error
FullDuplexCall implements the interface for the gRPC TestServiceServer
func (*GRPCStub) HalfDuplexCall ¶
func (*GRPCStub) HalfDuplexCall(grpctest.TestService_HalfDuplexCallServer) error
HalfDuplexCall implements the interface for the gRPC TestServiceServer
func (*GRPCStub) StreamingInputCall ¶
func (*GRPCStub) StreamingInputCall(grpctest.TestService_StreamingInputCallServer) error
StreamingInputCall implements the interface for the gRPC TestServiceServer
func (*GRPCStub) StreamingOutputCall ¶
func (*GRPCStub) StreamingOutputCall(*grpctest.StreamingOutputCallRequest, grpctest.TestService_StreamingOutputCallServer, ) error
StreamingOutputCall implements the interface for the gRPC TestServiceServer
func (*GRPCStub) UnaryCall ¶
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 GRPCAnyStub *GRPCAnyStub 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