Documentation
¶
Index ¶
- func CORS(next http.Handler) http.Handler
- func Command() *cobra.Command
- func RunServer(flags *Flags) error
- func Setup(mux *http.ServeMux, eng *engine.Engine, key, secret, data, baseURL string) (io.Closer, error)
- type FakeHandler
- func (h FakeHandler) Account(w http.ResponseWriter, r *http.Request)
- func (h FakeHandler) CreateToken(w http.ResponseWriter, r *http.Request)
- func (h FakeHandler) DeleteFile(w http.ResponseWriter, _ *http.Request, id string)
- func (h FakeHandler) DeleteToken(w http.ResponseWriter, _ *http.Request, id string)
- func (h FakeHandler) DeleteTrace(w http.ResponseWriter, _ *http.Request, id string)
- func (h FakeHandler) Ping(w http.ResponseWriter, r *http.Request)
- func (h FakeHandler) ProcessFile(w http.ResponseWriter, r *http.Request)
- func (h FakeHandler) ProcessFileAsync(w http.ResponseWriter, r *http.Request)
- func (h FakeHandler) ProcessFileFetch(w http.ResponseWriter, r *http.Request)
- func (h FakeHandler) RetrieveFile(w http.ResponseWriter, _ *http.Request, id string)
- func (h FakeHandler) RetrieveToken(w http.ResponseWriter, _ *http.Request, id string)
- func (h FakeHandler) RetrieveTrace(w http.ResponseWriter, _ *http.Request, id string)
- type Flags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CORS ¶ added in v1.6.0
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 RunServer ¶
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) (io.Closer, error)
Setup registers the mock API's routes on mux, keeping records in the data directory. It fails only if that directory cannot be opened. The returned closer releases the directory; Windows cannot remove it while it is open.
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) DeleteFile ¶ added in v1.11.0
func (h FakeHandler) DeleteFile(w http.ResponseWriter, _ *http.Request, id string)
func (FakeHandler) DeleteToken ¶
func (h FakeHandler) DeleteToken(w http.ResponseWriter, _ *http.Request, id string)
func (FakeHandler) DeleteTrace ¶ added in v1.12.0
func (h FakeHandler) DeleteTrace(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.