server

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mock

func Mock() (*httptest.Server, chan HandledRequest, func())

func MockService

func MockService(
	urlKey, urlSuffix string,
	handler func(w http.ResponseWriter, r *http.Request),
) *httptest.Server

Types

type ConfigItem

type ConfigItem struct {
	Status int
	Value  string
	Resp   MockResp
}

type HandledRequest

type HandledRequest struct {
	W http.ResponseWriter
	R *http.Request
	B []byte
}

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

type MockResp

type MockResp map[string]any

type MockServiceConfig

type MockServiceConfig struct {
	// contains filtered or unexported fields
}

func NewMockServiceConfig

func NewMockServiceConfig() *MockServiceConfig

func (*MockServiceConfig) HandledRequestsCount

func (m *MockServiceConfig) HandledRequestsCount() int

func (*MockServiceConfig) SetConfigs

func (m *MockServiceConfig) SetConfigs(configSlice ...ConfigItem) *MockServiceConfig

func (*MockServiceConfig) SetURLKey

func (m *MockServiceConfig) SetURLKey(key string) *MockServiceConfig

func (*MockServiceConfig) SetURLSuffix

func (m *MockServiceConfig) SetURLSuffix(suffix string) *MockServiceConfig

func (*MockServiceConfig) StartServer

func (m *MockServiceConfig) StartServer() *httptest.Server

Jump to

Keyboard shortcuts

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