local

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CoreProcessing

func CoreProcessing(httpResp http.ResponseWriter, httpReq *http.Request, handler function.ScwFuncV1)

CoreProcessing processes the main core

func InjectEgressHeaders

func InjectEgressHeaders(httpResp http.ResponseWriter)

InjectEgressHeaders simulates the infrastructure output layer where your FaaS will be deployed.

func InjectIngressHeaders

func InjectIngressHeaders(httpReq *http.Request)

InjectIngressHeaders simulates the infrastructure input layer where your FaaS will be deployed.

func ServeHandler

func ServeHandler(handler function.ScwFuncV1, options ...Option)

ServeHandler is the entry point for offline testing. It will serve the handler to a local webserver. Read options.go to check advanced paramenter and documentation.

Note that if handler function panics in real life it would make your function return error 500 but in order to keep error trace panic will occurs anywhen while using this testing server.

func SubProcessing

func SubProcessing(httpResp http.ResponseWriter, httpReq *http.Request) error

SubProcessing simulates speicifc go workflow that can happens in the FaaS environment. The request of the body must complies with subRuntimeRequest type to be processed.

Types

type Option

type Option func(*Server)

Option type used for option pattern to add parameters to local server.

func WithPort

func WithPort(port int) Option

WithPort can be used to select a port to run the test server, if no port given the server will use an available port given by system and print it to stdout.

type Server

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

Server represent the local server with it's parameters

Jump to

Keyboard shortcuts

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