server

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 27 Imported by: 0 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS added in v1.6.0

func CORS(next http.Handler) http.Handler

CORS wraps a handler so browser-based clients can call the mock from a different origin. The header set mirrors what the real Scanii API serves in production. OPTIONS preflight requests are answered with 200 + the Access-Control headers and do not reach the wrapped handler.

func Command

func Command() *cobra.Command

Command returns the server cobra command.

func RunServer

func RunServer(flags *Flags) error

RunServer starts the mock Scanii server. This function blocks until the server stops, and returns an error if it could not be started.

func Setup

func Setup(mux *http.ServeMux, eng *engine.Engine, key, secret, data, baseURL string)

Types

type FakeHandler

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

func (FakeHandler) Account

func (h FakeHandler) Account(w http.ResponseWriter, r *http.Request)

func (FakeHandler) CreateToken

func (h FakeHandler) CreateToken(w http.ResponseWriter, r *http.Request)

func (FakeHandler) DeleteToken

func (h FakeHandler) DeleteToken(w http.ResponseWriter, _ *http.Request, id string)

func (FakeHandler) Ping

func (h FakeHandler) Ping(w http.ResponseWriter, r *http.Request)

func (FakeHandler) ProcessFile

func (h FakeHandler) ProcessFile(w http.ResponseWriter, r *http.Request)

func (FakeHandler) ProcessFileAsync

func (h FakeHandler) ProcessFileAsync(w http.ResponseWriter, r *http.Request)

func (FakeHandler) ProcessFileFetch

func (h FakeHandler) ProcessFileFetch(w http.ResponseWriter, r *http.Request)

func (FakeHandler) RetrieveFile

func (h FakeHandler) RetrieveFile(w http.ResponseWriter, _ *http.Request, id string)

func (FakeHandler) RetrieveToken

func (h FakeHandler) RetrieveToken(w http.ResponseWriter, _ *http.Request, id string)

func (FakeHandler) RetrieveTrace added in v1.4.0

func (h FakeHandler) RetrieveTrace(w http.ResponseWriter, _ *http.Request, id string)

type Flags

type Flags struct {
	Address   string
	Engine    string
	Key       string
	Secret    string
	Data      string
	ReadyChan chan bool
	// CallBackWait overrides the engine's callback delay. Nil means the engine
	// config decides, which is what keeps an unpassed flag from overriding a
	// value set in an --engine file.
	CallBackWait *time.Duration
}

Flags holds configuration for the mock server.

Jump to

Keyboard shortcuts

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