Documentation
¶
Overview ¶
Package mocking provides mock responses
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServerFilter ¶
func ServerFilter(ctx context.Context, req interface{}, handler filter.ServerHandleFunc) (interface{}, error)
ServerFilter is the server interceptor
Types ¶
type Options ¶
type Options struct { // Delay in milliseconds before returning the response, default is 0 Delay int `yaml:"delay"` // HTTP status code of the response, default is 200 ResponseStatus int `yaml:"response_status"` // Content-Type header of the response, default is "application/json" ContentType string `yaml:"content_type"` // Body of the response ResponseExample string `yaml:"response_example"` // When set to true, adds the response header "x-mock-by: tRPC-Gateway". When set to false, the header is not added. WithMockHeader bool `yaml:"with_mock_header"` // Mock traffic ratio, in percentage. For example, if it is one in ten thousand, fill in: 0.01. The default is // full mock. Scale float64 `yaml:"scale" json:"scale"` // Hash key for mock traffic, providing the ability to perform grayscale based on request parameters. HashKey string `yaml:"hash_key" json:"hash_key"` }
Options represents the plugin configuration
Click to show internal directories.
Click to hide internal directories.