utils

package
v2.2.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapMerge

func MapMerge(base map[string]string, new map[string]string) map[string]string

MapMerge merges two maps together and returns the results. If both maps contain the same key, then the value of the existing key will be overwritten with the value from the new map

Types

type FakeHandler

type FakeHandler struct {
	RequestReceived *http.Request
	RequestBody     string
	StatusCode      int
	RespondBody     string
	T               LogInterface
}

FakeHandler is to assist in testing HTTP requests

func (*FakeHandler) ServeHTTP

func (f *FakeHandler) ServeHTTP(response http.ResponseWriter, request *http.Request)

func (*FakeHandler) Validate

func (f *FakeHandler) Validate(expectedPath string, expectedMethod string, expectedBody *string) error

Validate verifies that FakeHandler received a request with expected path, method, and body.

type LogInterface

type LogInterface interface {
	Errorf(format string, args ...interface{})
	Logf(format string, args ...interface{})
}

LogInterface is a simple interface providing Errorf an Logf

Jump to

Keyboard shortcuts

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