Go API Documentation

github.com/caddyserver/caddy/v2/modules/caddyhttp/requestbody

No package summary is available.

Package

Files: 2. Third party imports: 3. Imports from organisation: 0. Tests: 0. Benchmarks: 0.

Vars

Interface guard

Types

RequestBody

RequestBody is a middleware for manipulating the request body.

Field name Field type Comment
MaxSize

int64

The maximum number of bytes to allow reading from the body by a later handler. If more bytes are read, an error with HTTP status 413 is returned.

ReadTimeout

time.Duration

EXPERIMENTAL. Subject to change/removal.

WriteTimeout

time.Duration

EXPERIMENTAL. Subject to change/removal.

Set

string

This field permit to replace body on the fly EXPERIMENTAL. Subject to change/removal.

logger

*zap.Logger

No comment on field.

errorWrapper

errorWrapper wraps errors that are returned from Read() so that they can be associated with a proper status code.

Field name Field type Comment

io.ReadCloser

No comment on field.

Functions

func (*RequestBody) Provision

func (RequestBody) CaddyModule

CaddyModule returns the Caddy module information.

func (RequestBody) ServeHTTP

Uses: http.MaxBytesReader, http.NewResponseController, io.NopCloser, strings.NewReader, time.Now, zap.Error, zapcore.ErrorLevel.

func (errorWrapper) Read

Uses: caddyhttp.Error, errors.As, http.MaxBytesError, http.StatusRequestEntityTooLarge.

Private functions

func init

References: httpcaddyfile.RegisterHandlerDirective.

func parseCaddyfile

References: humanize.ParseBytes, time.ParseDuration.