server

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type HTTPServer

type HTTPServer struct {
	Port string

	PathToMockId map[string]string
	// contains filtered or unexported fields
}

HTTPServer represents a http server struct

func NewHTTPServer

func NewHTTPServer(
	port string,
	ssl SSL,
	workingDirectory string,
	totalNumberRequestsAllowed int,
	mocker internal.Mocker,
	logger logsutil.Logger,
	version string) *HTTPServer

NewHTTPServer creates and initializes a {HTTPServer} struct

func (HTTPServer) Listen

func (s HTTPServer) Listen() error

Listen creates the http server and dispatches the incoming requests

type MockedRequestLightWithLinks struct {
	internal.MockedRequestLight
	Links map[string]string `json:"_links,omitempty"`
}

type Response

type Response struct {
	ResponseWriter http.ResponseWriter
	DelayMax       time.Duration
}

Response represents a {http.ResponseWriter} from the HTTP request

func NewResponse

func NewResponse(responseWriter http.ResponseWriter, delayMax string) Response

NewResponse creates and initializes a {Response} struct

func (Response) Write

func (r Response) Write(mock internal.MockedRequest, delay string)

Write writes the http response using the provided {mock} value and delays the response {delay} parameter is setted

type SSL added in v1.0.2

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

func NewSSL added in v1.0.2

func NewSSL(enabled bool, directory, crtFile, keyFile string) SSL

Jump to

Keyboard shortcuts

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