dump

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DumperKey dumperKeyType = iota

Variables

This section is empty.

Functions

func WrapResponseBodyIfNeeded

func WrapResponseBodyIfNeeded(res *http.Response, req *http.Request, dump *Dumper)

Types

type Dumper

type Dumper struct {
	Options
	// contains filtered or unexported fields
}

Dumper is the dump tool.

func GetDumpers

func GetDumpers(ctx context.Context, dump *Dumper) []*Dumper

func NewDumper

func NewDumper(opt Options) *Dumper

NewDumper create a new Dumper.

func (*Dumper) Clone

func (d *Dumper) Clone() *Dumper

func (*Dumper) DumpDefault

func (d *Dumper) DumpDefault(p []byte)

func (*Dumper) DumpRequestBody

func (d *Dumper) DumpRequestBody(p []byte)

func (*Dumper) DumpRequestHeader

func (d *Dumper) DumpRequestHeader(p []byte)

func (*Dumper) DumpResponseBody

func (d *Dumper) DumpResponseBody(p []byte)

func (*Dumper) DumpResponseHeader

func (d *Dumper) DumpResponseHeader(p []byte)

func (*Dumper) DumpTo

func (d *Dumper) DumpTo(p []byte, output io.Writer)

func (*Dumper) SetOptions

func (d *Dumper) SetOptions(opt Options)

func (*Dumper) Start

func (d *Dumper) Start()

func (*Dumper) Stop

func (d *Dumper) Stop()

func (*Dumper) WrapRequestBodyWriteCloser

func (d *Dumper) WrapRequestBodyWriteCloser(rc io.WriteCloser) io.WriteCloser

func (*Dumper) WrapRequestBodyWriter

func (d *Dumper) WrapRequestBodyWriter(w io.Writer) io.Writer

func (*Dumper) WrapRequestHeaderWriter

func (d *Dumper) WrapRequestHeaderWriter(w io.Writer) io.Writer

func (*Dumper) WrapResponseBodyReadCloser

func (d *Dumper) WrapResponseBodyReadCloser(rc io.ReadCloser) io.ReadCloser

type Dumpers

type Dumpers []*Dumper

Dumpers is an array of Dumpper

func GetResponseHeaderDumpers

func GetResponseHeaderDumpers(ctx context.Context, dump *Dumper) Dumpers

GetResponseHeaderDumpers return Dumpers which need dump response header.

func (Dumpers) DumpResponseHeader

func (ds Dumpers) DumpResponseHeader(p []byte)

func (Dumpers) ShouldDump

func (ds Dumpers) ShouldDump() bool

ShouldDump is true if Dumper is not empty.

type Options

type Options interface {
	Output() io.Writer
	RequestHeaderOutput() io.Writer
	RequestBodyOutput() io.Writer
	ResponseHeaderOutput() io.Writer
	ResponseBodyOutput() io.Writer
	RequestHeader() bool
	RequestBody() bool
	ResponseHeader() bool
	ResponseBody() bool
	Async() bool
	Clone() Options
}

Options controls the dump behavior.

Jump to

Keyboard shortcuts

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