testutils

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2018 License: AGPL-3.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testutils 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.T, 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 HTTPMultiBin

type HTTPMultiBin struct {
	Mux             *http.ServeMux
	ServerHTTP      *httptest.Server
	ServerHTTPS     *httptest.Server
	Replacer        *strings.Replacer
	TLSClientConfig *tls.Config
	Dialer          *netext.Dialer
	HTTPTransport   *http.Transport
	Cleanup         func()
}

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.T) *HTTPMultiBin

NewHTTPMultiBin returns a fully configured and running HTTPMultiBin

Jump to

Keyboard shortcuts

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