requests

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: MIT Imports: 5 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheBody

func CacheBody(request *http.Request) (requestBody []byte, err error)

CacheBody retrieves the request body, replacing it with a copy of the original

Types

type Snapshot

type Snapshot struct {
	// contains filtered or unexported fields
}

Snapshot represents a snapshot of request state, and uses that snapshot to create clones of the request as required.

func CreateSnapshot

func CreateSnapshot(request *http.Request) (*Snapshot, error)

CreateSnapshot creates a snapshot of the specified request.

func CreateSnapshotAndClose

func CreateSnapshotAndClose(request *http.Request) (snapshot *Snapshot, err error)

CreateSnapshotAndClose creates a snapshot of the specified request, then destroys the original request.

func (*Snapshot) Copy

func (snapshot *Snapshot) Copy() (clonedRequest *http.Request, err error)

Copy creates a copy of the request represented by the snapshot.

func (*Snapshot) GetCachedRequestBody

func (snapshot *Snapshot) GetCachedRequestBody() []byte

GetCachedRequestBody retrieves a copy of the cached request body from the snapshot.

Returns an empty array if the request has no body.

func (*Snapshot) GetCachedRequestBodyReader

func (snapshot *Snapshot) GetCachedRequestBodyReader() io.Reader

GetCachedRequestBodyReader creates a reader over the cached request body from the snapshot.

Returns nil if the request has no body.

Jump to

Keyboard shortcuts

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