server

package
v0.0.0-...-26c1479 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Market is the market sesion.

View Source
var Verbose = false

Verbose controls log printing.

View Source
var Version string

Version is the mock server version number.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Handle(r *http.Request, rte *regexp.Regexp) (statusCode int, responseData interface{})
}

Handler takes care of requests based on resource types.

type MarketState

type MarketState string

MarketState is a market session.

const (
	// MarketStatePre genius.
	MarketStatePre MarketState = "pre"

	// MarketStateRegular genius.
	MarketStateRegular MarketState = "regular"

	// MarketStatePost genius.
	MarketStatePost MarketState = "post"
)

type StubServer

type StubServer struct {
	Spec     *fixture.Spec
	Fixtures *fixture.Fixtures
	// contains filtered or unexported fields
}

StubServer handles incoming HTTP requests and responds to them appropriately based off the set of routes that it's been configured with.

func (*StubServer) HandleConfigRequest

func (s *StubServer) HandleConfigRequest(w http.ResponseWriter, r *http.Request)

HandleConfigRequest handles an HTTP port directed at the API config stub.

func (*StubServer) HandleRequest

func (s *StubServer) HandleRequest(w http.ResponseWriter, req *http.Request)

HandleRequest handles an HTTP request directed at the API stub.

func (*StubServer) InitRouter

func (s *StubServer) InitRouter() error

InitRouter maps server routes to handlers.

type YFinService

type YFinService struct {
	Service   *fixture.Service
	Resources fixture.Resources
}

YFinService is a service that manages yahoo finance requests.

func (*YFinService) Handle

func (y *YFinService) Handle(req *http.Request, rte *regexp.Regexp) (statusCode int, responseData interface{})

Handle validates a request and returns a response.

Jump to

Keyboard shortcuts

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