goyave: github.com/System-Glitch/goyave/middleware Index | Files

package middleware

import "github.com/System-Glitch/goyave/middleware"

Index

Package Files

disallow.go gzip.go trim.go

func DisallowNonValidatedFields Uses

func DisallowNonValidatedFields(next goyave.Handler) goyave.Handler

DisallowNonValidatedFields validates that all fields in the request are validated by the RuleSet. Returns "422 Unprocessable Entity" and an error message if the user has sent non-validated field(s). Fields ending with "_confirmation" are ignored. If the body parsing failed, this middleware immediately passes to the next handler.

func Gzip Uses

func Gzip() goyave.Middleware

Gzip compresses HTTP responses with default compression level for clients that support it via the 'Accept-Encoding' header.

func GzipLevel Uses

func GzipLevel(level int) goyave.Middleware

GzipLevel compresses HTTP responses with specified compression level for clients that support it via the 'Accept-Encoding' header.

The compression level should be gzip.DefaultCompression, gzip.NoCompression, or any integer value between gzip.BestSpeed and gzip.BestCompression inclusive.

func Trim Uses

func Trim(next goyave.Handler) goyave.Handler

Trim removes all leading and trailing white space from string fields.

Package middleware imports 9 packages (graph). Updated 2020-09-12. Refresh now. Tools for package owners.