Documentation
¶
Index ¶
- Variables
- func Dump() gin.HandlerFunc
- func DumpFunc(cb Callback) gin.HandlerFunc
- func DumpWithOptions(opts ...Option) gin.HandlerFunc
- func FormatJsonBytes(data []byte, hiddenFields []string, compactInArray bool) ([]byte, error)
- func FormatToJson(v any, hiddenFields []string, compactInArray bool) ([]byte, error)
- type Callback
- type Option
Constants ¶
This section is empty.
Variables ¶
var ( StringMaxLength = 0 Newline = "\n" Indent = 4 )
Functions ¶
func DumpFunc ¶
func DumpFunc(cb Callback) gin.HandlerFunc
DumpFunc dumps the requests and responses, passes the dumped information to your callback function, allowing you to consume the dumped information in your own way.
func DumpWithOptions ¶
func DumpWithOptions(opts ...Option) gin.HandlerFunc
DumpWithOptions allows you to highly customize the middleware, such as dumping only requests or responses, dumping only the Header sections or body data within requests/responses, and using customized callback methods, among other configurations.
func FormatJsonBytes ¶
Types ¶
type Option ¶
type Option func(opt *options)
func WithCallback ¶
WithCallback accepts your customized callback method to which the dumped string information will be passed, allowing you to consume the dumped information in your own way.
func WithShowBody ¶
WithShowBody is set to true, it will dump the body data of requests or responses; when set to false, dumping will not occur.
However, if both ShowReq and ShowRsp are set to false, the body data of requests or responses will not be dumped regardless of the WithShowBody setting.
func WithShowCookies ¶
WithShowCookies is set to true, it will keep cookies in header for the dumping; when set to false, cookies will not show in the dumped headers.
func WithShowHeaders ¶
WithShowHeaders is set to true, it will dump the header of requests or responses; when set to false, dumping will not occur.
However, if both ShowReq and ShowRsp are set to false, the header of requests or responses will not be dumped regardless of the WithShowHeaders settings.
func WithShowRaw ¶
WithShowRaw is set to true, the raw format of the request body data will be preserved; when set to false, the dumped request body data will be formatted and sorted.
func WithShowReq ¶
WithShowReq is set to true, it will dump the header and body data of requests; when set to false, dumping will not occur.
func WithShowRsp ¶
WithShowRsp is set to true, it will dump the header and body data of responses; when set to false, dumping will not occur.