bodyprocessors

package
v3.0.0-...-6323aa8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, fn func() BodyProcessor)

Register registers a body processor by name. If the body processor is already registered, it will be overwritten

Types

type BodyProcessor

type BodyProcessor interface {
	ProcessRequest(reader io.Reader, collection [types.VariablesCount]collection.Collection, options Options) error
	ProcessResponse(reader io.Reader, collection [types.VariablesCount]collection.Collection, options Options) error
}

BodyProcessor interface is used to create body processors for different content-types. They are able to read the body, force a collection. Hook to some variable and return data based on special expressions like XPATH, JQ, etc.

func Get

func Get(name string) (BodyProcessor, error)

Get returns a body processor by name If the body processor is not found, it returns an error

type Options

type Options struct {
	// Mime is the type of the body, it may contain parameters
	// like charset, boundary, etc.
	Mime string
	// StoragePath is the path where the body will be stored
	StoragePath string
	// FileMode is the mode of the file that will be created
	FileMode fs.FileMode
	// DirMode is the mode of the directory that will be created
	DirMode fs.FileMode
}

Options are used by BodyProcessors to provide some settings like a path to store temporary files. Implementations may ignore the options.

Jump to

Keyboard shortcuts

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