Documentation ¶
Index ¶
- Constants
- func InterfaceToWriter(v interface{}, wr http.ResponseWriter)
- func New(log Logger) *server
- func Reset(url string, pth string) error
- func Serve(ctx context.Context, log Logger, addr string) error
- func ServeLis(ctx context.Context, log Logger, ln net.Listener) error
- func ServeRand(ctx context.Context, log Logger) (int, error)
- func SetGRPCResponse(url string, m proto.Message, request Request) error
- func SetJsonResponse(url string, pth string, m interface{}, headers metadata.MD, isError bool, ...) error
- func SetResponse(url string, request Request) error
- type HeaderPair
- type Logger
- type Request
Constants ¶
View Source
const HEADERMODE = "SERVERMOCK-MODE"
Variables ¶
This section is empty.
Functions ¶
func InterfaceToWriter ¶
func InterfaceToWriter(v interface{}, wr http.ResponseWriter)
func Serve ¶
Serve servers a servermock server and blocks until the server is running. Use context.WithCancel to stop the server
func SetGRPCResponse ¶
SetGRPCResponse sets the return to pth to a bytes marshaled from a proto message
func SetJsonResponse ¶
func SetJsonResponse(url string, pth string, m interface{}, headers metadata.MD, isError bool, statusCode int) error
SetGRPCResponse sets the return to pth to bytes marshaled from an interface
func SetResponse ¶
SetResponse sets the return to pth to that of b bytes
Types ¶
type HeaderPair ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.