dump

package
v3.14.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 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) Dump

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

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) WrapReadCloser

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

func (*Dumper) WrapWriteCloser

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

func (*Dumper) WrapWriter

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

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) Dump

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

Dump with all dumpers.

func (Dumpers) ShouldDump

func (ds Dumpers) ShouldDump() bool

ShouldDump is true if Dumper is not empty.

type Options

type Options interface {
	Output() 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