httpmultibin

package
v0.46.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2023 License: AGPL-3.0 Imports: 27 Imported by: 2

Documentation

Overview

Package httpmultibin is indended only for use in tests, do not import in production code!

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTLSClientConfig

func GetTLSClientConfig(t testing.TB, srv *httptest.Server) *tls.Config

GetTLSClientConfig returns a TLS config that trusts the supplied httptest.Server certificate as well as all the system root certificates

Types

type GRPCAnyStub added in v0.39.0

GRPCAnyStub is an easily customisable AnyTestServiceServer

func (*GRPCAnyStub) Sum added in v0.39.0

Sum implements the interface for the gRPC AnyTestServiceServer

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

func (s *GRPCStub) EmptyCall(ctx context.Context, req *grpctest.Empty) (*grpctest.Empty, error)

EmptyCall implements the interface for the gRPC TestServiceServer

func (*GRPCStub) FullDuplexCall added in v0.32.0

FullDuplexCall implements the interface for the gRPC TestServiceServer

func (*GRPCStub) HalfDuplexCall added in v0.32.0

HalfDuplexCall implements the interface for the gRPC TestServiceServer

func (*GRPCStub) StreamingInputCall added in v0.32.0

StreamingInputCall implements the interface for the gRPC TestServiceServer

func (*GRPCStub) StreamingOutputCall added in v0.32.0

StreamingOutputCall implements the interface for the gRPC TestServiceServer

func (*GRPCStub) UnaryCall added in v0.32.0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL