diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 000000000..51d11cd43 --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,39 @@ +name: Deploy API Docs to GitHub Pages + +on: + push: + branches: [main] + paths: + - 'docs/**' + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs/api-reference + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/docs/api-reference/_og/api-reference.png b/docs/api-reference/_og/api-reference.png new file mode 100644 index 000000000..8a460936f Binary files /dev/null and b/docs/api-reference/_og/api-reference.png differ diff --git a/docs/api-reference/_og/api-reference/package-root.png b/docs/api-reference/_og/api-reference/package-root.png new file mode 100644 index 000000000..c92b3ff67 Binary files /dev/null and b/docs/api-reference/_og/api-reference/package-root.png differ diff --git a/docs/api-reference/_og/api-reference/pkg-echotest.png b/docs/api-reference/_og/api-reference/pkg-echotest.png new file mode 100644 index 000000000..e9b5ebbc0 Binary files /dev/null and b/docs/api-reference/_og/api-reference/pkg-echotest.png differ diff --git a/docs/api-reference/_og/api-reference/pkg-middleware.png b/docs/api-reference/_og/api-reference/pkg-middleware.png new file mode 100644 index 000000000..b5c899b48 Binary files /dev/null and b/docs/api-reference/_og/api-reference/pkg-middleware.png differ diff --git a/docs/api-reference/api-reference.html b/docs/api-reference/api-reference.html new file mode 100644 index 000000000..033c44a4c --- /dev/null +++ b/docs/api-reference/api-reference.html @@ -0,0 +1,28 @@ + +API Reference - Echo API Reference
\ No newline at end of file diff --git a/docs/api-reference/api-reference/package-root.html b/docs/api-reference/api-reference/package-root.html new file mode 100644 index 000000000..b112bb80c --- /dev/null +++ b/docs/api-reference/api-reference/package-root.html @@ -0,0 +1,3257 @@ + +github.com/labstack/echo/v5 - Echo API Reference
Root

github.com/labstack/echo/v5

Package echo implements high performance, minimalist Go web framework.

import "github.com/labstack/echo/v5"

+

Package echo implements high performance, minimalist Go web framework.

+

Example:

+
+
+ +
+
package main
+
+import (
+	"log/slog"
+	"net/http"
+
+	"github.com/labstack/echo/v5"
+	"github.com/labstack/echo/v5/middleware"
+)
+
+// Handler
+func hello(c *echo.Context) error {
+	return c.String(http.StatusOK, "Hello, World!")
+}
+
+func main() {
+	// Echo instance
+	e := echo.New()
+
+	// Middleware
+	e.Use(middleware.RequestLogger())
+	e.Use(middleware.Recover())
+
+	// Routes
+	e.GET("/", hello)
+
+	// Start server
+	if err := e.Start(":8080"); err != nil {
+		slog.Error("failed to start server", "error", err)
+	}
+}
+

Learn more at https://echo.labstack.com

+ +

Constants

+

TimeLayout constants for parsing Unix timestamps in different precisions.

Source: binder_generic.go:43

+
+ +
+
const (
+	TimeLayoutUnixTime      = TimeLayout("UnixTime")      // Unix timestamp in seconds
+	TimeLayoutUnixTimeMilli = TimeLayout("UnixTimeMilli") // Unix timestamp in milliseconds
+	TimeLayoutUnixTimeNano  = TimeLayout("UnixTimeNano")  // Unix timestamp in nanoseconds
+)
+
+ + +

MIME types

Source: echo.go:148

+
+ +
+
const (
+	// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259
+	MIMEApplicationJSON = "application/json"
+	// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.
+	// No "charset" parameter is defined for this registration.
+	// Adding one really has no effect on compliant recipients.
+	// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n"
+	MIMEApplicationJSONCharsetUTF8       = MIMEApplicationJSON + "; " + charsetUTF8
+	MIMEApplicationJavaScript            = "application/javascript"
+	MIMEApplicationJavaScriptCharsetUTF8 = MIMEApplicationJavaScript + "; " + charsetUTF8
+	MIMEApplicationXML                   = "application/xml"
+	MIMEApplicationXMLCharsetUTF8        = MIMEApplicationXML + "; " + charsetUTF8
+	MIMETextXML                          = "text/xml"
+	MIMETextXMLCharsetUTF8               = MIMETextXML + "; " + charsetUTF8
+	MIMEApplicationForm                  = "application/x-www-form-urlencoded"
+	MIMEApplicationProtobuf              = "application/protobuf"
+	MIMEApplicationMsgpack               = "application/msgpack"
+	MIMETextHTML                         = "text/html"
+	MIMETextHTMLCharsetUTF8              = MIMETextHTML + "; " + charsetUTF8
+	MIMETextPlain                        = "text/plain"
+	MIMETextPlainCharsetUTF8             = MIMETextPlain + "; " + charsetUTF8
+	MIMEMultipartForm                    = "multipart/form-data"
+	MIMEOctetStream                      = "application/octet-stream"
+)
+
+ + + + + + + + + + + + + + + + +

Source: echo.go:174

+
+ +
+
const (
+
+	// PROPFIND Method can be used on collection and property resources.
+	PROPFIND = "PROPFIND"
+	// REPORT Method can be used to get information about a resource, see rfc 3253
+	REPORT = "REPORT"
+	// QUERY Method is a safe, idempotent request method carrying request content (a query) in its body, see rfc 10008.
+	// It is not (yet) part of the `net/http` standard library, so Echo defines it here.
+	QUERY = "QUERY"
+	// RouteNotFound is special method type for routes handling "route not found" (404) cases
+	RouteNotFound = "echo_route_not_found"
+	// RouteAny is special method type that matches any HTTP method in request. Any has lower
+	// priority that other methods that have been registered with Router to that path.
+	RouteAny = "echo_route_any"
+)
+
+ + + + +

Headers

Source: echo.go:189

+
+ +
+
const (
+	HeaderAccept         = "Accept"
+	HeaderAcceptEncoding = "Accept-Encoding"
+	// HeaderAllow is the name of the "Allow" header field used to list the set of methods
+	// advertised as supported by the target resource. Returning an Allow header is mandatory
+	// for status 405 (method not found) and useful for the OPTIONS method in responses.
+	// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1
+	HeaderAllow               = "Allow"
+	HeaderAuthorization       = "Authorization"
+	HeaderContentDisposition  = "Content-Disposition"
+	HeaderContentEncoding     = "Content-Encoding"
+	HeaderContentLength       = "Content-Length"
+	HeaderContentType         = "Content-Type"
+	HeaderCookie              = "Cookie"
+	HeaderSetCookie           = "Set-Cookie"
+	HeaderIfModifiedSince     = "If-Modified-Since"
+	HeaderLastModified        = "Last-Modified"
+	HeaderLocation            = "Location"
+	HeaderRetryAfter          = "Retry-After"
+	HeaderUpgrade             = "Upgrade"
+	HeaderVary                = "Vary"
+	HeaderWWWAuthenticate     = "WWW-Authenticate"
+	HeaderXForwardedFor       = "X-Forwarded-For"
+	HeaderXForwardedProto     = "X-Forwarded-Proto"
+	HeaderXForwardedProtocol  = "X-Forwarded-Protocol"
+	HeaderXForwardedSsl       = "X-Forwarded-Ssl"
+	HeaderXUrlScheme          = "X-Url-Scheme"
+	HeaderXHTTPMethodOverride = "X-HTTP-Method-Override"
+	HeaderXRealIP             = "X-Real-Ip"
+	HeaderXRequestID          = "X-Request-Id"
+	HeaderXCorrelationID      = "X-Correlation-Id"
+	HeaderXRequestedWith      = "X-Requested-With"
+	HeaderServer              = "Server"
+
+	// HeaderOrigin request header indicates the origin (scheme, hostname, and port) that caused the request.
+	// See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin
+	HeaderOrigin       = "Origin"
+	HeaderCacheControl = "Cache-Control"
+	HeaderConnection   = "Connection"
+
+	// Access control
+	HeaderAccessControlRequestMethod    = "Access-Control-Request-Method"
+	HeaderAccessControlRequestHeaders   = "Access-Control-Request-Headers"
+	HeaderAccessControlAllowOrigin      = "Access-Control-Allow-Origin"
+	HeaderAccessControlAllowMethods     = "Access-Control-Allow-Methods"
+	HeaderAccessControlAllowHeaders     = "Access-Control-Allow-Headers"
+	HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials"
+	HeaderAccessControlExposeHeaders    = "Access-Control-Expose-Headers"
+	HeaderAccessControlMaxAge           = "Access-Control-Max-Age"
+
+	// Security
+	HeaderStrictTransportSecurity         = "Strict-Transport-Security"
+	HeaderXContentTypeOptions             = "X-Content-Type-Options"
+	HeaderXXSSProtection                  = "X-XSS-Protection"
+	HeaderXFrameOptions                   = "X-Frame-Options"
+	HeaderContentSecurityPolicy           = "Content-Security-Policy"
+	HeaderContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only"
+	HeaderXCSRFToken                      = "X-CSRF-Token" // #nosec G101
+	HeaderReferrerPolicy                  = "Referrer-Policy"
+
+	// HeaderSecFetchSite fetch metadata request header indicates the relationship between a request initiator's
+	// origin and the origin of the requested resource.
+	// See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Fetch-Site
+	HeaderSecFetchSite = "Sec-Fetch-Site"
+)
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Source: router.go:49

+
+ +
+
const (
+	// NotFoundRouteName is name of RouteInfo returned when router did not find matching route (404: not found).
+	NotFoundRouteName = "echo_route_not_found_name"
+	// MethodNotAllowedRouteName is name of RouteInfo returned when router did not find matching method for route  (405: method not allowed).
+	MethodNotAllowedRouteName = "echo_route_method_not_allowed_name"
+)
+
+ +

Source: context.go:52

+
+ +
+
const (
+	// ContextKeyHeaderAllow is set by Router for getting value for `Allow` header in later stages of handler call chain.
+	// Allow header is mandatory for status 405 (method not found) and useful for OPTIONS method requests.
+	// It is added to context only when Router does not find matching method handler for request.
+	ContextKeyHeaderAllow = "echo_header_allow"
+)
+
+

Source: version.go:8

+
+ +
+
const (
+	// Version of Echo
+	Version = "5.3.0"
+)
+
+

Variables

+

The following errors can produce HTTP status code by implementing HTTPStatusCoder interface

Source: httperror.go:14

+
+ +
+
var (
+	ErrBadRequest                  = &httpError{http.StatusBadRequest}            // 400
+	ErrUnauthorized                = &httpError{http.StatusUnauthorized}          // 401
+	ErrForbidden                   = &httpError{http.StatusForbidden}             // 403
+	ErrNotFound                    = &httpError{http.StatusNotFound}              // 404
+	ErrMethodNotAllowed            = &httpError{http.StatusMethodNotAllowed}      // 405
+	ErrRequestTimeout              = &httpError{http.StatusRequestTimeout}        // 408
+	ErrStatusRequestEntityTooLarge = &httpError{http.StatusRequestEntityTooLarge} // 413
+	ErrUnsupportedMediaType        = &httpError{http.StatusUnsupportedMediaType}  // 415
+	ErrTooManyRequests             = &httpError{http.StatusTooManyRequests}       // 429
+	ErrInternalServerError         = &httpError{http.StatusInternalServerError}   // 500
+	ErrBadGateway                  = &httpError{http.StatusBadGateway}            // 502
+	ErrServiceUnavailable          = &httpError{http.StatusServiceUnavailable}    // 503
+)
+
+ + + + + + + + + + + +

The following errors fall into 500 (InternalServerError) category

Source: httperror.go:30

+
+ +
+
var (
+	ErrValidatorNotRegistered = errors.New("validator not registered")
+	ErrRendererNotRegistered  = errors.New("renderer not registered")
+	ErrInvalidRedirectCode    = errors.New("invalid redirect status code")
+	ErrCookieNotFound         = errors.New("cookie not found")
+	ErrInvalidCertOrKeyType   = errors.New("invalid cert or key type, must be string or []byte")
+	ErrInvalidListenerNetwork = errors.New("invalid listener network")
+)
+
+ + + + + +

ErrInvalidKeyType is error that is returned when the value is not castable to expected type.

Source: context_generic.go:12

+
+ +
+
var ErrInvalidKeyType = errors.New("invalid key type")
+
+

ErrNonExistentKey is error that is returned when key does not exist

Source: context_generic.go:9

+
+ +
+
var ErrNonExistentKey = errors.New("non existent key")
+
+

Functions

+
+

func BindBody(c *Context, target any) (err error)

+

Source: bind.go:68

+

BindBody binds request body contents to bindable object +NB: then binding forms take note that this implementation uses standard library form parsing +which parses form data from BOTH URL and BODY if content type is not MIMEMultipartForm +See non-MIMEMultipartForm: https://golang.org/pkg/net/http/#Request.ParseForm +See MIMEMultipartForm: https://golang.org/pkg/net/http/#Request.ParseMultipartForm

+
+
+

func BindHeaders(c *Context, target any) error

+

Source: bind.go:114

+

BindHeaders binds HTTP headers to a bindable object

+
+
+

func BindPathValues(c *Context, target any) error

+

Source: bind.go:44

+

BindPathValues binds path parameter values to bindable object

+
+
+

func BindQueryParams(c *Context, target any) error

+

Source: bind.go:56

+

BindQueryParams binds query params to bindable object

+
+
+

func ContextGet[T any](c *Context, key string) (T, error)

+

Source: context_generic.go:16

+

ContextGet retrieves a value from the context store or ErrNonExistentKey error the key is missing. +Returns ErrInvalidKeyType error if the value is not castable to type T.

+
+
+

func ContextGetOr[T any](c *Context, key string, defaultValue T) (T, error)

+

Source: context_generic.go:37

+

ContextGetOr retrieves a value from the context store or returns a default value when the key +is missing. Returns ErrInvalidKeyType error if the value is not castable to type T.

+
+
+

func DefaultHTTPErrorHandler(exposeError bool) HTTPErrorHandler

+

Source: echo.go:448

+

DefaultHTTPErrorHandler creates new default HTTP error handler implementation. It sends a JSON response +with status code. exposeError parameter decides if returned message will contain also error message or not

+

Note: DefaultHTTPErrorHandler does not log errors. Use middleware for it if errors need to be logged (separately) +Note: In case errors happens in middleware call-chain that is returning from handler (which did not return an error). +When handler has already sent response (ala c.JSON()) and there is error in middleware that is returning from +handler. Then the error that global error handler received will be ignored because we have already "committed" the +response and status code header has been sent to the client.

+
Example +
+
+ +
+
// SPDX-License-Identifier: MIT
+// SPDX-FileCopyrightText: © 2015 LabStack LLC and Echo contributors
+
+// run tests as external package to get real feel for API
+package echo_test
+
+import (
+	"encoding/json"
+	"fmt"
+	"github.com/labstack/echo/v5"
+	"net/http"
+	"net/http/httptest"
+)
+
+func ExampleDefaultHTTPErrorHandler() {
+	e := echo.New()
+	e.GET("/api/endpoint", func(c *echo.Context) error {
+		return &apiError{
+			Code: http.StatusBadRequest,
+			Body: map[string]any{"message": "custom error"},
+		}
+	})
+
+	req := httptest.NewRequest(http.MethodGet, "/api/endpoint?err=1", nil)
+	resp := httptest.NewRecorder()
+
+	e.ServeHTTP(resp, req)
+
+	fmt.Printf("%d %s", resp.Code, resp.Body.String())
+
+	// Output: 400 {"error":{"message":"custom error"}}
+}
+
+type apiError struct {
+	Code int
+	Body any
+}
+
+func (e *apiError) StatusCode() int {
+	return e.Code
+}
+
+func (e *apiError) MarshalJSON() ([]byte, error) {
+	type body struct {
+		Error any `json:"error"`
+	}
+	return json.Marshal(body{Error: e.Body})
+}
+
+func (e *apiError) Error() string {
+	return http.StatusText(e.Code)
+}
+
+
+

Output:

+
+
+ +
+
400 {"error":{"message":"custom error"}}
+
+
+
+
+

func ExtractIPDirect() IPExtractor

+

Source: ip.go:207

+

ExtractIPDirect extracts an IP address using an actual IP address. +Use this if your server faces to internet directly (i.e.: uses no proxy).

+
+
+

func ExtractIPFromRealIPHeader(options ...TrustOption) IPExtractor

+

Source: ip.go:224

+

ExtractIPFromRealIPHeader extracts IP address using x-real-ip header. +Use this if you put proxy which uses this header.

+
+
+

func ExtractIPFromXFFHeader(options ...TrustOption) IPExtractor

+

Source: ip.go:242

+

ExtractIPFromXFFHeader extracts IP address using x-forwarded-for header. +Use this if you put proxy which uses this header. +This returns nearest untrustable IP. If all IPs are trustable, returns furthest one (i.e.: XFF[0]).

+
+
+

func FormFieldBinder(c *Context) *ValueBinder

+

Source: binder.go:168

+

FormFieldBinder creates form field value binder +For all requests, FormFieldBinder parses the raw query from the URL and uses query params as form fields

+

For POST, PUT, and PATCH requests, it also reads the request body, parses it +as a form and uses query params as form fields. Request body parameters take precedence over URL query +string values in r.Form.

+

NB: when binding forms take note that this implementation uses standard library form parsing +which parses form data from BOTH URL and BODY if content type is not MIMEMultipartForm +See https://golang.org/pkg/net/http/#Request.ParseForm

+
+
+

func FormValue[T any](c *Context, key string, opts ...any) (T, error)

+

Source: binder_generic.go:213

+

FormValue extracts and parses a single form value from the request by key. +It returns the typed value and an error if binding fails. Returns ErrNonExistentKey if parameter not found.

+

Empty String Handling:

+
+
+ +
+
If the form field exists but has an empty value, the zero value of type T is returned
+with no error. For example, an empty form field returns (0, nil) for int types.
+This differs from standard library behavior where parsing empty strings returns errors.
+To treat empty values as errors, validate the result separately or check the raw value.
+

See ParseValue for supported types and options

+
+
+

func FormValueOr[T any](c *Context, key string, defaultValue T, opts ...any) (T, error)

+

Source: binder_generic.go:248

+

FormValueOr extracts and parses a single form value from the request by key. +Returns defaultValue if the parameter is not found or has an empty value. +Returns an error only if parsing fails or form parsing errors occur.

+

Example:

+
+
+ +
+
limit, err := echo.FormValueOr[int](c, "limit", 100)
+// If "limit" is missing: returns (100, nil)
+// If "limit" is "50": returns (50, nil)
+// If "limit" is "abc": returns (100, BindingError)
+

See ParseValue for supported types and options

+
+
+

func FormValues[T any](c *Context, key string, opts ...any) ([]T, error)

+

Source: binder_generic.go:273

+

FormValues extracts and parses all values for a form values key as a slice. +It returns the typed slice and an error if binding any value fails. Returns ErrNonExistentKey if parameter not found.

+

See ParseValues for supported types and options

+
+
+

func FormValuesOr[T any](c *Context, key string, defaultValue []T, opts ...any) ([]T, error)

+

Source: binder_generic.go:300

+

FormValuesOr extracts and parses all values for a form values key as a slice. +Returns defaultValue if the parameter is not found. +Returns an error only if parsing any value fails or form parsing errors occur.

+

Example:

+
+
+ +
+
tags, err := echo.FormValuesOr[string](c, "tags", []string{})
+// If "tags" is missing: returns ([], nil)
+// If form parsing fails: returns (nil, error)
+

See ParseValues for supported types and options

+
+
+

func HandlerName(h HandlerFunc) string

+

Source: route.go:102

+

HandlerName returns string name for given function.

+
+
+

func LegacyIPExtractor() IPExtractor

+

Source: ip.go:288

+

LegacyIPExtractor returns an IPExtractor that derives the client IP address +from common proxy headers, falling back to the request's remote address.

+

Resolution order:

+
    +
  1. X-Forwarded-For: returns the first IP in the comma-separated list. +If multiple values are present, only the left-most (original client) +is used. Surrounding brackets (for IPv6) are stripped.
  2. +
  3. X-Real-IP: used if X-Forwarded-For is absent. Surrounding brackets +(for IPv6) are stripped.
  4. +
  5. req.RemoteAddr: used as a fallback; the host portion is extracted +via net.SplitHostPort.
  6. +
+

Notes:

+
    +
  • No validation is performed on header values.
  • +
  • This function trusts headers as-is and is therefore not safe against +spoofing unless the application is behind a trusted proxy that is +configured to strip/replace/modify headers correctly.
  • +
+

Use ExtractIPFromXFFHeader or ExtractIPFromRealIPHeader instead of LegacyIPExtractor.

+
+
+

func MustSubFS(currentFs fs.FS, fsRoot string) fs.FS

+

Source: echo.go:946

+

MustSubFS creates sub FS from current filesystem or panic on failure. +Panic happens when fsRoot contains invalid path according to fs.ValidPath rules.

+

MustSubFS is helpful when dealing with embed.FS because for example //go:embed assets/images embeds files with +paths including assets/images as their prefix. In that case use `fs := echo.MustSubFS(fs, "rootDirectory") to +create sub fs which uses necessary prefix for directory path.

+
+
+

func New() *Echo

+

Source: echo.go:386

+

New creates an instance of Echo.

+
+
+

func NewBindingError(sourceParam string, values []string, message string, err error) error

+

Source: binder.go:81

+

NewBindingError creates new instance of binding error

+
+
+

func NewConcurrentRouter(r Router) Router

+

Source: router_concurrent.go:9

+

NewConcurrentRouter creates concurrency safe Router which routes can be added/removed safely +even after http.Server has been started.

+
+
+

func NewContext(r *http.Request, w http.ResponseWriter, opts ...any) *Context

+

Source: context.go:98

+

NewContext returns a new Context instance.

+

Note: request,response and e can be left to nil as Echo.ServeHTTP will call c.Reset(req,resp) anyway +these arguments are useful when creating context for tests and cases like that.

+
+
+

func NewDefaultFS(dir string) fs.FS

+

Source: echo.go:900

+

NewDefaultFS returns a new defaultFS instance which allows fs.FS.Open to have absolute paths as input if it matches +then given dir as prefix.

+
+
+

func NewHTTPError(code int, message string) *HTTPError

+

Source: httperror.go:99

+

NewHTTPError creates a new instance of HTTPError

+
+
+

func NewResponse(w http.ResponseWriter, logger *slog.Logger) (r *Response)

+

Source: response.go:32

+

NewResponse creates a new instance of Response.

+
+
+

func NewRouter(config RouterConfig) *DefaultRouter

+

Source: router.go:127

+

NewRouter returns a new Router instance.

+
+
+

func NewVirtualHostHandler(vhosts map[string]*Echo) *Echo

+

Source: vhost.go:10

+

NewVirtualHostHandler creates instance of Echo that routes requests to given virtual hosts +when hosts in request does not exist in given map the request is served by returned Echo instance.

+
+
+

func NewWithConfig(config Config) *Echo

+

Source: echo.go:343

+

NewWithConfig creates an instance of Echo with given configuration.

+
+
+

func ParseValue[T any](value string, opts ...any) (T, error)

+

Source: binder_generic.go:366

+

ParseValue parses value to generic type

+

Types that are supported:

+
    +
  • bool
  • +
  • float32
  • +
  • float64
  • +
  • int
  • +
  • int8
  • +
  • int16
  • +
  • int32
  • +
  • int64
  • +
  • uint
  • +
  • uint8/byte
  • +
  • uint16
  • +
  • uint32
  • +
  • uint64
  • +
  • string
  • +
  • echo.BindUnmarshaler interface
  • +
  • encoding.TextUnmarshaler interface
  • +
  • json.Unmarshaler interface
  • +
  • time.Duration
  • +
  • time.Time use echo.TimeOpts or echo.TimeLayout to set time parsing configuration
  • +
+
+
+

func ParseValueOr[T any](value string, defaultValue T, opts ...any) (T, error)

+

Source: binder_generic.go:393

+

ParseValueOr parses value to generic type, when value is empty defaultValue is returned.

+

Types that are supported:

+
    +
  • bool
  • +
  • float32
  • +
  • float64
  • +
  • int
  • +
  • int8
  • +
  • int16
  • +
  • int32
  • +
  • int64
  • +
  • uint
  • +
  • uint8/byte
  • +
  • uint16
  • +
  • uint32
  • +
  • uint64
  • +
  • string
  • +
  • echo.BindUnmarshaler interface
  • +
  • encoding.TextUnmarshaler interface
  • +
  • json.Unmarshaler interface
  • +
  • time.Duration
  • +
  • time.Time use echo.TimeOpts or echo.TimeLayout to set time parsing configuration
  • +
+
+
+

func ParseValues[T any](values []string, opts ...any) ([]T, error)

+

Source: binder_generic.go:320

+

ParseValues parses value to generic type slice. Same types are supported as ParseValue +function but the result type is slice instead of scalar value.

+

See ParseValue for supported types and options

+
+
+

func ParseValuesOr[T any](values []string, defaultValue []T, opts ...any) ([]T, error)

+

Source: binder_generic.go:329

+

ParseValuesOr parses value to generic type slice, when value is empty defaultValue is returned. +Same types are supported as ParseValue function but the result type is slice instead of scalar value.

+

See ParseValue for supported types and options

+
+
+

func PathParam[T any](c *Context, paramName string, opts ...any) (T, error)

+

Source: binder_generic.go:59

+

PathParam extracts and parses a path parameter from the context by name. +It returns the typed value and an error if binding fails. Returns ErrNonExistentKey if parameter not found.

+

Empty String Handling:

+
+
+ +
+
If the parameter exists but has an empty value, the zero value of type T is returned
+with no error. For example, a path parameter with value "" returns (0, nil) for int types.
+This differs from standard library behavior where parsing empty strings returns errors.
+To treat empty values as errors, validate the result separately or check the raw value.
+

See ParseValue for supported types and options

+
+
+

func PathParamOr[T any](c *Context, paramName string, defaultValue T, opts ...any) (T, error)

+

Source: binder_generic.go:85

+

PathParamOr extracts and parses a path parameter from the context by name. +Returns defaultValue if the parameter is not found or has an empty value. +Returns an error only if parsing fails (e.g., "abc" for int type).

+

Example:

+
+
+ +
+
id, err := echo.PathParamOr[int](c, "id", 0)
+// If "id" is missing: returns (0, nil)
+// If "id" is "123": returns (123, nil)
+// If "id" is "abc": returns (0, BindingError)
+

See ParseValue for supported types and options

+
+
+

func PathValuesBinder(c *Context) *ValueBinder

+

Source: binder.go:142

+

PathValuesBinder creates path parameter value binder

+
+
+

func QueryParam[T any](c *Context, key string, opts ...any) (T, error)

+

Source: binder_generic.go:114

+

QueryParam extracts and parses a single query parameter from the request by key. +It returns the typed value and an error if binding fails. Returns ErrNonExistentKey if parameter not found.

+

Empty String Handling:

+
+
+ +
+
If the parameter exists but has an empty value (?key=), the zero value of type T is returned
+with no error. For example, "?count=" returns (0, nil) for int types.
+This differs from standard library behavior where parsing empty strings returns errors.
+To treat empty values as errors, validate the result separately or check the raw value.
+

Behavior Summary:

+
    +
  • Missing key (?other=value): returns (zero, ErrNonExistentKey)
  • +
  • Empty value (?key=): returns (zero, nil)
  • +
  • Invalid value (?key=abc for int): returns (zero, BindingError)
  • +
+

See ParseValue for supported types and options

+
+
+

func QueryParamOr[T any](c *Context, key string, defaultValue T, opts ...any) (T, error)

+

Source: binder_generic.go:144

+

QueryParamOr extracts and parses a single query parameter from the request by key. +Returns defaultValue if the parameter is not found or has an empty value. +Returns an error only if parsing fails (e.g., "abc" for int type).

+

Example:

+
+
+ +
+
page, err := echo.QueryParamOr[int](c, "page", 1)
+// If "page" is missing: returns (1, nil)
+// If "page" is "5": returns (5, nil)
+// If "page" is "abc": returns (1, BindingError)
+

See ParseValue for supported types and options

+
+
+

func QueryParams[T any](c *Context, key string, opts ...any) ([]T, error)

+

Source: binder_generic.go:164

+

QueryParams extracts and parses all values for a query parameter key as a slice. +It returns the typed slice and an error if binding any value fails. Returns ErrNonExistentKey if parameter not found.

+

See ParseValues for supported types and options

+
+
+

func QueryParamsBinder(c *Context) *ValueBinder

+

Source: binder.go:126

+

QueryParamsBinder creates query parameter value binder

+
+
+

func QueryParamsOr[T any](c *Context, key string, defaultValue []T, opts ...any) ([]T, error)

+

Source: binder_generic.go:189

+

QueryParamsOr extracts and parses all values for a query parameter key as a slice. +Returns defaultValue if the parameter is not found. +Returns an error only if parsing any value fails.

+

Example:

+
+
+ +
+
ids, err := echo.QueryParamsOr[int](c, "ids", []int{})
+// If "ids" is missing: returns ([], nil)
+// If "ids" is "1&ids=2": returns ([1, 2], nil)
+// If "ids" contains "abc": returns ([], BindingError)
+

See ParseValues for supported types and options

+
+
+

func ResolveResponseStatus(rw http.ResponseWriter, err error) (resp *Response, status int)

+

Source: httperror.go:66

+

ResolveResponseStatus returns the Response and HTTP status code that should be (or has been) sent for rw, +given an optional error.

+

This function is useful for middleware and handlers that need to figure out the HTTP status +code to return based on the error that occurred or what was set in the response.

+

Precedence rules:

+
    +
  1. If the response has already been committed, the committed status wins (err is ignored).
  2. +
  3. Otherwise, start with 200 OK (net/http default if WriteHeader is never called).
  4. +
  5. If the response has a non-zero suggested status, use it.
  6. +
  7. If err != nil, it overrides the suggested status:
      +
    • StatusCode(err) if non-zero
    • +
    • otherwise 500 Internal Server Error.
    • +
    +
  8. +
+
+
+

func StaticDirectoryHandler(fileSystem fs.FS, disablePathUnescaping bool) HandlerFunc

+

Source: echo.go:650

+

StaticDirectoryHandler creates handler function to serve files from provided file system +When disablePathUnescaping is set then file name from path is not unescaped and is served as is.

+

Note: when disablePathUnescaping=false, the handler decodes the wildcard param before serving. +If route guards (e.g. e.GET("/admin/*", forbidden)) are used to restrict parts of the +filesystem, an encoded separator (%2F) or encoded dot-dot (%2E%2E) in the URL can resolve to +a path that the router never matched against the guard route. Enabling +RouterConfig.UseEscapedPathForMatching does NOT fix this — it changes which path the router +uses for matching but still lets path.Clean resolve ".." segments into a guarded directory. +Do not rely on route guards alone to restrict a filesystem served by this handler. +See https://github.com/labstack/echo/security/advisories/GHSA-vfp3-v2gw-7wfq

+
+
+

func StaticFileHandler(file string, filesystem fs.FS) HandlerFunc

+

Source: echo.go:693

+

StaticFileHandler creates handler function to serve file from provided file system.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func StatusCode(err error) int

+

Source: httperror.go:45

+

StatusCode returns status code from err if it implements HTTPStatusCoder interface. +If err does not implement the interface, it returns 0.

+
+
+

func TrustIPRange(ipRange *net.IPNet) TrustOption

+

Source: ip.go:168

+

TrustIPRange add trustable IP ranges using CIDR notation.

+
+
+

func TrustLinkLocal(v bool) TrustOption

+

Source: ip.go:154

+

TrustLinkLocal configures if you trust link-local address (default: true).

+
+
+

func TrustLoopback(v bool) TrustOption

+

Source: ip.go:147

+

TrustLoopback configures if you trust loopback address (default: true).

+
+
+

func TrustPrivateNet(v bool) TrustOption

+

Source: ip.go:161

+

TrustPrivateNet configures if you trust private network address (default: true).

+
+
+

func UnwrapResponse(rw http.ResponseWriter) (*Response, error)

+

Source: response.go:121

+

UnwrapResponse unwraps given ResponseWriter to return contexts original Echo Response. rw has to implement +following method Unwrap() http.ResponseWriter

+
+
+

func WrapHandler(h http.Handler) HandlerFunc

+

Source: echo.go:848

+

WrapHandler wraps http.Handler into echo.HandlerFunc.

+
+
+

func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc

+

Source: echo.go:862

+

WrapMiddleware wraps func(http.Handler) http.Handler into echo.MiddlewareFunc

+
+

Types

+
+

type AddRouteError

+

Source: router.go:489

+

AddRouteError is error returned by Router.Add containing information what actual route adding failed. Useful for +mass adding (i.e. Any() routes)

+
+
+ +
+
type AddRouteError struct {
+	Err    error
+	Method string
+	Path   string
+}
+
+
Fields
  • Err error
  • Method string
  • Path string
+
+

func Error) Error() string

+

Source: router.go:495

+
+
+

func Unwrap() error

+

Source: router.go:497

+
+
+
+

type BindUnmarshaler

+

Source: bind.go:31

+

BindUnmarshaler is the interface used to wrap the UnmarshalParam method. +Types that don't implement this, but do implement encoding.TextUnmarshaler +will use that interface instead.

+
+
+ +
+
type BindUnmarshaler interface {
+	// UnmarshalParam decodes and assigns a value from an form or query param.
+	UnmarshalParam(param string) error
+}
+
+
Methods
  • UnmarshalParam func(param string) error

    UnmarshalParam decodes and assigns a value from an form or query param.

+
+
+

type Binder

+

Source: bind.go:21

+

Binder is the interface that wraps the Bind method.

+
+
+ +
+
type Binder interface {
+	Bind(c *Context, target any) error
+}
+
+
Methods
  • Bind func(c *Context, target any) error
+
+
+

type BindingError

+

Source: binder.go:72

+

BindingError represents an error that occurred while binding request data.

+

Note: JSON serialization is handled by the MarshalJSON method below, not by the +struct tags (which are kept for documentation). MarshalJSON emits {"field","message"}.

+
+
+ +
+
type BindingError struct {
+	// Field is the field name where value binding failed
+	Field string `json:"field"`
+	*HTTPError
+	// Values of parameter that failed to bind.
+	Values []string `json:"-"`
+}
+
+
Fields
  • Field string `json:"field"`

    Field is the field name where value binding failed

  • *HTTPError
  • Values []string `json:"-"`

    Values of parameter that failed to bind.

+
+

func Error) Error() string

+

Source: binder.go:90

+

Error returns error message

+
+
+

func MarshalJSON() ([]byte, error)

+

Source: binder.go:98

+

MarshalJSON implements json.Marshaler so that binding errors are serialized into +a structured response (e.g. {"field":"id","message":"..."}) rather than being +flattened to a generic message. DefaultHTTPErrorHandler routes errors that +implement json.Marshaler through their own encoding.

+
+
+
+

type Config

+

Source: echo.go:255

+

Config is configuration for NewWithConfig function

+
+
+ +
+
type Config struct {
+	// Logger is the slog logger instance used for application-wide structured logging.
+	// If not set, a default TextHandler writing to stdout is created.
+	Logger *slog.Logger
+
+	// HTTPErrorHandler is the centralized error handler that processes errors returned
+	// by handlers and middleware, converting them to appropriate HTTP responses.
+	// If not set, DefaultHTTPErrorHandler(false) is used.
+	HTTPErrorHandler HTTPErrorHandler
+
+	// Router is the HTTP request router responsible for matching URLs to handlers
+	// using a radix tree-based algorithm.
+	// If not set, NewRouter(RouterConfig{}) is used.
+	Router Router
+
+	// OnAddRoute is an optional callback hook executed when routes are registered.
+	// Useful for route validation, logging, or custom route processing.
+	// If not set, no callback is executed.
+	OnAddRoute func(route Route) error
+
+	// Filesystem is the fs.FS implementation used for serving static files.
+	// Supports os.DirFS, embed.FS, and custom implementations.
+	// If not set, defaults to current working directory.
+	Filesystem fs.FS
+
+	// Binder handles automatic data binding from HTTP requests to Go structs.
+	// Supports JSON, XML, form data, query parameters, and path parameters.
+	// If not set, DefaultBinder is used.
+	Binder Binder
+
+	// Validator provides optional struct validation after data binding.
+	// Commonly used with third-party validation libraries.
+	// If not set, Context.Validate() returns ErrValidatorNotRegistered.
+	Validator Validator
+
+	// Renderer provides template rendering for generating HTML responses.
+	// Requires integration with a template engine like html/template.
+	// If not set, Context.Render() returns ErrRendererNotRegistered.
+	Renderer Renderer
+
+	// JSONSerializer handles JSON encoding and decoding for HTTP requests/responses.
+	// Can be replaced with faster alternatives like jsoniter or sonic.
+	// If not set, DefaultJSONSerializer using encoding/json is used.
+	JSONSerializer JSONSerializer
+
+	// IPExtractor defines the strategy for extracting the real client IP address
+	// from requests, particularly important when behind proxies or load balancers.
+	// Used for rate limiting, access control, and logging.
+	// If not set, falls back to checking X-Forwarded-For and X-Real-IP headers.
+	IPExtractor IPExtractor
+
+	// FormParseMaxMemory is default value for memory limit that is used
+	// when parsing multipart forms (See (*http.Request).ParseMultipartForm)
+	FormParseMaxMemory int64
+
+	// EnablePathUnescapingStaticFiles enables path parameter (param: *) unescaping for static file methods.
+	// Default false (safe): encoded slashes (%2f) in the wildcard param are NOT decoded,
+	// preventing ACL bypass where /admin%2fprivate.txt bypasses a /admin/* route guard by
+	// not matching that route but having its wildcard param decoded to admin/private.txt.
+	// Set to true only when serving files whose names contain URL-encoded characters
+	// (e.g. "hello world.txt" via /hello%20world.txt) and you are not relying on
+	// route-based ACL guards to restrict access.
+	// If you are enabling this option, make sure you understand the security implications.
+	// See: https://github.com/labstack/echo/security/advisories/GHSA-vfp3-v2gw-7wfq
+	//
+	// Enabling RouterConfig.UseEscapedPathForMatching makes this field irrelevant and can lead to security issues when
+	// using different Routes to exclude some of the files from being served.
+	// e.g. if you serve files from directory as such and use different route to exclude some of the files from being served.
+	// 0. given folder structure:
+	//   public/
+	//   public/index.html
+	//   public/admin/private.txt
+	// 1. share `public/` folder contents from the server root with `e.Static("/", "public")`
+	// 2. naively assume that everything under /admin folder is now forbidden
+	//       e.GET("/admin/*", func(c *Context) error { return echo.ErrForbidden })
+	// Then request to `/assets/../admin%2fprivate.txt` will be served as router does not match it to guarded route.
+	//
+	// Applies to methods: Echo.Static, Echo.StaticFS, Group.Static, Group.StaticFS.
+	EnablePathUnescapingStaticFiles bool
+
+	// NoGroupAutoRegister404Routes bool is a flag that indicates whether echo.Group should NOT register 404 routes automatically
+	// when there are middlewares registered with the group.
+	// Note: if you decide not to register 404 routes automatically, make sure to check if all your middlewares are executed
+	// as expected. For example - CORS middleware.
+	NoGroupAutoRegister404Routes bool
+}
+
+
Fields
  • Logger *slog.Logger

    Logger is the slog logger instance used for application-wide structured logging. +If not set, a default TextHandler writing to stdout is created.

  • HTTPErrorHandler HTTPErrorHandler

    HTTPErrorHandler is the centralized error handler that processes errors returned +by handlers and middleware, converting them to appropriate HTTP responses. +If not set, DefaultHTTPErrorHandler(false) is used.

  • Router Router

    Router is the HTTP request router responsible for matching URLs to handlers +using a radix tree-based algorithm. +If not set, NewRouter(RouterConfig{}) is used.

  • OnAddRoute func(route Route) error

    OnAddRoute is an optional callback hook executed when routes are registered. +Useful for route validation, logging, or custom route processing. +If not set, no callback is executed.

  • Filesystem fs.FS

    Filesystem is the fs.FS implementation used for serving static files. +Supports os.DirFS, embed.FS, and custom implementations. +If not set, defaults to current working directory.

  • Binder Binder

    Binder handles automatic data binding from HTTP requests to Go structs. +Supports JSON, XML, form data, query parameters, and path parameters. +If not set, DefaultBinder is used.

  • Validator Validator

    Validator provides optional struct validation after data binding. +Commonly used with third-party validation libraries. +If not set, Context.Validate() returns ErrValidatorNotRegistered.

  • Renderer Renderer

    Renderer provides template rendering for generating HTML responses. +Requires integration with a template engine like html/template. +If not set, Context.Render() returns ErrRendererNotRegistered.

  • JSONSerializer JSONSerializer

    JSONSerializer handles JSON encoding and decoding for HTTP requests/responses. +Can be replaced with faster alternatives like jsoniter or sonic. +If not set, DefaultJSONSerializer using encoding/json is used.

  • IPExtractor IPExtractor

    IPExtractor defines the strategy for extracting the real client IP address +from requests, particularly important when behind proxies or load balancers. +Used for rate limiting, access control, and logging. +If not set, falls back to checking X-Forwarded-For and X-Real-IP headers.

  • FormParseMaxMemory int64

    FormParseMaxMemory is default value for memory limit that is used +when parsing multipart forms (See (*http.Request).ParseMultipartForm)

  • EnablePathUnescapingStaticFiles bool

    EnablePathUnescapingStaticFiles enables path parameter (param: ) unescaping for static file methods. +Default false (safe): encoded slashes (%2f) in the wildcard param are NOT decoded, +preventing ACL bypass where /admin%2fprivate.txt bypasses a /admin/ route guard by +not matching that route but having its wildcard param decoded to admin/private.txt. +Set to true only when serving files whose names contain URL-encoded characters +(e.g. "hello world.txt" via /hello%20world.txt) and you are not relying on +route-based ACL guards to restrict access. +If you are enabling this option, make sure you understand the security implications. +See: https://github.com/labstack/echo/security/advisories/GHSA-vfp3-v2gw-7wfq

    +

    Enabling RouterConfig.UseEscapedPathForMatching makes this field irrelevant and can lead to security issues when +using different Routes to exclude some of the files from being served. +e.g. if you serve files from directory as such and use different route to exclude some of the files from being served. +0. given folder structure: + public/ + public/index.html + public/admin/private.txt

    +
      +
    1. share public/ folder contents from the server root with e.Static("/", "public")
    2. +
    3. naively assume that everything under /admin folder is now forbidden + e.GET("/admin/*", func(c *Context) error { return echo.ErrForbidden }) +Then request to /assets/../admin%2fprivate.txt will be served as router does not match it to guarded route.
    4. +
    +

    Applies to methods: Echo.Static, Echo.StaticFS, Group.Static, Group.StaticFS.

  • NoGroupAutoRegister404Routes bool

    NoGroupAutoRegister404Routes bool is a flag that indicates whether echo.Group should NOT register 404 routes automatically +when there are middlewares registered with the group. +Note: if you decide not to register 404 routes automatically, make sure to check if all your middlewares are executed +as expected. For example - CORS middleware.

+
+
+

type Context

+

Source: context.go:64

+

Context represents the context of the current HTTP request. It holds request and +response objects, path, path parameters, data and registered handler.

+
+
+ +
+
type Context struct {
+	// contains filtered or unexported fields
+}
+
+
+

func Attachment(file, name string) error

+

Source: context.go:706

+

Attachment sends a response as attachment, prompting client to save the file.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func Bind(i any) error

+

Source: context.go:478

+

Bind binds path params, query params and the request body into provided type i. The default binder +binds body based on Content-Type header.

+
+
+

func Blob(code int, contentType string, b []byte) (err error)

+

Source: context.go:642

+

Blob sends a blob response with status code and content type.

+
+ +
+

func Cookies() []*http.Cookie

+

Source: context.go:452

+

Cookies returns the HTTP cookies sent with the request.

+
+
+

func Echo() *Echo

+

Source: context.go:755

+

Echo returns the Echo instance.

+
+
+

func File(file string) error

+

Source: context.go:661

+

File sends a response with the content of the file.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func FileFS(file string, filesystem fs.FS) error

+

Source: context.go:670

+

FileFS serves file from given file system.

+

When dealing with embed.FS use fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary prefix for directory path. This is necessary as //go:embed assets/imagesembeds files with paths includingassets/images` as their prefix.

+
+
+

func FormFile(name string) (*multipart.FileHeader, error)

+

Source: context.go:426

+

FormFile returns the multipart form file for the provided name.

+
+
+

func FormValue(name string) string

+

Source: context.go:397

+

FormValue returns the form field value for the provided name.

+
+
+

func FormValueOr(name, defaultValue string) string

+

Source: context.go:403

+

FormValueOr returns the form field value or default value for the provided name. +Note: FormValueOr does not distinguish if form had no value by that name or value was empty string

+
+
+

func FormValues() (url.Values, error)

+

Source: context.go:412

+

FormValues returns the form field values as url.Values.

+
+
+

func Get(key string) any

+

Source: context.go:458

+

Get retrieves data from the context. +Method returns any(nil) when key does not exist which is different from typed nil (eg. []byte(nil)).

+
+
+

func HTML(code int, html string) (err error)

+

Source: context.go:514

+

HTML sends an HTTP response with status code.

+
+
+

func HTMLBlob(code int, b []byte) (err error)

+

Source: context.go:519

+

HTMLBlob sends an HTTP blob response with status code.

+
+
+

func InitializeRoute(ri *RouteInfo, pathValues *PathValues)

+

Source: context.go:313

+

InitializeRoute sets the route related variables of this request to the context.

+
+
+

func Inline(file, name string) error

+

Source: context.go:714

+

Inline sends a response as inline, opening the file in the browser.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func IsTLS() bool

+

Source: context.go:188

+

IsTLS returns true if HTTP connection is TLS otherwise false.

+
+
+

func IsWebSocket() bool

+

Source: context.go:193

+

IsWebSocket returns true if HTTP connection is WebSocket otherwise false.

+
+
+

func JSON(code int, i any) (err error)

+

Source: context.go:569

+

JSON sends a JSON response with status code.

+
+
+

func JSONBlob(code int, b []byte) (err error)

+

Source: context.go:579

+

JSONBlob sends a JSON blob response with status code.

+
+
+

func JSONP(code int, callback string, i any) (err error)

+

Source: context.go:585

+

JSONP sends a JSONP response with status code. It uses callback to construct +the JSONP payload.

+
+
+

func JSONPBlob(code int, callback string, b []byte) (err error)

+

Source: context.go:591

+

JSONPBlob sends a JSONP blob response with status code. It uses callback +to construct the JSONP payload.

+
+
+

func JSONPretty(code int, i any, indent string) (err error)

+

Source: context.go:574

+

JSONPretty sends a pretty-print JSON with status code.

+
+
+

func Logger() *slog.Logger

+

Source: context.go:742

+

Logger returns logger in Context

+
+
+

func MultipartForm() (*multipart.Form, error)

+

Source: context.go:436

+

MultipartForm returns the multipart form.

+
+
+

func NoContent(code int) error

+

Source: context.go:726

+

NoContent sends a response with no body and a status code.

+
+
+

func Param(name string) string

+

Source: context.go:283

+

Param returns path parameter by name.

+
+
+

func ParamOr(name, defaultValue string) string

+

Source: context.go:295

+

ParamOr returns the path parameter or default value for the provided name.

+

Notes for DefaultRouter implementation: +Path parameter could be empty for cases like that:

+
    +
  • route /release-:version/bin and request URL is /release-/bin
  • +
  • route /api/:version/image.jpg and request URL is /api//image.jpg +but not when path parameter is last part of route path
  • +
  • route /download/file.:ext will not match request /download/file.
  • +
+
+
+

func Path() string

+

Source: context.go:260

+

Path returns the registered path for the handler.

+
+
+

func PathValues() PathValues

+

Source: context.go:300

+

PathValues returns path parameter values.

+
+
+

func QueryParam(name string) string

+

Source: context.go:337

+

QueryParam returns the query param for the provided name.

+
+
+

func QueryParamOr(name, defaultValue string) string

+

Source: context.go:375

+

QueryParamOr returns the query param or default value for the provided name. +Note: QueryParamOr does not distinguish if query had no value by that name or value was empty string +This means URLs /test?search= and /test would both return 1 for c.QueryParamOr("search", "1")

+
+
+

func QueryParams() url.Values

+

Source: context.go:384

+

QueryParams returns the query parameters as url.Values.

+
+
+

func QueryString() string

+

Source: context.go:392

+

QueryString returns the URL query string.

+
+
+

func RealIP() string

+

Source: context.go:249

+

RealIP returns the client IP address using the configured extraction strategy.

+

If Echo#IPExtractor is set, it is used to resolve the client IP from the incoming request (typically via proxy +headers such as X-Forwarded-For or X-Real-IP). +Look into the ip.go file for comments and examples.

+

See:

+
    +
  • Echo#ExtractIPFromXFFHeader for X-Forwarded-For handling with trust checks
  • +
  • Echo#ExtractIPFromRealIPHeader for X-Real-IP handling with trust checks
  • +
  • Echo#LegacyIPExtractor for v4 compatibility (spoofable, no trust checks built in)
  • +
+

If no extractor is configured, RealIP falls back to the request RemoteAddr, returning only the host portion.

+

Notes:

+
    +
  • No validation or trust enforcement is performed unless implemented by the configured IPExtractor.
  • +
  • When relying on proxy headers, ensure the application is deployed behind trusted intermediaries to avoid spoofing.
  • +
+
+
+

func Redirect(code int, url string) error

+

Source: context.go:732

+

Redirect redirects the request to a provided URL with status code.

+
+
+

func Render(code int, name string, data any) (err error)

+

Source: context.go:493

+

Render renders a template with data and sends a text/html response with status +code. Renderer must be registered using Echo.Renderer.

+
+
+

func Request() *http.Request

+

Source: context.go:167

+

Request returns *http.Request.

+
+
+

func Reset(r *http.Request, w http.ResponseWriter)

+

Source: context.go:141

+

Reset resets the context after request completes. It must be called along +with Echo#AcquireContext() and Echo#ReleaseContext(). +See Echo#ServeHTTP()

+
+
+

func Response() http.ResponseWriter

+

Source: context.go:177

+

Response returns *Response.

+
+
+

func RouteInfo() RouteInfo

+

Source: context.go:275

+

RouteInfo returns current request route information. Method, Path, Name and params if they exist for matched route.

+

RouteInfo returns generic "empty" struct for these cases:

+
    +
  • Context is accessed before Routing is done. For example inside Pre middlewares (e.Pre())
  • +
  • Router did not find matching route - 404 (route not found)
  • +
  • Router did not find matching route with same method - 405 (method not allowed)
  • +
+
+
+

func Scheme() string

+

Source: context.go:212

+

Scheme returns the HTTP protocol scheme, http or https.

+
+
+

func Set(key string, val any)

+

Source: context.go:467

+

Set saves data in the context.

+
+
+

func SetCookie(cookie *http.Cookie)

+

Source: context.go:447

+

SetCookie adds a Set-Cookie header in HTTP response.

+
+
+

func SetLogger(logger *slog.Logger)

+

Source: context.go:750

+

SetLogger sets logger in Context

+
+
+

func SetPath(p string)

+

Source: context.go:265

+

SetPath sets the registered path for the handler.

+
+
+

func SetPathValues(pathValues PathValues)

+

Source: context.go:305

+

SetPathValues sets path parameters for current request.

+
+
+

func SetRequest(r *http.Request)

+

Source: context.go:172

+

SetRequest sets *http.Request.

+
+
+

func SetResponse(r http.ResponseWriter)

+

Source: context.go:183

+

SetResponse sets *http.ResponseWriter. Some context methods and/or middleware require that given ResponseWriter implements following +method Unwrap() http.ResponseWriter which eventually should return *echo.Response instance.

+
+
+

func Stream(code int, contentType string, r io.Reader) (err error)

+

Source: context.go:650

+

Stream sends a streaming response with status code and content type.

+
+
+

func String(code int, s string) (err error)

+

Source: context.go:524

+

String sends a string response with status code.

+
+
+

func Validate(i any) error

+

Source: context.go:484

+

Validate validates provided i. It is usually called after Context#Bind(). +Validator must be registered using Echo#Validator.

+
+
+

func XML(code int, i any) (err error)

+

Source: context.go:621

+

XML sends an XML response with status code.

+
+
+

func XMLBlob(code int, b []byte) (err error)

+

Source: context.go:631

+

XMLBlob sends an XML blob response with status code.

+
+
+

func XMLPretty(code int, i any, indent string) (err error)

+

Source: context.go:626

+

XMLPretty sends a pretty-print XML with status code.

+
+
+
+

type DefaultBinder

+

Source: bind.go:26

+

DefaultBinder is the default implementation of the Binder interface.

+
+
+ +
+
type DefaultBinder struct{}
+
+
+

func Binder) Bind(c *Context, target any) error

+

Source: bind.go:124

+

Bind implements the Binder#Bind function. +Binding is done in following order: 1) path params; 2) query params; 3) request body. Each step COULD override previous +step bound values. For single source binding use their own methods BindBody, BindQueryParams, BindPathValues.

+
+
+
+

type DefaultJSONSerializer

+

Source: json.go:13

+

DefaultJSONSerializer implements JSON encoding using encoding/json.

+
+
+ +
+
type DefaultJSONSerializer struct{}
+
+
+

func Deserialize(c *Context, target any) error

+

Source: json.go:47

+

Deserialize reads a JSON from a request body and converts it into an interface.

+

The body is read into a pooled buffer and decoded with json.Unmarshal rather +than streaming through json.NewDecoder. This avoids allocating a decoder and +its internal read buffer on every request. json.Unmarshal does not retain a +reference to the input slice, so the buffer is safe to reuse afterwards.

+

Note: the full request body is read into memory before decoding. As with any +JSON parser, decoding untrusted input can allocate large amounts of memory; +guard such endpoints with middleware.BodyLimit (or http.MaxBytesReader), +which makes the body read here fail fast once the limit is exceeded.

+
+
+

func Serializer) Serialize(c *Context, target any, indent string) error

+

Source: json.go:28

+

Serialize converts an interface into a json and writes it to the response. +You can optionally use the indent parameter to produce pretty JSONs.

+
+
+
+

type DefaultRouter

+

Source: router.go:60

+

DefaultRouter is the registry of all registered routes for an Echo instance for +request matching and URL path parameter parsing. +Note: DefaultRouter is not coroutine-safe. Do not Add/Remove routes after HTTP server has been started with Echo.

+
+
+ +
+
type DefaultRouter struct {
+	// contains filtered or unexported fields
+}
+
+
+

func Add(route Route) (RouteInfo, error)

+

Source: router.go:508

+

Add registers a new route for method and path with matching handler.

+
+
+

func Remove(method string, path string) error

+

Source: router.go:384

+

Remove unregisters registered route

+
+
+

func Router) Route(c *Context) HandlerFunc

+

Source: router.go:884

+

Route looks up a handler registered for method and path. It also parses URL for path parameters and loads them +into context.

+

For performance:

+
    +
  • Get context from Echo#AcquireContext()
  • +
  • Reset it Context#Reset()
  • +
  • Return it Echo#ReleaseContext().
  • +
+
+
+

func Routes() Routes

+

Source: router.go:379

+

Routes returns all registered routes

+
+
+
+

type Echo

+

Source: echo.go:69

+

Echo is the top-level framework instance.

+

Goroutine safety: Do not mutate Echo instance fields after server has started. Accessing these +fields from handlers/middlewares and changing field values at the same time leads to data-races. +Same rule applies to adding new routes after server has been started - Adding a route is not Goroutine safe action.

+
+
+ +
+
type Echo struct {
+	Binder Binder
+
+	// Filesystem is the file system used for serving static files. Defaults to the current working directory (os.Getwd()).
+	//
+	// Note: fs.FS.Open() already assumes that file names are relative to FS root path and considers name with prefix `/` as invalid
+	// so if you have `fs := os.DirFS("/tmp")` and you try to `fs.Open("/tmp/file.txt")` it will fail, but "file.txt"
+	// would succeed. `echo.NewDefaultFS("/tmp")` overwrites this behavior and allows you to use Open with a matching
+	// absolute path prefix.
+	Filesystem fs.FS
+
+	Renderer         Renderer
+	Validator        Validator
+	JSONSerializer   JSONSerializer
+	IPExtractor      IPExtractor
+	OnAddRoute       func(route Route) error
+	HTTPErrorHandler HTTPErrorHandler
+	Logger           *slog.Logger
+	// contains filtered or unexported fields
+}
+
+
Fields
  • Binder Binder
  • Filesystem fs.FS

    Filesystem is the file system used for serving static files. Defaults to the current working directory (os.Getwd()).

    +

    Note: fs.FS.Open() already assumes that file names are relative to FS root path and considers name with prefix / as invalid +so if you have fs := os.DirFS("/tmp") and you try to fs.Open("/tmp/file.txt") it will fail, but "file.txt" +would succeed. echo.NewDefaultFS("/tmp") overwrites this behavior and allows you to use Open with a matching +absolute path prefix.

  • Renderer Renderer
  • Validator Validator
  • JSONSerializer JSONSerializer
  • IPExtractor IPExtractor
  • OnAddRoute func(route Route) error
  • HTTPErrorHandler HTTPErrorHandler
  • Logger *slog.Logger
+
+

func AcquireContext() *Context

+

Source: echo.go:782

+

AcquireContext returns an empty Context instance from the pool. +You must return the context by calling ReleaseContext().

+
+
+

func Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo

+

Source: echo.go:736

+

Add registers a new route for an HTTP method and path with matching handler +in the router with optional route-level middleware.

+
+
+

func AddRoute(route Route) (RouteInfo, error)

+

Source: echo.go:711

+

AddRoute registers a new Route with default host Router

+
+
+

func Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo

+

Source: echo.go:586

+

Any registers a new route for all HTTP methods (supported by Echo) and path with matching handler +in the router with optional route-level middleware.

+

Note: this method only adds specific set of supported HTTP methods as handler and is not true +"catch-any-arbitrary-method" way of matching requests.

+
+
+

func CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:513

+

CONNECT registers a new CONNECT route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:519

+

DELETE registers a new DELETE route for a path with matching handler in the router +with optional route-level middleware. Panics on error.

+
+
+

func File(path, file string, middleware ...MiddlewareFunc) RouteInfo

+

Source: echo.go:703

+

File registers a new route with path to serve a static file with optional route-level middleware. Panics on error.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func FileFS(path, file string, filesystem fs.FS, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:685

+

FileFS registers a new route with path to serve file from the provided file system.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func GET(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:525

+

GET registers a new GET route for a path with matching handler in the router +with optional route-level middleware. Panics on error.

+
+
+

func Group(prefix string, m ...MiddlewareFunc) (g *Group)

+

Source: echo.go:753

+

Group creates a new router group with prefix and optional group-level middleware.

+
+
+

func HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:531

+

HEAD registers a new HEAD route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) Routes

+

Source: echo.go:592

+

Match registers a new route for multiple HTTP methods and path with matching +handler in the router with optional route-level middleware. Panics on error.

+
+
+

func Middlewares() []MiddlewareFunc

+

Source: echo.go:776

+

Middlewares returns registered route level middlewares. Does not contain any group level +middlewares. Use this method to build your own ServeHTTP method.

+

NOTE: returned slice is not a copy. Do not mutate.

+
+
+

func NewContext(r *http.Request, w http.ResponseWriter) *Context

+

Source: echo.go:431

+

NewContext returns a new Context instance.

+

Note: both request and response can be left to nil as Echo.ServeHTTP will call c.Reset(req,resp) anyway +these arguments are useful when creating context for tests and cases like that.

+
+
+

func OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:537

+

OPTIONS registers a new OPTIONS route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:543

+

PATCH registers a new PATCH route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func POST(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:549

+

POST registers a new POST route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func PUT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:555

+

PUT registers a new PUT route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func Pre(middleware ...MiddlewareFunc)

+

Source: echo.go:500

+

Pre adds middleware to the chain which is run before router tries to find matching route. +Meaning middleware is executed even for 404 (not found) cases.

+
+
+

func PreMiddlewares() []MiddlewareFunc

+

Source: echo.go:768

+

PreMiddlewares returns registered pre middlewares. These are middleware to the chain +which are run before router tries to find matching route. +Use this method to build your own ServeHTTP method.

+

NOTE: returned slice is not a copy. Do not mutate.

+
+
+

func QUERY(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:561

+

QUERY registers a new QUERY route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func ReleaseContext(c *Context)

+

Source: echo.go:788

+

ReleaseContext returns the Context instance back to the pool. +You must call it after AcquireContext().

+
+
+

func RouteNotFound(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:577

+

RouteNotFound registers a special-case route which is executed when no other route is found (i.e. HTTP 404 cases) +for current request URL. +Path supports static and named/any parameters just like other http method is defined. Generally path is ended with +wildcard/match-any character (/*, /download/* etc).

+

Example: e.RouteNotFound("/*", func(c *echo.Context) error { return c.NoContent(http.StatusNotFound) })

+
+
+

func Router() Router

+

Source: echo.go:436

+

Router returns the default router.

+
+
+

func ServeHTTP(w http.ResponseWriter, r *http.Request)

+

Source: echo.go:793

+

ServeHTTP implements http.Handler interface, which serves HTTP requests.

+
+
+

func Start(address string) error

+

Source: echo.go:840

+

Start stars HTTP server on given address with Echo as a handler serving requests. The server can be shutdown by +sending os.Interrupt signal with ctrl+c. Method returns only errors that are not http.ErrServerClosed.

+

Note: this method is created for use in examples/demos and is deliberately simple without providing configuration +options.

+

In need of customization use:

+
+
+ +
+
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
+defer cancel()
+sc := echo.StartConfig{Address: ":8080"}
+if err := sc.Start(ctx, e); err != nil && !errors.Is(err, http.ErrServerClosed) {
+	slog.Error(err.Error())
+}
+

// or standard library http.Server

+
+
+ +
+
s := http.Server{Addr: ":8080", Handler: e}
+if err := s.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
+	slog.Error(err.Error())
+}
+
+
+
+

func Static(pathPrefix, fsRoot string, middleware ...MiddlewareFunc) RouteInfo

+

Source: echo.go:615

+

Static registers a new route with path prefix to serve static files from the provided root directory.

+
+
+

func StaticFS(pathPrefix string, filesystem fs.FS, middleware ...MiddlewareFunc) RouteInfo

+

Source: echo.go:630

+

StaticFS registers a new route with path prefix to serve static files from the provided file system.

+

When dealing with embed.FS use fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary prefix for directory path. This is necessary as //go:embed assets/imagesembeds files with paths includingassets/images` as their prefix.

+
+
+

func TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:567

+

TRACE registers a new TRACE route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func Use(middleware ...MiddlewareFunc)

+

Source: echo.go:506

+

Use adds middleware to the chain which is run after router has found matching route and before route/request handler method is executed.

+
+
+
+

type Group

+

Source: group.go:14

+

Group is a set of sub-routes for a specified route. It can be used for inner +routes that share a common middleware or functionality that should be separate +from the parent echo instance while still inheriting from it.

+
+
+ +
+
type Group struct {
+	// contains filtered or unexported fields
+}
+
+
+

func Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo

+

Source: group.go:186

+

Add implements Echo#Add() for sub-routes within the Group. Panics on error.

+
+
+

func AddRoute(route Route) (RouteInfo, error)

+

Source: group.go:200

+

AddRoute registers a new Routable with Router

+
+
+

func Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo

+

Source: group.go:99

+

Any implements Echo#Any() for sub-routes within the Group. Panics on error.

+
+
+

func CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:49

+

CONNECT implements Echo#CONNECT() for sub-routes within the Group. Panics on error.

+
+
+

func DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:54

+

DELETE implements Echo#DELETE() for sub-routes within the Group. Panics on error.

+
+
+

func File(path, file string, middleware ...MiddlewareFunc) RouteInfo

+

Source: group.go:171

+

File implements Echo#File() for sub-routes within the Group. Panics on error.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func FileFS(path, file string, filesystem fs.FS, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:163

+

FileFS implements Echo#FileFS() for sub-routes within the Group.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func GET(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:59

+

GET implements Echo#GET() for sub-routes within the Group. Panics on error.

+
+
+

func Group) Group(prefix string, middleware ...MiddlewareFunc) (sg *Group)

+

Source: group.go:131

+

Group creates a new sub-group with prefix and optional sub-group-level middleware.

+

Important! Group middlewares are executed in case there was no exact route match as by default Group registers +/* NotFound routes for itself. If this kind of behavior is not needed, then create an Echo instance with the noAutoRegisterRoutes +flag set to true. Example echo.NewWithConfig(echo.Config{NoGroupAutoRegister404Routes: true}).

+
+
+

func HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:64

+

HEAD implements Echo#HEAD() for sub-routes within the Group. Panics on error.

+
+
+

func Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) Routes

+

Source: group.go:104

+

Match implements Echo#Match() for sub-routes within the Group. Panics on error.

+
+
+

func OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:69

+

OPTIONS implements Echo#OPTIONS() for sub-routes within the Group. Panics on error.

+
+
+

func PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:74

+

PATCH implements Echo#PATCH() for sub-routes within the Group. Panics on error.

+
+
+

func POST(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:79

+

POST implements Echo#POST() for sub-routes within the Group. Panics on error.

+
+
+

func PUT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:84

+

PUT implements Echo#PUT() for sub-routes within the Group. Panics on error.

+
+
+

func QUERY(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:89

+

QUERY implements Echo#QUERY() for sub-routes within the Group. Panics on error.

+
+
+

func RouteNotFound(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:181

+

RouteNotFound implements Echo#RouteNotFound() for sub-routes within the Group.

+

Example: g.RouteNotFound("/*", func(c *echo.Context) error { return c.NoContent(http.StatusNotFound) })

+
+
+

func Static(pathPrefix, fsRoot string, middleware ...MiddlewareFunc) RouteInfo

+

Source: group.go:140

+

Static implements Echo#Static() for sub-routes within the Group.

+
+
+

func StaticFS(pathPrefix string, filesystem fs.FS, middleware ...MiddlewareFunc) RouteInfo

+

Source: group.go:150

+

StaticFS implements Echo#StaticFS() for sub-routes within the Group.

+

When dealing with embed.FS use fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary prefix for directory path. This is necessary as //go:embed assets/imagesembeds files with paths includingassets/images` as their prefix.

+
+
+

func TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:94

+

TRACE implements Echo#TRACE() for sub-routes within the Group. Panics on error.

+
+
+

func Use(middleware ...MiddlewareFunc)

+

Source: group.go:31

+

Use implements Echo#Use() for sub-routes within the Group.

+

Important! Group middlewares are executed in case there was no exact route match as by default Group registers +/* NotFound routes for itself. If this kind of behavior is not needed, then create an Echo instance with the noAutoRegisterRoutes +flag set to true. Example echo.NewWithConfig(echo.Config{NoGroupAutoRegister404Routes: true}).

+
+
+
+

type HTTPError

+

Source: httperror.go:107

+

HTTPError represents an error that occurred while handling a request.

+
+
+ +
+
type HTTPError struct {
+	// Code is status code for HTTP response
+	Code    int    `json:"-"`
+	Message string `json:"message"`
+	// contains filtered or unexported fields
+}
+
+
Fields
  • Code int `json:"-"`

    Code is status code for HTTP response

  • Message string `json:"message"`
+
+

func Error) Error() string

+

Source: httperror.go:120

+

Error makes it compatible with the error interface.

+
+
+

func StatusCode() int

+

Source: httperror.go:115

+

StatusCode returns status code for HTTP response

+
+
+

func Unwrap() error

+

Source: httperror.go:140

+
+
+

func Wrap(err error) error

+

Source: httperror.go:132

+

Wrap returns a new HTTPError with given errors wrapped inside

+
+
+
+

type HTTPErrorHandler

+

Source: echo.go:127

+

HTTPErrorHandler is a centralized HTTP error handler.

+
+
+ +
+
type HTTPErrorHandler func(c *Context, err error)
+
+
+
+

type HTTPStatusCoder

+

Source: httperror.go:39

+

HTTPStatusCoder is an interface that errors can implement to produce status code for HTTP response

+
+
+ +
+
type HTTPStatusCoder interface {
+	StatusCode() int
+}
+
+
Methods
  • StatusCode func() int
+
+
+

type HandlerFunc

+

Source: echo.go:130

+

HandlerFunc defines a function to serve HTTP requests.

+
+
+ +
+
type HandlerFunc func(c *Context) error
+
+
+
+

type IPExtractor

+

Source: ip.go:203

+

IPExtractor is a function to extract IP addr from http.Request. +Set appropriate one to Echo#IPExtractor. +See https://echo.labstack.com/guide/ip-address for more details.

+
+
+ +
+
type IPExtractor func(*http.Request) string
+
+
+
+

type JSONSerializer

+

Source: echo.go:121

+

JSONSerializer is the interface that encodes and decodes JSON to and from interfaces.

+
+
+ +
+
type JSONSerializer interface {
+	Serialize(c *Context, target any, indent string) error
+	Deserialize(c *Context, target any) error
+}
+
+
Methods
  • Serialize func(c *Context, target any, indent string) error
  • Deserialize func(c *Context, target any) error
+
+
+

type MiddlewareConfigurator

+

Source: echo.go:136

+

MiddlewareConfigurator defines interface for creating middleware handlers with possibility to return configuration errors instead of panicking.

+
+
+ +
+
type MiddlewareConfigurator interface {
+	ToMiddleware() (MiddlewareFunc, error)
+}
+
+
Methods
  • ToMiddleware func() (MiddlewareFunc, error)
+
+
+

type MiddlewareFunc

+

Source: echo.go:133

+

MiddlewareFunc defines a function to process middleware.

+
+
+ +
+
type MiddlewareFunc func(next HandlerFunc) HandlerFunc
+
+
+
+

type PathValue

+

Source: router.go:1146

+

PathValue is tuple pf path parameter name and its value in request path

+
+
+ +
+
type PathValue struct {
+	Name  string
+	Value string
+}
+
+
Fields
  • Name string
  • Value string
+
+
+

type PathValues

+

Source: router.go:1143

+

PathValues is collections of PathValue instances with various helper methods

+
+
+ +
+
type PathValues []PathValue
+
+
+

func Get(name string) (string, bool)

+

Source: router.go:1152

+

Get returns path parameter value for given name or false.

+
+
+

func GetOr(name string, defaultValue string) string

+

Source: router.go:1162

+

GetOr returns path parameter value for given name or default value if the name does not exist.

+
+
+
+

type Renderer

+

Source: renderer.go:9

+

Renderer is the interface that wraps the Render function.

+
+
+ +
+
type Renderer interface {
+	Render(c *Context, w io.Writer, templateName string, data any) error
+}
+
+
Methods
  • Render func(c *Context, w io.Writer, templateName string, data any) error
+
+
+

type Response

+

Source: response.go:19

+

Response wraps an http.ResponseWriter and implements its interface to be used +by an HTTP handler to construct an HTTP response. +See: https://golang.org/pkg/net/http/#ResponseWriter

+
+
+ +
+
type Response struct {
+	http.ResponseWriter
+
+	Status    int
+	Size      int64
+	Committed bool
+	// contains filtered or unexported fields
+}
+
+
Fields
  • http.ResponseWriter
  • Status int
  • Size int64
  • Committed bool
+
+

func After(fn func())

+

Source: response.go:42

+

After registers a function which is called just after the response is written.

+
+
+

func Before(fn func())

+

Source: response.go:37

+

Before registers a function which is called just before the response (status) is written.

+
+
+

func Flush()

+

Source: response.go:82

+

Flush implements the http.Flusher interface to allow an HTTP handler to flush +buffered data to the client. +See http.Flusher

+
+
+

func Hijack() (net.Conn, *bufio.ReadWriter, error)

+

Source: response.go:93

+

Hijack implements the http.Hijacker interface to allow an HTTP handler to +take over the connection. +This method is relevant to Websocket connection upgrades, proxis, and other advanced use cases. +See http.Hijacker

+
+
+

func Unwrap() http.ResponseWriter

+

Source: response.go:106

+

Unwrap returns the original http.ResponseWriter. +ResponseController can be used to access the original http.ResponseWriter. +See [https://go.dev/blog/go1.20]

+
+
+

func Write(b []byte) (n int, err error)

+

Source: response.go:64

+

Write writes the data to the connection as part of an HTTP reply.

+
+
+

func WriteHeader(code int)

+

Source: response.go:50

+

WriteHeader sends an HTTP response header with status code. If WriteHeader is +not called explicitly, the first call to Write will trigger an implicit +WriteHeader(http.StatusOK). Thus explicit calls to WriteHeader are mainly +used to send error codes.

+
+
+
+

type Route

+

Source: route.go:16

+

Route contains information to adding/registering new route with the router. +Method+Path pair uniquely identifies the Route. It is mandatory to provide Method+Path fields.

+
+
+ +
+
type Route struct {
+	Method string
+	Path   string
+	Name   string
+
+	// HandlerFunc is a function that handles HTTP requests. This could be left nil when the Router implementation allows
+	// fallback to default/global handlers in certain situations.
+	Handler     HandlerFunc
+	Middlewares []MiddlewareFunc
+}
+
+
Fields
  • Method string
  • Path string
  • Name string
  • Handler HandlerFunc

    HandlerFunc is a function that handles HTTP requests. This could be left nil when the Router implementation allows +fallback to default/global handlers in certain situations.

  • Middlewares []MiddlewareFunc
+
+

func ToRouteInfo(params []string) RouteInfo

+

Source: route.go:28

+

ToRouteInfo converts Route to RouteInfo

+
+
+

func WithPrefix(pathPrefix string, middlewares []MiddlewareFunc) Route

+

Source: route.go:43

+

WithPrefix recreates Route with added group prefix and group middlewares it is grouped to.

+
+
+
+

type RouteInfo

+

Source: route.go:56

+

RouteInfo contains information about registered Route.

+
+
+ +
+
type RouteInfo struct {
+	Name       string
+	Method     string
+	Path       string
+	Parameters []string
+}
+
+
Fields
  • Name string
  • Method string
  • Path string
  • Parameters []string
+
+

func Clone() RouteInfo

+

Source: route.go:68

+

Clone creates copy of RouteInfo

+
+
+

func Reverse(pathValues ...any) string

+

Source: route.go:78

+

Reverse reverses route to URL string by replacing path parameters with given params values.

+
+
+
+

type Router

+

Source: router.go:21

+

Router is interface for routing request contexts to registered routes.

+

Contract between Echo/Context instance and the router:

+
    +
  • all routes must be added through methods on echo.Echo instance. +Reason: Echo instance uses RouteInfo.Params() length to allocate slice for paths parameters (see Echo.contextPathParamAllocSize).
  • +
  • Router must populate Context during Router.Route call with:
  • +
  • Context.InitializeRoute (IMPORTANT! to reduce allocations use same slice that c.PathValues() returns)
  • +
  • Optionally can set additional information to Context with Context.Set
  • +
+
+
+ +
+
type Router interface {
+	// Add registers Routable with the Router and returns registered RouteInfo.
+	//
+	// Router may change Route.Path value in returned RouteInfo.Path.
+	// Router generates RouteInfo.Parameters values from Route.Path.
+	// Router generates RouteInfo.Name value if it is not provided.
+	Add(routable Route) (RouteInfo, error)
+
+	// Remove removes route from the Router.
+	//
+	// Router may choose not to implement this method.
+	Remove(method string, path string) error
+
+	// Routes returns information about all registered routes
+	Routes() Routes
+
+	// Route searches Router for matching route and applies it to the given context. In case when no matching method
+	// was not found (405) or no matching route exists for path (404), router will return its implementation of 405/404
+	// handler function.
+	//
+	// Router must populate Context during Router.Route call with:
+	// - Context.InitializeRoute() (IMPORTANT! to reduce allocations use same slice that c.PathValues() returns)
+	// - optionally can set additional information to Context with Context.Set()
+	Route(c *Context) HandlerFunc
+}
+
+
Methods
  • Add func(routable Route) (RouteInfo, error)

    Add registers Routable with the Router and returns registered RouteInfo.

    +

    Router may change Route.Path value in returned RouteInfo.Path. +Router generates RouteInfo.Parameters values from Route.Path. +Router generates RouteInfo.Name value if it is not provided.

  • Remove func(method string, path string) error

    Remove removes route from the Router.

    +

    Router may choose not to implement this method.

  • Routes func() Routes

    Routes returns information about all registered routes

  • Route func(c *Context) HandlerFunc

    Route searches Router for matching route and applies it to the given context. In case when no matching method +was not found (405) or no matching route exists for path (404), router will return its implementation of 405/404 +handler function.

    +

    Router must populate Context during Router.Route call with:

    +
      +
    • Context.InitializeRoute() (IMPORTANT! to reduce allocations use same slice that c.PathValues() returns)
    • +
    • optionally can set additional information to Context with Context.Set()
    • +
+
+
+

type RouterConfig

+

Source: router.go:76

+

RouterConfig is configuration options for (default) router

+
+
+ +
+
type RouterConfig struct {
+	// NotFoundHandler is a handler that is executed when no route matches the request.
+	NotFoundHandler HandlerFunc
+
+	// MethodNotAllowedHandler is a handler that is executed when no route with exact METHOD matches the request but
+	// there is a route with same path but different method.
+	MethodNotAllowedHandler HandlerFunc
+
+	// OptionsMethodHandler is a handler that is executed when an OPTIONS request is made.
+	OptionsMethodHandler HandlerFunc
+
+	// AllowOverwritingRoute allows overwriting existing routes. If false, then adding a route with the same method
+	// and path will return an error.
+	AllowOverwritingRoute bool
+
+	// UnescapePathParamValues forces router to unescape path parameter values before setting them in context.
+	UnescapePathParamValues bool
+
+	// UseEscapedPathForMatching forces router to use an escaped path (req.URL.RawPath instead of req.URL.Path) for matching.
+	// Difference between URL.RawPath and URL.Path is:
+	//  * URL.Path is where request path is stored. Value is stored in decoded form: /%47%6f%2f becomes /Go/.
+	//  * URL.RawPath is an optional field which only gets set if the default encoding is different from Path.
+	UseEscapedPathForMatching bool
+
+	// AutoHandleHEAD enables automatic handling of HTTP HEAD requests by
+	// falling back to the corresponding GET route.
+	//
+	// When enabled, a HEAD request will match the same handler as GET for
+	// the route, but the response body is suppressed in accordance with
+	// HTTP semantics. Headers (e.g., Content-Length, Content-Type) are
+	// preserved as if a GET request was made.
+	//
+	// Security considerations: the GET handler is fully executed for every
+	// HEAD request, including all side effects:
+	//   - State-mutating operations (DB writes, audit logs, counters) run.
+	//   - Rate-limiting middleware consumes quota, enabling low-cost exhaustion.
+	//   - Expensive computations run with no response body returned to the
+	//     caller, making HEAD cheaper to abuse for DoS than GET.
+	//   - All GET routes become enumerable via HEAD probing (200 = route
+	//     exists, 405 = route absent).
+	//
+	// If route confidentiality/state-mutation is a concern, leave AutoHandleHEAD disabled
+	// and register explicit HEAD handlers only for routes that are safe to
+	// expose (e.g. e.HEAD("/public", handler)).
+	// You can leverage Echo.OnAddRoute callback to add HEAD routes explicitly from a single place.
+	//
+	// Disabled by default.
+	AutoHandleHEAD bool
+}
+
+
Fields
  • NotFoundHandler HandlerFunc

    NotFoundHandler is a handler that is executed when no route matches the request.

  • MethodNotAllowedHandler HandlerFunc

    MethodNotAllowedHandler is a handler that is executed when no route with exact METHOD matches the request but +there is a route with same path but different method.

  • OptionsMethodHandler HandlerFunc

    OptionsMethodHandler is a handler that is executed when an OPTIONS request is made.

  • AllowOverwritingRoute bool

    AllowOverwritingRoute allows overwriting existing routes. If false, then adding a route with the same method +and path will return an error.

  • UnescapePathParamValues bool

    UnescapePathParamValues forces router to unescape path parameter values before setting them in context.

  • UseEscapedPathForMatching bool

    UseEscapedPathForMatching forces router to use an escaped path (req.URL.RawPath instead of req.URL.Path) for matching. +Difference between URL.RawPath and URL.Path is:

    +
      +
    • URL.Path is where request path is stored. Value is stored in decoded form: /%47%6f%2f becomes /Go/.
    • +
    • URL.RawPath is an optional field which only gets set if the default encoding is different from Path.
    • +
  • AutoHandleHEAD bool

    AutoHandleHEAD enables automatic handling of HTTP HEAD requests by +falling back to the corresponding GET route.

    +

    When enabled, a HEAD request will match the same handler as GET for +the route, but the response body is suppressed in accordance with +HTTP semantics. Headers (e.g., Content-Length, Content-Type) are +preserved as if a GET request was made.

    +

    Security considerations: the GET handler is fully executed for every +HEAD request, including all side effects:

    +
      +
    • State-mutating operations (DB writes, audit logs, counters) run.
    • +
    • Rate-limiting middleware consumes quota, enabling low-cost exhaustion.
    • +
    • Expensive computations run with no response body returned to the +caller, making HEAD cheaper to abuse for DoS than GET.
    • +
    • All GET routes become enumerable via HEAD probing (200 = route +exists, 405 = route absent).
    • +
    +

    If route confidentiality/state-mutation is a concern, leave AutoHandleHEAD disabled +and register explicit HEAD handlers only for routes that are safe to +expose (e.g. e.HEAD("/public", handler)). +You can leverage Echo.OnAddRoute callback to add HEAD routes explicitly from a single place.

    +

    Disabled by default.

+
+
+

type Routes

+

Source: router.go:55

+

Routes is collection of RouteInfo instances with various helper methods.

+
+
+ +
+
type Routes []RouteInfo
+
+
+

func Clone() Routes

+

Source: route.go:111

+

Clone creates copy of Routes

+
+
+

func FilterByMethod(method string) (Routes, error)

+

Source: route.go:144

+

FilterByMethod searched for matching route info by method

+
+
+

func FilterByName(name string) (Routes, error)

+

Source: route.go:180

+

FilterByName searched for matching route info by name

+
+
+

func FilterByPath(path string) (Routes, error)

+

Source: route.go:162

+

FilterByPath searched for matching route info by path

+
+
+

func FindByMethodPath(method string, path string) (RouteInfo, error)

+

Source: route.go:130

+

FindByMethodPath searched for matching route info by method and path

+
+
+

func Reverse(routeName string, pathValues ...any) (string, error)

+

Source: route.go:120

+

Reverse reverses route to URL string by replacing path parameters with given params values.

+
+
+
+

type StartConfig

+

Source: server.go:26

+

StartConfig is for creating configured http.Server instance to start serve http(s) requests with given Echo instance

+
+
+ +
+
type StartConfig struct {
+	// Address specifies the address where listener will start listening on to serve HTTP(s) requests
+	Address string
+
+	// HideBanner instructs Start* method not to print banner when starting the Server.
+	HideBanner bool
+	// HidePort instructs Start* method not to print port when starting the Server.
+	HidePort bool
+
+	// CertFilesystem is filesystem is used to read `certFile` and `keyFile` when StartTLS method is called.
+	CertFilesystem fs.FS
+
+	// TLSConfig is used to configure TLS. If Listener is set, TLSConfig is not used to create the listener.
+	TLSConfig *tls.Config
+
+	// Listener is used to start server with the custom listener.
+	Listener net.Listener
+	// ListenerNetwork is used configure on which Network listener will use.
+	// If Listener is set, ListenerNetwork is not used.
+	ListenerNetwork string
+	// ListenerAddrFunc will be called after listener is created and started to listen for connections. This is useful in
+	// testing situations when server is started on random port `address = ":0"` in that case you can get actual port where
+	// listener is listening on.
+	ListenerAddrFunc func(addr net.Addr)
+
+	// GracefulTimeout is timeout value (defaults to 10sec) graceful shutdown will wait for server to handle ongoing requests
+	// before shutting down the server.
+	GracefulTimeout time.Duration
+	// OnShutdownError is called when graceful shutdown results an error. for example when listeners are not shut down within
+	// given timeout
+	OnShutdownError func(err error)
+
+	// BeforeServeFunc is callback that is called just before server starts to serve HTTP request.
+	// Use this callback when you want to configure http.Server different timeouts/limits/etc
+	BeforeServeFunc func(s *http.Server) error
+}
+
+
Fields
  • Address string

    Address specifies the address where listener will start listening on to serve HTTP(s) requests

  • HideBanner bool

    HideBanner instructs Start* method not to print banner when starting the Server.

  • HidePort bool

    HidePort instructs Start* method not to print port when starting the Server.

  • CertFilesystem fs.FS

    CertFilesystem is filesystem is used to read certFile and keyFile when StartTLS method is called.

  • TLSConfig *tls.Config

    TLSConfig is used to configure TLS. If Listener is set, TLSConfig is not used to create the listener.

  • Listener net.Listener

    Listener is used to start server with the custom listener.

  • ListenerNetwork string

    ListenerNetwork is used configure on which Network listener will use. +If Listener is set, ListenerNetwork is not used.

  • ListenerAddrFunc func(addr net.Addr)

    ListenerAddrFunc will be called after listener is created and started to listen for connections. This is useful in +testing situations when server is started on random port address = ":0" in that case you can get actual port where +listener is listening on.

  • GracefulTimeout time.Duration

    GracefulTimeout is timeout value (defaults to 10sec) graceful shutdown will wait for server to handle ongoing requests +before shutting down the server.

  • OnShutdownError func(err error)

    OnShutdownError is called when graceful shutdown results an error. for example when listeners are not shut down within +given timeout

  • BeforeServeFunc func(s *http.Server) error

    BeforeServeFunc is callback that is called just before server starts to serve HTTP request. +Use this callback when you want to configure http.Server different timeouts/limits/etc

+
+

func StartConfig) Start(ctx stdContext.Context, h http.Handler) error

+

Source: server.go:64

+

Start starts given Handler with HTTP(s) server.

+
+
+

func StartTLS(ctx stdContext.Context, h http.Handler, certFile, keyFile any) error

+

Source: server.go:71

+

StartTLS starts given Handler with HTTPS server. +If certFile or keyFile is string the values are treated as file paths. +If certFile or keyFile is []byte the values are treated as the certificate or key as-is.

+
+
+
+

type TemplateRenderer

+

Source: renderer.go:23

+

TemplateRenderer is helper to ease creating renderers for html/template and text/template packages. +Example usage:

+
+
+ +
+
	e.Renderer = &echo.TemplateRenderer{
+		Template: template.Must(template.ParseGlob("templates/*.html")),
+	}
+
+  e.Renderer = &echo.TemplateRenderer{
+		Template: template.Must(template.New("hello").Parse("Hello, {{.}}!")),
+	}
+
+
+
+ +
+
type TemplateRenderer struct {
+	Template interface {
+		ExecuteTemplate(wr io.Writer, name string, data any) error
+	}
+}
+
+
Fields
  • Template interface { + ExecuteTemplate(wr io.Writer, name string, data any) error +}
+
+

func Renderer) Render(c *Context, w io.Writer, name string, data any) error

+

Source: renderer.go:30

+

Render renders the template with given data.

+
+
+
+

type TimeLayout

+

Source: binder_generic.go:16

+

TimeLayout specifies the format for parsing time values in request parameters. +It can be a standard Go time layout string or one of the special Unix time layouts.

+
+
+ +
+
type TimeLayout string
+
+
+
+

type TimeOpts

+

Source: binder_generic.go:19

+

TimeOpts is options for parsing time.Time values

+
+
+ +
+
type TimeOpts struct {
+	// Layout specifies the format for parsing time values in request parameters.
+	// It can be a standard Go time layout string or one of the special Unix time layouts.
+	//
+	// Parsing layout defaults to: echo.TimeLayout(time.RFC3339Nano)
+	// - To convert to custom layout use `echo.TimeLayout("2006-01-02")`
+	// - To convert unix timestamp (integer) to time.Time use `echo.TimeLayoutUnixTime`
+	// - To convert unix timestamp in milliseconds to time.Time use `echo.TimeLayoutUnixTimeMilli`
+	// - To convert unix timestamp in nanoseconds to time.Time use `echo.TimeLayoutUnixTimeNano`
+	Layout TimeLayout
+
+	// ParseInLocation is location used with time.ParseInLocation for layout that do not contain
+	// timezone information to set output time in given location.
+	// Defaults to time.UTC
+	ParseInLocation *time.Location
+
+	// ToInLocation is location to which parsed time is converted to after parsing.
+	// The parsed time will be converted using time.In(ToInLocation).
+	// Defaults to time.UTC
+	ToInLocation *time.Location
+}
+
+
Fields
  • Layout TimeLayout

    Layout specifies the format for parsing time values in request parameters. +It can be a standard Go time layout string or one of the special Unix time layouts.

    +

    Parsing layout defaults to: echo.TimeLayout(time.RFC3339Nano)

    +
      +
    • To convert to custom layout use echo.TimeLayout("2006-01-02")
    • +
    • To convert unix timestamp (integer) to time.Time use echo.TimeLayoutUnixTime
    • +
    • To convert unix timestamp in milliseconds to time.Time use echo.TimeLayoutUnixTimeMilli
    • +
    • To convert unix timestamp in nanoseconds to time.Time use echo.TimeLayoutUnixTimeNano
    • +
  • ParseInLocation *time.Location

    ParseInLocation is location used with time.ParseInLocation for layout that do not contain +timezone information to set output time in given location. +Defaults to time.UTC

  • ToInLocation *time.Location

    ToInLocation is location to which parsed time is converted to after parsing. +The parsed time will be converted using time.In(ToInLocation). +Defaults to time.UTC

+
+
+

type TrustOption

+

Source: ip.go:144

+

TrustOption is config for which IP address to trust

+
+
+ +
+
type TrustOption func(*ipChecker)
+
+
+
+

type Validator

+

Source: echo.go:141

+

Validator is the interface that wraps the Validate function.

+
+
+ +
+
type Validator interface {
+	Validate(i any) error
+}
+
+
Methods
  • Validate func(i any) error
+
+
+

type ValueBinder

+

Source: binder.go:113

+

ValueBinder provides utility methods for binding query or path parameter to various Go built-in types

+
+
+ +
+
type ValueBinder struct {
+	// ValueFunc is used to get single parameter (first) value from request
+	ValueFunc func(sourceParam string) string
+	// ValuesFunc is used to get all values for parameter from request. i.e. `/api/search?ids=1&ids=2`
+	ValuesFunc func(sourceParam string) []string
+	// ErrorFunc is used to create errors. Allows you to use your own error type, that for example marshals to your specific json response
+	ErrorFunc func(sourceParam string, values []string, message string, internalError error) error
+	// contains filtered or unexported fields
+}
+
+
Fields
  • ValueFunc func(sourceParam string) string

    ValueFunc is used to get single parameter (first) value from request

  • ValuesFunc func(sourceParam string) []string

    ValuesFunc is used to get all values for parameter from request. i.e. /api/search?ids=1&ids=2

  • ErrorFunc func(sourceParam string, values []string, message string, internalError error) error

    ErrorFunc is used to create errors. Allows you to use your own error type, that for example marshals to your specific json response

+
+

func BindError() error

+

Source: binder.go:207

+

BindError returns first seen bind error and resets/empties binder errors for further calls

+
Example +
+
+ +
+
{
+
+	failFastRouteFunc := func(c *echo.Context) error {
+		var opts struct {
+			IDs    []int64
+			Active bool
+		}
+		length := int64(50)
+
+		b := echo.QueryParamsBinder(c)
+
+		err := b.Int64("length", &length).
+			Int64s("ids", &opts.IDs).
+			Bool("active", &opts.Active).
+			BindError()
+		if err != nil {
+			bErr := err.(*echo.BindingError)
+			return fmt.Errorf("my own custom error for field: %s values: %v", bErr.Field, bErr.Values)
+		}
+		fmt.Printf("active = %v, length = %v, ids = %v\n", opts.Active, length, opts.IDs)
+
+		return c.JSON(http.StatusOK, opts)
+	}
+
+	e := echo.New()
+	c := e.NewContext(
+		httptest.NewRequest(http.MethodGet, "/api/endpoint?active=true&length=25&ids=1&ids=2&ids=3", nil),
+		httptest.NewRecorder(),
+	)
+
+	_ = failFastRouteFunc(c)
+
+}
+
+

Output:

+
+
+ +
+
active = true, length = 25, ids = [1 2 3]
+
+
+
+
+

func BindErrors() []error

+

Source: binder.go:217

+

BindErrors returns all bind errors and resets/empties binder errors for further calls

+
Example +
+
+ +
+
{
+
+	routeFunc := func(c *echo.Context) error {
+		var opts struct {
+			IDs    []int64
+			Active bool
+		}
+		length := int64(50)
+
+		b := echo.QueryParamsBinder(c)
+
+		errs := b.Int64("length", &length).
+			Int64s("ids", &opts.IDs).
+			Bool("active", &opts.Active).
+			BindErrors()
+		if errs != nil {
+			for _, err := range errs {
+				bErr := err.(*echo.BindingError)
+				log.Printf("in case you want to access what field: %s values: %v failed", bErr.Field, bErr.Values)
+			}
+			return fmt.Errorf("%v fields failed to bind", len(errs))
+		}
+		fmt.Printf("active = %v, length = %v, ids = %v", opts.Active, length, opts.IDs)
+
+		return c.JSON(http.StatusOK, opts)
+	}
+
+	e := echo.New()
+	c := e.NewContext(
+		httptest.NewRequest(http.MethodGet, "/api/endpoint?active=true&length=25&ids=1&ids=2&ids=3", nil),
+		httptest.NewRecorder(),
+	)
+
+	_ = routeFunc(c)
+
+}
+
+

Output:

+
+
+ +
+
active = true, length = 25, ids = [1 2 3]
+
+
+
+
+

func BindUnmarshaler(sourceParam string, dest BindUnmarshaler) *ValueBinder

+

Source: binder.go:313

+

BindUnmarshaler binds parameter to destination implementing BindUnmarshaler interface

+
+
+

func BindWithDelimiter(sourceParam string, dest any, delimiter string) *ValueBinder

+

Source: binder.go:422

+

BindWithDelimiter binds parameter to destination by suitable conversion function. +Delimiter is used before conversion to split parameter value to separate values

+
+
+

func Bool(sourceParam string, dest *bool) *ValueBinder

+

Source: binder.go:917

+

Bool binds parameter to bool variable

+
+
+

func Bools(sourceParam string, dest *[]bool) *ValueBinder

+

Source: binder.go:982

+

Bools binds parameter values to slice of bool variables

+
+
+

func Byte(sourceParam string, dest *byte) *ValueBinder

+

Source: binder.go:729

+

Byte binds parameter to byte variable

+
+
+

func CustomFunc(sourceParam string, customFunc func(values []string) []error) *ValueBinder

+

Source: binder.go:227

+

CustomFunc binds parameter values with Func. Func is called only when parameter values exist.

+
Example +
+
+ +
+
{
+
+	routeFunc := func(c *echo.Context) error {
+		length := int64(50)
+		var binary []byte
+
+		b := echo.QueryParamsBinder(c)
+		errs := b.Int64("length", &length).
+			CustomFunc("base64", func(values []string) []error {
+				if len(values) == 0 {
+					return nil
+				}
+				decoded, err := base64.URLEncoding.DecodeString(values[0])
+				if err != nil {
+
+					return []error{echo.NewBindingError("base64", values[0:1], "failed to decode base64", err)}
+				}
+				binary = decoded
+				return nil
+			}).
+			BindErrors()
+
+		if errs != nil {
+			for _, err := range errs {
+				bErr := err.(*echo.BindingError)
+				log.Printf("in case you want to access what field: %s values: %v failed", bErr.Field, bErr.Values)
+			}
+			return fmt.Errorf("%v fields failed to bind", len(errs))
+		}
+		fmt.Printf("length = %v, base64 = %s", length, binary)
+
+		return c.JSON(http.StatusOK, "ok")
+	}
+
+	e := echo.New()
+	c := e.NewContext(
+		httptest.NewRequest(http.MethodGet, "/api/endpoint?length=25&base64=SGVsbG8gV29ybGQ%3D", nil),
+		httptest.NewRecorder(),
+	)
+	_ = routeFunc(c)
+
+}
+
+

Output:

+
+
+ +
+
length = 25, base64 = Hello World
+
+
+
+
+

func Duration(sourceParam string, dest *time.Duration) *ValueBinder

+

Source: binder.go:1179

+

Duration binds parameter to time.Duration variable

+
+
+

func Durations(sourceParam string, dest *[]time.Duration) *ValueBinder

+

Source: binder.go:1210

+

Durations binds parameter values to slice of time.Duration variables

+
+
+

func FailFast(value bool) *ValueBinder

+

Source: binder.go:193

+

FailFast set internal flag to indicate if binding methods will return early (without binding) when previous bind failed +NB: call this method before any other binding methods as it modifies binding methods behaviour

+
+
+

func Float32(sourceParam string, dest *float32) *ValueBinder

+

Source: binder.go:1002

+

Float32 binds parameter to float32 variable

+
+
+

func Float32s(sourceParam string, dest *[]float32) *ValueBinder

+

Source: binder.go:1097

+

Float32s binds parameter values to slice of float32 variables

+
+
+

func Float64(sourceParam string, dest *float64) *ValueBinder

+

Source: binder.go:992

+

Float64 binds parameter to float64 variable

+
+
+

func Float64s(sourceParam string, dest *[]float64) *ValueBinder

+

Source: binder.go:1087

+

Float64s binds parameter values to slice of float64 variables

+
+
+

func Int(sourceParam string, dest *int) *ValueBinder

+

Source: binder.go:511

+

Int binds parameter to int variable

+
+
+

func Int16(sourceParam string, dest *int16) *ValueBinder

+

Source: binder.go:491

+

Int16 binds parameter to int16 variable

+
+
+

func Int16s(sourceParam string, dest *[]int16) *ValueBinder

+

Source: binder.go:659

+

Int16s binds parameter to slice of int16

+
+
+

func Int32(sourceParam string, dest *int32) *ValueBinder

+

Source: binder.go:481

+

Int32 binds parameter to int32 variable

+
+
+

func Int32s(sourceParam string, dest *[]int32) *ValueBinder

+

Source: binder.go:649

+

Int32s binds parameter to slice of int32

+
+
+

func Int64(sourceParam string, dest *int64) *ValueBinder

+

Source: binder.go:471

+

Int64 binds parameter to int64 variable

+
+
+

func Int64s(sourceParam string, dest *[]int64) *ValueBinder

+

Source: binder.go:639

+

Int64s binds parameter to slice of int64

+
+
+

func Int8(sourceParam string, dest *int8) *ValueBinder

+

Source: binder.go:501

+

Int8 binds parameter to int8 variable

+
+
+

func Int8s(sourceParam string, dest *[]int8) *ValueBinder

+

Source: binder.go:669

+

Int8s binds parameter to slice of int8

+
+
+

func Ints(sourceParam string, dest *[]int) *ValueBinder

+

Source: binder.go:679

+

Ints binds parameter to slice of int

+
+
+

func JSONUnmarshaler(sourceParam string, dest json.Unmarshaler) *ValueBinder

+

Source: binder.go:349

+

JSONUnmarshaler binds parameter to destination implementing json.Unmarshaler interface

+
+
+

func MustBindUnmarshaler(sourceParam string, dest BindUnmarshaler) *ValueBinder

+

Source: binder.go:331

+

MustBindUnmarshaler requires parameter value to exist to bind to destination implementing BindUnmarshaler interface. +Returns error when value does not exist

+
+
+

func MustBindWithDelimiter(sourceParam string, dest any, delimiter string) *ValueBinder

+

Source: binder.go:428

+

MustBindWithDelimiter requires parameter value to exist to bind destination by suitable conversion function. +Delimiter is used before conversion to split parameter value to separate values

+
+
+

func MustBool(sourceParam string, dest *bool) *ValueBinder

+

Source: binder.go:922

+

MustBool requires parameter value to exist to bind to bool variable. Returns error when value does not exist

+
+
+

func MustBools(sourceParam string, dest *[]bool) *ValueBinder

+

Source: binder.go:987

+

MustBools requires parameter values to exist to bind to slice of bool variables. Returns error when values does not exist

+
+
+

func MustByte(sourceParam string, dest *byte) *ValueBinder

+

Source: binder.go:734

+

MustByte requires parameter value to exist to bind to byte variable. Returns error when value does not exist

+
+
+

func MustCustomFunc(sourceParam string, customFunc func(values []string) []error) *ValueBinder

+

Source: binder.go:232

+

MustCustomFunc requires parameter values to exist to bind with Func. Returns error when value does not exist.

+
+
+

func MustDuration(sourceParam string, dest *time.Duration) *ValueBinder

+

Source: binder.go:1184

+

MustDuration requires parameter value to exist to bind to time.Duration variable. Returns error when value does not exist

+
+
+

func MustDurations(sourceParam string, dest *[]time.Duration) *ValueBinder

+

Source: binder.go:1215

+

MustDurations requires parameter values to exist to bind to slice of time.Duration variables. Returns error when values does not exist

+
+
+

func MustFloat32(sourceParam string, dest *float32) *ValueBinder

+

Source: binder.go:1007

+

MustFloat32 requires parameter value to exist to bind to float32 variable. Returns error when value does not exist

+
+
+

func MustFloat32s(sourceParam string, dest *[]float32) *ValueBinder

+

Source: binder.go:1102

+

MustFloat32s requires parameter values to exist to bind to slice of float32 variables. Returns error when values does not exist

+
+
+

func MustFloat64(sourceParam string, dest *float64) *ValueBinder

+

Source: binder.go:997

+

MustFloat64 requires parameter value to exist to bind to float64 variable. Returns error when value does not exist

+
+
+

func MustFloat64s(sourceParam string, dest *[]float64) *ValueBinder

+

Source: binder.go:1092

+

MustFloat64s requires parameter values to exist to bind to slice of float64 variables. Returns error when values does not exist

+
+
+

func MustInt(sourceParam string, dest *int) *ValueBinder

+

Source: binder.go:516

+

MustInt requires parameter value to exist to bind to int variable. Returns error when value does not exist

+
+
+

func MustInt16(sourceParam string, dest *int16) *ValueBinder

+

Source: binder.go:496

+

MustInt16 requires parameter value to exist to bind to int16 variable. Returns error when value does not exist

+
+
+

func MustInt16s(sourceParam string, dest *[]int16) *ValueBinder

+

Source: binder.go:664

+

MustInt16s requires parameter value to exist to bind to int16 slice variable. Returns error when value does not exist

+
+
+

func MustInt32(sourceParam string, dest *int32) *ValueBinder

+

Source: binder.go:486

+

MustInt32 requires parameter value to exist to bind to int32 variable. Returns error when value does not exist

+
+
+

func MustInt32s(sourceParam string, dest *[]int32) *ValueBinder

+

Source: binder.go:654

+

MustInt32s requires parameter value to exist to bind to int32 slice variable. Returns error when value does not exist

+
+
+

func MustInt64(sourceParam string, dest *int64) *ValueBinder

+

Source: binder.go:476

+

MustInt64 requires parameter value to exist to bind to int64 variable. Returns error when value does not exist

+
+
+

func MustInt64s(sourceParam string, dest *[]int64) *ValueBinder

+

Source: binder.go:644

+

MustInt64s requires parameter value to exist to bind to int64 slice variable. Returns error when value does not exist

+
+
+

func MustInt8(sourceParam string, dest *int8) *ValueBinder

+

Source: binder.go:506

+

MustInt8 requires parameter value to exist to bind to int8 variable. Returns error when value does not exist

+
+
+

func MustInt8s(sourceParam string, dest *[]int8) *ValueBinder

+

Source: binder.go:674

+

MustInt8s requires parameter value to exist to bind to int8 slice variable. Returns error when value does not exist

+
+
+

func MustInts(sourceParam string, dest *[]int) *ValueBinder

+

Source: binder.go:684

+

MustInts requires parameter value to exist to bind to int slice variable. Returns error when value does not exist

+
+
+

func MustJSONUnmarshaler(sourceParam string, dest json.Unmarshaler) *ValueBinder

+

Source: binder.go:367

+

MustJSONUnmarshaler requires parameter value to exist to bind to destination implementing json.Unmarshaler interface. +Returns error when value does not exist

+
+
+

func MustString(sourceParam string, dest *string) *ValueBinder

+

Source: binder.go:269

+

MustString requires parameter value to exist to bind to string variable. Returns error when value does not exist

+
+
+

func MustStrings(sourceParam string, dest *[]string) *ValueBinder

+

Source: binder.go:298

+

MustStrings requires parameter values to exist to bind to slice of string variables. Returns error when value does not exist

+
+
+

func MustTextUnmarshaler(sourceParam string, dest encoding.TextUnmarshaler) *ValueBinder

+

Source: binder.go:403

+

MustTextUnmarshaler requires parameter value to exist to bind to destination implementing encoding.TextUnmarshaler interface. +Returns error when value does not exist

+
+
+

func MustTime(sourceParam string, dest *time.Time, layout string) *ValueBinder

+

Source: binder.go:1112

+

MustTime requires parameter value to exist to bind to time.Time variable. Returns error when value does not exist

+
+
+

func MustTimes(sourceParam string, dest *[]time.Time, layout string) *ValueBinder

+

Source: binder.go:1143

+

MustTimes requires parameter values to exist to bind to slice of time.Time variables. Returns error when values does not exist

+
+
+

func MustUint(sourceParam string, dest *uint) *ValueBinder

+

Source: binder.go:744

+

MustUint requires parameter value to exist to bind to uint variable. Returns error when value does not exist

+
+
+

func MustUint16(sourceParam string, dest *uint16) *ValueBinder

+

Source: binder.go:714

+

MustUint16 requires parameter value to exist to bind to uint16 variable. Returns error when value does not exist

+
+
+

func MustUint16s(sourceParam string, dest *[]uint16) *ValueBinder

+

Source: binder.go:892

+

MustUint16s requires parameter value to exist to bind to uint16 slice variable. Returns error when value does not exist

+
+
+

func MustUint32(sourceParam string, dest *uint32) *ValueBinder

+

Source: binder.go:704

+

MustUint32 requires parameter value to exist to bind to uint32 variable. Returns error when value does not exist

+
+
+

func MustUint32s(sourceParam string, dest *[]uint32) *ValueBinder

+

Source: binder.go:882

+

MustUint32s requires parameter value to exist to bind to uint32 slice variable. Returns error when value does not exist

+
+
+

func MustUint64(sourceParam string, dest *uint64) *ValueBinder

+

Source: binder.go:694

+

MustUint64 requires parameter value to exist to bind to uint64 variable. Returns error when value does not exist

+
+
+

func MustUint64s(sourceParam string, dest *[]uint64) *ValueBinder

+

Source: binder.go:872

+

MustUint64s requires parameter value to exist to bind to uint64 slice variable. Returns error when value does not exist

+
+
+

func MustUint8(sourceParam string, dest *uint8) *ValueBinder

+

Source: binder.go:724

+

MustUint8 requires parameter value to exist to bind to uint8 variable. Returns error when value does not exist

+
+
+

func MustUint8s(sourceParam string, dest *[]uint8) *ValueBinder

+

Source: binder.go:902

+

MustUint8s requires parameter value to exist to bind to uint8 slice variable. Returns error when value does not exist

+
+
+

func MustUints(sourceParam string, dest *[]uint) *ValueBinder

+

Source: binder.go:912

+

MustUints requires parameter value to exist to bind to uint slice variable. Returns error when value does not exist

+
+
+

func MustUnixTime(sourceParam string, dest *time.Time) *ValueBinder

+

Source: binder.go:1270

+

MustUnixTime requires parameter value to exist to bind to time.Time variable (in local time corresponding +to the given Unix time). Returns error when value does not exist.

+

Example: 1609180603 bind to 2020-12-28T18:36:43.000000000+00:00

+

Note:

+
    +
  • time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
  • +
+
+
+

func MustUnixTimeMilli(sourceParam string, dest *time.Time) *ValueBinder

+

Source: binder.go:1291

+

MustUnixTimeMilli requires parameter value to exist to bind to time.Time variable (in local time corresponding +to the given Unix time in millisecond precision). Returns error when value does not exist.

+

Example: 1647184410140 bind to 2022-03-13T15:13:30.140000000+00:00

+

Note:

+
    +
  • time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
  • +
+
+
+

func MustUnixTimeNano(sourceParam string, dest *time.Time) *ValueBinder

+

Source: binder.go:1318

+

MustUnixTimeNano requires parameter value to exist to bind to time.Time variable (in local time corresponding +to the given Unix time value in nanosecond precision). Returns error when value does not exist.

+

Example: 1609180603123456789 binds to 2020-12-28T18:36:43.123456789+00:00 +Example: 1000000000 binds to 1970-01-01T00:00:01.000000000+00:00 +Example: 999999999 binds to 1970-01-01T00:00:00.999999999+00:00

+

Note:

+
    +
  • time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
  • +
  • Javascript's Number type only has about 53 bits of precision (Number.MAX_SAFE_INTEGER = 9007199254740991). Compare it to 1609180603123456789 in example.
  • +
+
+
+

func String(sourceParam string, dest *string) *ValueBinder

+

Source: binder.go:255

+

String binds parameter to string variable

+
+
+

func Strings(sourceParam string, dest *[]string) *ValueBinder

+

Source: binder.go:284

+

Strings binds parameter values to slice of string

+
+
+

func TextUnmarshaler(sourceParam string, dest encoding.TextUnmarshaler) *ValueBinder

+

Source: binder.go:385

+

TextUnmarshaler binds parameter to destination implementing encoding.TextUnmarshaler interface

+
+
+

func Time(sourceParam string, dest *time.Time, layout string) *ValueBinder

+

Source: binder.go:1107

+

Time binds parameter to time.Time variable

+
+
+

func Times(sourceParam string, dest *[]time.Time, layout string) *ValueBinder

+

Source: binder.go:1138

+

Times binds parameter values to slice of time.Time variables

+
+
+

func Uint(sourceParam string, dest *uint) *ValueBinder

+

Source: binder.go:739

+

Uint binds parameter to uint variable

+
+
+

func Uint16(sourceParam string, dest *uint16) *ValueBinder

+

Source: binder.go:709

+

Uint16 binds parameter to uint16 variable

+
+
+

func Uint16s(sourceParam string, dest *[]uint16) *ValueBinder

+

Source: binder.go:887

+

Uint16s binds parameter to slice of uint16

+
+
+

func Uint32(sourceParam string, dest *uint32) *ValueBinder

+

Source: binder.go:699

+

Uint32 binds parameter to uint32 variable

+
+
+

func Uint32s(sourceParam string, dest *[]uint32) *ValueBinder

+

Source: binder.go:877

+

Uint32s binds parameter to slice of uint32

+
+
+

func Uint64(sourceParam string, dest *uint64) *ValueBinder

+

Source: binder.go:689

+

Uint64 binds parameter to uint64 variable

+
+
+

func Uint64s(sourceParam string, dest *[]uint64) *ValueBinder

+

Source: binder.go:867

+

Uint64s binds parameter to slice of uint64

+
+
+

func Uint8(sourceParam string, dest *uint8) *ValueBinder

+

Source: binder.go:719

+

Uint8 binds parameter to uint8 variable

+
+
+

func Uint8s(sourceParam string, dest *[]uint8) *ValueBinder

+

Source: binder.go:897

+

Uint8s binds parameter to slice of uint8

+
+
+

func Uints(sourceParam string, dest *[]uint) *ValueBinder

+

Source: binder.go:907

+

Uints binds parameter to slice of uint

+
+
+

func UnixTime(sourceParam string, dest *time.Time) *ValueBinder

+

Source: binder.go:1259

+

UnixTime binds parameter to time.Time variable (in local Time corresponding to the given Unix time).

+

Example: 1609180603 bind to 2020-12-28T18:36:43.000000000+00:00

+

Note:

+
    +
  • time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
  • +
+
+
+

func UnixTimeMilli(sourceParam string, dest *time.Time) *ValueBinder

+

Source: binder.go:1280

+

UnixTimeMilli binds parameter to time.Time variable (in local time corresponding to the given Unix time in millisecond precision).

+

Example: 1647184410140 bind to 2022-03-13T15:13:30.140000000+00:00

+

Note:

+
    +
  • time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
  • +
+
+
+

func UnixTimeNano(sourceParam string, dest *time.Time) *ValueBinder

+

Source: binder.go:1304

+

UnixTimeNano binds parameter to time.Time variable (in local time corresponding to the given Unix time in nanosecond precision).

+

Example: 1609180603123456789 binds to 2020-12-28T18:36:43.123456789+00:00 +Example: 1000000000 binds to 1970-01-01T00:00:01.000000000+00:00 +Example: 999999999 binds to 1970-01-01T00:00:00.999999999+00:00

+

Note:

+
    +
  • time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
  • +
  • Javascript's Number type only has about 53 bits of precision (Number.MAX_SAFE_INTEGER = 9007199254740991). Compare it to 1609180603123456789 in example.
  • +
+
+
\ No newline at end of file diff --git a/docs/api-reference/api-reference/pkg-echotest.html b/docs/api-reference/api-reference/pkg-echotest.html new file mode 100644 index 000000000..d47d7e140 --- /dev/null +++ b/docs/api-reference/api-reference/pkg-echotest.html @@ -0,0 +1,143 @@ + +echotest - Echo API Reference
Echotest

echotest

github.com/labstack/echo/v5/echotest

import "github.com/labstack/echo/v5/echotest"

+ +

Functions

+
+

func LoadBytes(t *testing.T, name string, opts ...loadBytesOpts) []byte

+

Source: echotest/reader.go:26

+

LoadBytes is helper to load file contents relative to current (where test file is) package +directory.

+
+
+

func TrimNewlineEnd(bytes []byte) []byte

+

Source: echotest/reader.go:16

+

TrimNewlineEnd instructs LoadBytes to remove \n from the end of loaded file.

+
+

Types

+
+

type ContextConfig

+

Source: echotest/context.go:20

+

ContextConfig is configuration for creating echo.Context for testing purposes.

+
+
+ +
+
type ContextConfig struct {
+	// Request will be used instead of default `httptest.NewRequest(http.MethodGet, "/", nil)`
+	Request *http.Request
+
+	// Response will be used instead of default `httptest.NewRecorder()`
+	Response *httptest.ResponseRecorder
+
+	// QueryValues will be set as Request.URL.RawQuery value
+	QueryValues url.Values
+
+	// Headers will be set as Request.Header value
+	Headers http.Header
+
+	// PathValues initializes context.PathValues with given value.
+	PathValues echo.PathValues
+
+	// RouteInfo initializes context.RouteInfo() with given value
+	RouteInfo *echo.RouteInfo
+
+	// FormValues creates form-urlencoded form out of given values. If there is no
+	// `content-type` header it will be set to `application/x-www-form-urlencoded`
+	// In case Request was not set the Request.Method is set to `POST`
+	//
+	// FormValues, MultipartForm and JSONBody are mutually exclusive.
+	FormValues url.Values
+
+	// MultipartForm creates multipart form out of given value. If there is no
+	// `content-type` header it will be set to `multipart/form-data`
+	// In case Request was not set the Request.Method is set to `POST`
+	//
+	// FormValues, MultipartForm and JSONBody are mutually exclusive.
+	MultipartForm *MultipartForm
+
+	// JSONBody creates JSON body out of given bytes. If there is no
+	// `content-type` header it will be set to `application/json`
+	// In case Request was not set the Request.Method is set to `POST`
+	//
+	// FormValues, MultipartForm and JSONBody are mutually exclusive.
+	JSONBody []byte
+}
+
+
Fields
  • Request *http.Request

    Request will be used instead of default httptest.NewRequest(http.MethodGet, "/", nil)

  • Response *httptest.ResponseRecorder

    Response will be used instead of default httptest.NewRecorder()

  • QueryValues url.Values

    QueryValues will be set as Request.URL.RawQuery value

  • Headers http.Header

    Headers will be set as Request.Header value

  • PathValues echo.PathValues

    PathValues initializes context.PathValues with given value.

  • RouteInfo *echo.RouteInfo

    RouteInfo initializes context.RouteInfo() with given value

  • FormValues url.Values

    FormValues creates form-urlencoded form out of given values. If there is no +content-type header it will be set to application/x-www-form-urlencoded +In case Request was not set the Request.Method is set to POST

    +

    FormValues, MultipartForm and JSONBody are mutually exclusive.

  • MultipartForm *MultipartForm

    MultipartForm creates multipart form out of given value. If there is no +content-type header it will be set to multipart/form-data +In case Request was not set the Request.Method is set to POST

    +

    FormValues, MultipartForm and JSONBody are mutually exclusive.

  • JSONBody []byte

    JSONBody creates JSON body out of given bytes. If there is no +content-type header it will be set to application/json +In case Request was not set the Request.Method is set to POST

    +

    FormValues, MultipartForm and JSONBody are mutually exclusive.

+
+

func ServeWithHandler(t *testing.T, handler echo.HandlerFunc, opts ...any) *httptest.ResponseRecorder

+

Source: echotest/context.go:167

+

ServeWithHandler serves ContextConfig with given handler and returns httptest.ResponseRecorder for response checking

+
+
+

func ToContext(t *testing.T) *echo.Context

+

Source: echotest/context.go:75

+

ToContext converts ContextConfig to echo.Context

+
+
+

func ToContextRecorder(t *testing.T) (*echo.Context, *httptest.ResponseRecorder)

+

Source: echotest/context.go:81

+

ToContextRecorder converts ContextConfig to echo.Context and httptest.ResponseRecorder

+
+
+
+

type MultipartForm

+

Source: echotest/context.go:62

+

MultipartForm is used to create multipart form out of given value

+
+
+ +
+
type MultipartForm struct {
+	Fields map[string]string
+	Files  []MultipartFormFile
+}
+
+
Fields
  • Fields map[string]string
  • Files []MultipartFormFile
+
+
+

type MultipartFormFile

+

Source: echotest/context.go:68

+

MultipartFormFile is used to create file in multipart form out of given value

+
+
+ +
+
type MultipartFormFile struct {
+	Fieldname string
+	Filename  string
+	Content   []byte
+}
+
+
Fields
  • Fieldname string
  • Filename string
  • Content []byte
+
\ No newline at end of file diff --git a/docs/api-reference/api-reference/pkg-middleware.html b/docs/api-reference/api-reference/pkg-middleware.html new file mode 100644 index 000000000..42d2c7928 --- /dev/null +++ b/docs/api-reference/api-reference/pkg-middleware.html @@ -0,0 +1,2434 @@ + +middleware - Echo API Reference
Middleware

middleware

github.com/labstack/echo/v5/middleware

import "github.com/labstack/echo/v5/middleware"

+ +

Constants

+

Rate limit response headers set by stores that implement RateLimiterStoreContext.

Source: middleware/rate_limiter.go:20

+
+ +
+
const (
+	HeaderXRateLimitLimit     = "X-RateLimit-Limit"
+	HeaderXRateLimitRemaining = "X-RateLimit-Remaining"
+)
+
+ +

Source: middleware/util.go:19

+
+ +
+
const (
+
+	// KB is 1 KiloByte = 1024 bytes
+	KB
+	// MB is 1 Megabyte = 1_048_576 bytes
+	MB
+	// GB is 1 Gigabyte = 1_073_741_824 bytes
+	GB
+	// TB is 1 Terabyte = 1_099_511_627_776 bytes
+	TB
+	// PB is 1 Petabyte = 1_125_899_906_842_624 bytes
+	PB
+	// EB is 1 Exabyte = 1_152_921_504_606_847_000 bytes
+	EB
+)
+
+ + + + + +

CSRFUsingSecFetchSite is a context key for CSRF middleware what is set when the client browser is using Sec-Fetch-Site +header and the request is deemed safe. +It is a dummy token value that can be used to render CSRF token for form by handlers.

+

We know that the client is using a browser that supports Sec-Fetch-Site header, so when the form is submitted in +the future with this dummy token value it is OK. Although the request is safe, the template rendered by the +handler may need this value to render CSRF token for form.

Source: middleware/csrf.go:23

+
+ +
+
const CSRFUsingSecFetchSite = "_echo_csrf_using_sec_fetch_site_"
+
+

GZIPEncoding content-encoding header if set to "gzip", decompress body contents.

Source: middleware/decompress.go:32

+
+ +
+
const GZIPEncoding string = "gzip"
+
+

StatusCodeContextCanceled is a custom HTTP status code for situations +where a client unexpectedly closed the connection to the server. +As there is no standard error code for "client closed connection", but +various well-known HTTP clients and server implement this HTTP code we use +499 too instead of the more problematic 5xx, which does not allow to detect this situation

Source: middleware/proxy.go:420

+
+ +
+
const StatusCodeContextCanceled = 499
+
+

Source: middleware/extractor.go:25

+
+ +
+
const (
+	// ExtractorSourceHeader means value was extracted from request header
+	ExtractorSourceHeader ExtractorSource = "header"
+	// ExtractorSourceQuery means value was extracted from request query parameters
+	ExtractorSourceQuery ExtractorSource = "query"
+	// ExtractorSourcePathParam means value was extracted from route path parameters
+	ExtractorSourcePathParam ExtractorSource = "param"
+	// ExtractorSourceCookie means value was extracted from request cookies
+	ExtractorSourceCookie ExtractorSource = "cookie"
+	// ExtractorSourceForm means value was extracted from request form values
+	ExtractorSourceForm ExtractorSource = "form"
+)
+
+ + + + +

Variables

+

DefaultCSRFConfig is the default CSRF middleware config.

Source: middleware/csrf.go:104

+
+ +
+
var DefaultCSRFConfig = CSRFConfig{
+	Skipper:        DefaultSkipper,
+	TokenLength:    32,
+	TokenLookup:    "header:" + echo.HeaderXCSRFToken,
+	ContextKey:     "csrf",
+	CookieName:     "_csrf",
+	CookieMaxAge:   86400,
+	CookieSameSite: http.SameSiteDefaultMode,
+}
+
+

DefaultKeyAuthConfig is the default KeyAuth middleware config.

Source: middleware/key_auth.go:112

+
+ +
+
var DefaultKeyAuthConfig = KeyAuthConfig{
+	Skipper:   DefaultSkipper,
+	KeyLookup: "header:" + echo.HeaderAuthorization + ":Bearer ",
+}
+
+

DefaultMethodOverrideConfig is the default MethodOverride middleware config.

Source: middleware/method_override.go:26

+
+ +
+
var DefaultMethodOverrideConfig = MethodOverrideConfig{
+	Skipper: DefaultSkipper,
+	Getter:  MethodFromHeader(echo.HeaderXHTTPMethodOverride),
+}
+
+

DefaultProxyConfig is the default Proxy middleware config.

Source: middleware/proxy.go:125

+
+ +
+
var DefaultProxyConfig = ProxyConfig{
+	Skipper:    DefaultSkipper,
+	ContextKey: "target",
+}
+
+

DefaultRateLimiterConfig defines default values for RateLimiterConfig

Source: middleware/rate_limiter.go:61

+
+ +
+
var DefaultRateLimiterConfig = RateLimiterConfig{
+	Skipper: DefaultSkipper,
+	IdentifierExtractor: func(ctx *echo.Context) (string, error) {
+		id := ctx.RealIP()
+		return id, nil
+	},
+	ErrorHandler: func(c *echo.Context, err error) error {
+		return ErrExtractorError.Wrap(err)
+	},
+	DenyHandler: func(c *echo.Context, identifier string, err error) error {
+		return ErrRateLimitExceeded.Wrap(err)
+	},
+}
+
+

DefaultRateLimiterMemoryStoreConfig provides default configuration values for RateLimiterMemoryStore

Source: middleware/rate_limiter.go:251

+
+ +
+
var DefaultRateLimiterMemoryStoreConfig = RateLimiterMemoryStoreConfig{
+	ExpiresIn: 3 * time.Minute,
+}
+
+

DefaultRecoverConfig is the default Recover middleware config.

Source: middleware/recover.go:34

+
+ +
+
var DefaultRecoverConfig = RecoverConfig{
+	Skipper:           DefaultSkipper,
+	StackSize:         4 << 10,
+	DisableStackAll:   false,
+	DisablePrintStack: false,
+}
+
+

DefaultSecureConfig is the default Secure middleware config.

Source: middleware/secure.go:79

+
+ +
+
var DefaultSecureConfig = SecureConfig{
+	Skipper:            DefaultSkipper,
+	XSSProtection:      "1; mode=block",
+	ContentTypeNosniff: "nosniff",
+	XFrameOptions:      "SAMEORIGIN",
+	HSTSPreloadEnabled: false,
+}
+
+

DefaultStaticConfig is the default Static middleware config.

Source: middleware/static.go:159

+
+ +
+
var DefaultStaticConfig = StaticConfig{
+	Skipper: DefaultSkipper,
+	Index:   "index.html",
+}
+
+

ErrCSRFInvalid is returned when CSRF check fails

Source: middleware/csrf.go:101

+
+ +
+
var ErrCSRFInvalid = &echo.HTTPError{Code: http.StatusForbidden, Message: "invalid csrf token"}
+
+

ErrExtractorError denotes an error raised when extractor function is unsuccessful

Source: middleware/rate_limiter.go:58

+
+ +
+
var ErrExtractorError = echo.NewHTTPError(http.StatusForbidden, "error while extracting identifier")
+
+

ErrInvalidKey denotes an error raised when key value is invalid by validator

Source: middleware/key_auth.go:109

+
+ +
+
var ErrInvalidKey = echo.NewHTTPError(http.StatusUnauthorized, "invalid key")
+
+

ErrKeyMissing denotes an error raised when key value could not be extracted from request

Source: middleware/key_auth.go:106

+
+ +
+
var ErrKeyMissing = echo.NewHTTPError(http.StatusUnauthorized, "missing key")
+
+

ErrRateLimitExceeded denotes an error raised when rate limit is exceeded

Source: middleware/rate_limiter.go:55

+
+ +
+
var ErrRateLimitExceeded = echo.NewHTTPError(http.StatusTooManyRequests, "rate limit exceeded")
+
+

RedirectHTTPSConfig is the HTTPS Redirect middleware config.

Source: middleware/redirect.go:34

+
+ +
+
var RedirectHTTPSConfig = RedirectConfig{/* contains filtered or unexported fields */}
+
+

RedirectHTTPSWWWConfig is the HTTPS WWW Redirect middleware config.

Source: middleware/redirect.go:37

+
+ +
+
var RedirectHTTPSWWWConfig = RedirectConfig{/* contains filtered or unexported fields */}
+
+

RedirectNonHTTPSWWWConfig is the non HTTPS WWW Redirect middleware config.

Source: middleware/redirect.go:40

+
+ +
+
var RedirectNonHTTPSWWWConfig = RedirectConfig{/* contains filtered or unexported fields */}
+
+

RedirectNonWWWConfig is the non WWW Redirect middleware config.

Source: middleware/redirect.go:46

+
+ +
+
var RedirectNonWWWConfig = RedirectConfig{/* contains filtered or unexported fields */}
+
+

RedirectWWWConfig is the WWW Redirect middleware config.

Source: middleware/redirect.go:43

+
+ +
+
var RedirectWWWConfig = RedirectConfig{/* contains filtered or unexported fields */}
+
+

Functions

+
+

func AddTrailingSlash() echo.MiddlewareFunc

+

Source: middleware/slash.go:29

+

AddTrailingSlash returns a root level (before router) middleware which adds a +trailing slash to the request URL#Path.

+

Usage Echo#Pre(AddTrailingSlash())

+
+
+

func AddTrailingSlashWithConfig(config AddTrailingSlashConfig) echo.MiddlewareFunc

+

Source: middleware/slash.go:34

+

AddTrailingSlashWithConfig returns an AddTrailingSlash middleware with config or panics on invalid configuration.

+
+
+

func BasicAuth(fn BasicAuthValidator) echo.MiddlewareFunc

+

Source: middleware/basic_auth.go:87

+

BasicAuth returns an BasicAuth middleware.

+

For valid credentials it calls the next handler. +For missing or invalid credentials, it sends "401 - Unauthorized" response.

+
+
+

func BasicAuthWithConfig(config BasicAuthConfig) echo.MiddlewareFunc

+

Source: middleware/basic_auth.go:92

+

BasicAuthWithConfig returns an BasicAuthWithConfig middleware with config.

+
+
+

func BodyDump(handler BodyDumpHandler) echo.MiddlewareFunc

+

Source: middleware/body_dump.go:58

+

BodyDump returns a BodyDump middleware.

+

BodyDump middleware captures the request and response payload and calls the +registered handler.

+

SECURITY: By default, this limits dumped bodies to 5MB to prevent memory exhaustion +attacks. To customize limits, use BodyDumpWithConfig. To disable limits (not recommended +in production), explicitly set MaxRequestBytes and MaxResponseBytes to -1.

+
+
+

func BodyDumpWithConfig(config BodyDumpConfig) echo.MiddlewareFunc

+

Source: middleware/body_dump.go:68

+

BodyDumpWithConfig returns a BodyDump middleware with config. +See: BodyDump().

+

SECURITY: If MaxRequestBytes and MaxResponseBytes are not set (zero values), they default +to 5MB each to prevent DoS attacks via large payloads. Set them explicitly to -1 to disable +limits if needed for your use case.

+
+
+

func BodyLimit(limitBytes int64) echo.MiddlewareFunc

+

Source: middleware/body_limit.go:34

+

BodyLimit returns a BodyLimit middleware.

+

BodyLimit middleware sets the maximum allowed size for a request body, if the size exceeds the configured limit, it +sends "413 - Request Entity Too Large" response. The BodyLimit is determined based on both Content-Length request +header and actual content read, which makes it super secure.

+
+
+

func BodyLimitWithConfig(config BodyLimitConfig) echo.MiddlewareFunc

+

Source: middleware/body_limit.go:42

+

BodyLimitWithConfig returns a BodyLimitWithConfig middleware. Middleware sets the maximum allowed size in bytes for +a request body, if the size exceeds the configured limit, it sends "413 - Request Entity Too Large" response. +The BodyLimitWithConfig is determined based on both Content-Length request header and actual content read, which +makes it super secure.

+
+
+

func CORS(allowOrigins ...string) echo.MiddlewareFunc

+

Source: middleware/cors.go:137

+

CORS returns a Cross-Origin Resource Sharing (CORS) middleware. +See also MDN: Cross-Origin Resource Sharing (CORS).

+

Origin consist of following parts: scheme + "://" + host + optional ":" + port +Wildcard * can be used, but has to be set explicitly. +Example: https://example.com, http://example.com:8080, *

+

Security: Poorly configured CORS can compromise security because it allows +relaxation of the browser's Same-Origin policy. See Exploiting CORS +misconfigurations for Bitcoins and bounties and Portswigger: Cross-origin +resource sharing (CORS) for more details.

+

Duplicate CORS headers can appear in a chained-proxy setup where this +middleware runs on more than one layer and a reverse proxy copies an +upstream's CORS headers on top of the ones set here. Prefer enabling CORS +only at the edge; if a proxied upstream sets its own CORS headers, strip them +before they are copied (e.g. httputil.ReverseProxy.ModifyResponse).

+
+
+

func CORSWithConfig(config CORSConfig) echo.MiddlewareFunc

+

Source: middleware/cors.go:146

+

CORSWithConfig returns a CORS middleware with config or panics on invalid configuration. +See: [CORS].

+
+
+

func CSRF() echo.MiddlewareFunc

+

Source: middleware/csrf.go:116

+

CSRF returns a Cross-Site Request Forgery (CSRF) middleware. +See: https://en.wikipedia.org/wiki/Cross-site_request_forgery

+
+
+

func CSRFWithConfig(config CSRFConfig) echo.MiddlewareFunc

+

Source: middleware/csrf.go:121

+

CSRFWithConfig returns a CSRF middleware with config or panics on invalid configuration.

+
+
+

func ContextTimeout(timeout time.Duration) echo.MiddlewareFunc

+

Source: middleware/context_timeout.go:28

+

ContextTimeout returns a middleware which returns error (503 Service Unavailable error) to client +when underlying method returns context.DeadlineExceeded error.

+
+
+

func ContextTimeoutWithConfig(config ContextTimeoutConfig) echo.MiddlewareFunc

+

Source: middleware/context_timeout.go:33

+

ContextTimeoutWithConfig returns a Timeout middleware with config.

+
+
+

func CreateExtractors(lookups string, limit uint) ([]ValuesExtractor, error)

+

Source: middleware/extractor.go:74

+

CreateExtractors creates ValuesExtractors from given lookups. +lookups is a string in the form of ":" or ":,:" that is used +to extract key from the request. +Possible values:

+
    +
  • "header:" or "header::" +<cut-prefix> is argument value to cut/trim prefix of the extracted value. This is useful if header +value has static prefix like Authorization: <auth-scheme> <authorisation-parameters> where part that we +want to cut is <auth-scheme> note the space at the end. +In case of basic authentication Authorization: Basic <credentials> prefix we want to remove is Basic .
  • +
  • "query:"
  • +
  • "param:"
  • +
  • "form:"
  • +
  • "cookie:"
  • +
+

Multiple sources example:

+
    +
  • "header:Authorization,header:X-Api-Key"
  • +
+

limit sets the maximum amount how many lookups can be returned.

+
+
+

func Decompress() echo.MiddlewareFunc

+

Source: middleware/decompress.go:52

+

Decompress decompresses request body based if content encoding type is set to "gzip" with default config

+

SECURITY: By default, this limits decompressed data to 100MB to prevent zip bomb attacks. +To customize the limit, use DecompressWithConfig. To disable limits (not recommended in production), +set MaxDecompressedSize to -1.

+
+
+

func DecompressWithConfig(config DecompressConfig) echo.MiddlewareFunc

+

Source: middleware/decompress.go:60

+

DecompressWithConfig returns a decompress middleware with config or panics on invalid configuration.

+

SECURITY: If MaxDecompressedSize is not set (zero value), it defaults to 100MB to prevent +DoS attacks via zip bombs. Set to -1 to explicitly disable limits if needed for your use case.

+
+
+

func DefaultSkipper(c *echo.Context) bool

+

Source: middleware/middleware.go:87

+

DefaultSkipper returns false which processes the middleware.

+
+
+

func Gzip() echo.MiddlewareFunc

+

Source: middleware/compress.go:59

+

Gzip returns a middleware which compresses HTTP response using gzip compression scheme.

+
+
+

func GzipWithConfig(config GzipConfig) echo.MiddlewareFunc

+

Source: middleware/compress.go:64

+

GzipWithConfig returns a middleware which compresses HTTP response using gzip compression scheme.

+
+
+

func HTTPSNonWWWRedirect() echo.MiddlewareFunc

+

Source: middleware/redirect.go:80

+

HTTPSNonWWWRedirect redirects http requests to https non www. +For example, http://www.labstack.com will be redirect to https://labstack.com.

+

Usage Echo#Pre(HTTPSNonWWWRedirect())

+
+
+

func HTTPSNonWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc

+

Source: middleware/redirect.go:85

+

HTTPSNonWWWRedirectWithConfig returns a HTTPS Non-WWW redirect middleware with config or panics on invalid configuration.

+
+
+

func HTTPSRedirect() echo.MiddlewareFunc

+

Source: middleware/redirect.go:52

+

HTTPSRedirect redirects http requests to https. +For example, http://labstack.com will be redirect to https://labstack.com.

+

Usage Echo#Pre(HTTPSRedirect())

+
+
+

func HTTPSRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc

+

Source: middleware/redirect.go:57

+

HTTPSRedirectWithConfig returns a HTTPS redirect middleware with config or panics on invalid configuration.

+
+
+

func HTTPSWWWRedirect() echo.MiddlewareFunc

+

Source: middleware/redirect.go:66

+

HTTPSWWWRedirect redirects http requests to https www. +For example, http://labstack.com will be redirect to https://www.labstack.com.

+

Usage Echo#Pre(HTTPSWWWRedirect())

+
+
+

func HTTPSWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc

+

Source: middleware/redirect.go:71

+

HTTPSWWWRedirectWithConfig returns a HTTPS WWW redirect middleware with config or panics on invalid configuration.

+
+
+

func KeyAuth(fn KeyAuthValidator) echo.MiddlewareFunc

+

Source: middleware/key_auth.go:122

+

KeyAuth returns an KeyAuth middleware.

+

For valid key it calls the next handler. +For invalid key, it sends "401 - Unauthorized" response. +For missing key, it sends "400 - Bad Request" response.

+
+
+

func KeyAuthWithConfig(config KeyAuthConfig) echo.MiddlewareFunc

+

Source: middleware/key_auth.go:133

+

KeyAuthWithConfig returns an KeyAuth middleware or panics if configuration is invalid.

+

For first valid key it calls the next handler. +For invalid key, it sends "401 - Unauthorized" response. +For missing key, it sends "400 - Bad Request" response.

+
+
+

func MethodFromForm(param string) MethodOverrideGetter

+

Source: middleware/method_override.go:83

+

MethodFromForm is a MethodOverrideGetter that gets overridden method from the +form parameter.

+
+
+

func MethodFromHeader(header string) MethodOverrideGetter

+

Source: middleware/method_override.go:75

+

MethodFromHeader is a MethodOverrideGetter that gets overridden method from +the request header.

+
+
+

func MethodFromQuery(param string) MethodOverrideGetter

+

Source: middleware/method_override.go:91

+

MethodFromQuery is a MethodOverrideGetter that gets overridden method from +the query parameter.

+
+
+

func MethodOverride() echo.MiddlewareFunc

+

Source: middleware/method_override.go:36

+

MethodOverride returns a MethodOverride middleware. +MethodOverride middleware checks for the overridden method from the request and +uses it instead of the original method.

+

For security reasons, only POST method can be overridden.

+
+
+

func MethodOverrideWithConfig(config MethodOverrideConfig) echo.MiddlewareFunc

+

Source: middleware/method_override.go:41

+

MethodOverrideWithConfig returns a Method Override middleware with config or panics on invalid configuration.

+
+
+

func NewRandomBalancer(targets []*ProxyTarget) ProxyBalancer

+

Source: middleware/proxy.go:189

+

NewRandomBalancer returns a random proxy balancer.

+
+
+

func NewRateLimiterMemoryStore(rateLimit float64) (store *RateLimiterMemoryStore)

+

Source: middleware/rate_limiter.go:200

+

NewRateLimiterMemoryStore returns an instance of RateLimiterMemoryStore with +the provided rate (as req/s). +for more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit.

+

Burst and ExpiresIn will be set to default values.

+

Note that if the provided rate is a float number and Burst is zero, Burst will be treated as the rounded up value of the rate.

+

Example (with 20 requests/sec):

+
+
+ +
+
limiterStore := middleware.NewRateLimiterMemoryStore(20)
+
+
+
+

func NewRateLimiterMemoryStoreWithConfig(config RateLimiterMemoryStoreConfig) (store *RateLimiterMemoryStore)

+

Source: middleware/rate_limiter.go:225

+

NewRateLimiterMemoryStoreWithConfig returns an instance of RateLimiterMemoryStore +with the provided configuration. Rate must be provided. Burst will be set to the rounded up value of +the configured rate if not provided or set to 0.

+

The built-in memory store is usually capable for modest loads. For higher loads other +store implementations should be considered.

+

Characteristics:

+
    +
  • Concurrency above 100 parallel requests may causes measurable lock contention
  • +
  • A high number of different IP addresses (above 16000) may be impacted by the internally used Go map
  • +
  • A high number of requests from a single IP address may cause lock contention
  • +
+

Example:

+
+
+ +
+
limiterStore := middleware.NewRateLimiterMemoryStoreWithConfig(
+	middleware.RateLimiterMemoryStoreConfig{Rate: 50, Burst: 200, ExpiresIn: 5 * time.Minute},
+)
+
+
+
+

func NewRoundRobinBalancer(targets []*ProxyTarget) ProxyBalancer

+

Source: middleware/proxy.go:199

+

NewRoundRobinBalancer returns a round-robin proxy balancer.

+
+
+

func NonWWWRedirect() echo.MiddlewareFunc

+

Source: middleware/redirect.go:108

+

NonWWWRedirect redirects www requests to non www. +For example, http://www.labstack.com will be redirect to http://labstack.com.

+

Usage Echo#Pre(NonWWWRedirect())

+
+
+

func NonWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc

+

Source: middleware/redirect.go:113

+

NonWWWRedirectWithConfig returns a Non-WWW redirect middleware with config or panics on invalid configuration.

+
+
+

func Proxy(balancer ProxyBalancer) echo.MiddlewareFunc

+

Source: middleware/proxy.go:292

+

Proxy returns a Proxy middleware.

+

Proxy middleware forwards the request to upstream server using a configured load balancing technique.

+
+
+

func ProxyWithConfig(config ProxyConfig) echo.MiddlewareFunc

+

Source: middleware/proxy.go:301

+

ProxyWithConfig returns a Proxy middleware or panics if configuration is invalid.

+

Proxy middleware forwards the request to upstream server using a configured load balancing technique.

+
+
+

func RateLimiter(store RateLimiterStore) echo.MiddlewareFunc

+

Source: middleware/rate_limiter.go:86

+

RateLimiter returns a rate limiting middleware

+
+
+ +
+
e := echo.New()
+
+limiterStore := middleware.NewRateLimiterMemoryStore(20)
+
+e.GET("/rate-limited", func(c *echo.Context) error {
+	return c.String(http.StatusOK, "test")
+}, RateLimiter(limiterStore))
+
+
+
+

func RateLimiterWithConfig(config RateLimiterConfig) echo.MiddlewareFunc

+

Source: middleware/rate_limiter.go:119

+

RateLimiterWithConfig returns a rate limiting middleware

+
+
+ +
+
e := echo.New()
+
+config := middleware.RateLimiterConfig{
+	Skipper: DefaultSkipper,
+	Store: middleware.NewRateLimiterMemoryStore(
+		middleware.RateLimiterMemoryStoreConfig{Rate: 10, Burst: 30, ExpiresIn: 3 * time.Minute}
+	)
+	IdentifierExtractor: func(ctx *echo.Context) (string, error) {
+		id := ctx.RealIP()
+		return id, nil
+	},
+	ErrorHandler: func(ctx *echo.Context, err error) error {
+		return context.JSON(http.StatusTooManyRequests, nil)
+	},
+	DenyHandler: func(ctx *echo.Context, identifier string, err error) error {
+		return context.JSON(http.StatusForbidden, nil)
+	},
+}
+
+e.GET("/rate-limited", func(c *echo.Context) error {
+	return c.String(http.StatusOK, "test")
+}, middleware.RateLimiterWithConfig(config))
+
+
+
+

func Recover() echo.MiddlewareFunc

+

Source: middleware/recover.go:43

+

Recover returns a middleware which recovers from panics anywhere in the chain +and handles the control to the centralized HTTPErrorHandler.

+
+
+

func RecoverWithConfig(config RecoverConfig) echo.MiddlewareFunc

+

Source: middleware/recover.go:48

+

RecoverWithConfig returns a Recovery middleware with config or panics on invalid configuration.

+
+
+

func RemoveTrailingSlash() echo.MiddlewareFunc

+

Source: middleware/slash.go:93

+

RemoveTrailingSlash returns a root level (before router) middleware which removes +a trailing slash from the request URI.

+

Usage Echo#Pre(RemoveTrailingSlash())

+
+
+

func RemoveTrailingSlashWithConfig(config RemoveTrailingSlashConfig) echo.MiddlewareFunc

+

Source: middleware/slash.go:98

+

RemoveTrailingSlashWithConfig returns a RemoveTrailingSlash middleware with config or panics on invalid configuration.

+
+
+

func RequestID() echo.MiddlewareFunc

+

Source: middleware/request_id.go:30

+

RequestID returns a middleware that reads RequestIDConfig.TargetHeader (X-Request-ID) header value or when +the header value is empty, generates that value and sets request ID to response +as RequestIDConfig.TargetHeader (X-Request-Id) value.

+
+
+

func RequestIDWithConfig(config RequestIDConfig) echo.MiddlewareFunc

+

Source: middleware/request_id.go:37

+

RequestIDWithConfig returns a middleware with given valid config or panics on invalid configuration. +The middleware reads RequestIDConfig.TargetHeader (X-Request-ID) header value or when the header value is empty, +generates that value and sets request ID to response as RequestIDConfig.TargetHeader (X-Request-Id) value.

+
+
+

func RequestLogger() echo.MiddlewareFunc

+

Source: middleware/request_logger.go:395

+

RequestLogger creates Request Logger middleware with Echo default settings that uses Context.Logger() as logger.

+
+
+

func RequestLoggerWithConfig(config RequestLoggerConfig) echo.MiddlewareFunc

+

Source: middleware/request_logger.go:237

+

RequestLoggerWithConfig returns a RequestLogger middleware with config.

+
+
+

func Rewrite(rules map[string]string) echo.MiddlewareFunc

+

Source: middleware/rewrite.go:40

+

Rewrite returns a Rewrite middleware.

+

Rewrite middleware rewrites the URL path based on the provided rules.

+
+
+

func RewriteWithConfig(config RewriteConfig) echo.MiddlewareFunc

+

Source: middleware/rewrite.go:49

+

RewriteWithConfig returns a Rewrite middleware or panics on invalid configuration.

+

Rewrite middleware rewrites the URL path based on the provided rules.

+
+
+

func Secure() echo.MiddlewareFunc

+

Source: middleware/secure.go:91

+

Secure returns a Secure middleware. +Secure middleware provides protection against cross-site scripting (XSS) attack, +content type sniffing, clickjacking, insecure connection and other code injection +attacks.

+
+
+

func SecureWithConfig(config SecureConfig) echo.MiddlewareFunc

+

Source: middleware/secure.go:96

+

SecureWithConfig returns a Secure middleware with config or panics on invalid configuration.

+
+
+

func Static(root string) echo.MiddlewareFunc

+

Source: middleware/static.go:165

+

Static returns a Static middleware to serves static content from the provided root directory.

+
+
+

func StaticWithConfig(config StaticConfig) echo.MiddlewareFunc

+

Source: middleware/static.go:172

+

StaticWithConfig returns a Static middleware to serves static content or panics on invalid configuration.

+
+
+

func WWWRedirect() echo.MiddlewareFunc

+

Source: middleware/redirect.go:94

+

WWWRedirect redirects non www requests to www. +For example, http://labstack.com will be redirect to http://www.labstack.com.

+

Usage Echo#Pre(WWWRedirect())

+
+
+

func WWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc

+

Source: middleware/redirect.go:99

+

WWWRedirectWithConfig returns a WWW redirect middleware with config or panics on invalid configuration.

+
+

Types

+
+

type AddTrailingSlashConfig

+

Source: middleware/slash.go:15

+

AddTrailingSlashConfig is the middleware config for adding trailing slash to the request.

+
+
+ +
+
type AddTrailingSlashConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// Status code to be used when redirecting the request.
+	// Optional, but when provided the request is redirected using this code.
+	// Valid status codes: [300...308]
+	RedirectCode int
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • RedirectCode int

    Status code to be used when redirecting the request. +Optional, but when provided the request is redirected using this code. +Valid status codes: [300...308]

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/slash.go:39

+

ToMiddleware converts AddTrailingSlashConfig to middleware or returns an error for invalid configuration

+
+
+
+

type BasicAuthConfig

+

Source: middleware/basic_auth.go:21

+

BasicAuthConfig defines the config for BasicAuthWithConfig middleware.

+

SECURITY: The Validator function is responsible for securely comparing credentials. +See BasicAuthValidator documentation for guidance on preventing timing attacks.

+
+
+ +
+
type BasicAuthConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// Validator is a function to validate BasicAuthWithConfig credentials. Note: if request contains multiple basic auth headers
+	// this function would be called once for each header until first valid result is returned
+	// Required.
+	Validator BasicAuthValidator
+
+	// Realm is a string to define realm attribute of BasicAuthWithConfig.
+	// Default value "Restricted".
+	Realm string
+
+	// AllowedCheckLimit set how many headers are allowed to be checked. This is useful
+	// environments like corporate test environments with application proxies restricting
+	// access to environment with their own auth scheme.
+	// Defaults to 1.
+	AllowedCheckLimit uint
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • Validator BasicAuthValidator

    Validator is a function to validate BasicAuthWithConfig credentials. Note: if request contains multiple basic auth headers +this function would be called once for each header until first valid result is returned +Required.

  • Realm string

    Realm is a string to define realm attribute of BasicAuthWithConfig. +Default value "Restricted".

  • AllowedCheckLimit uint

    AllowedCheckLimit set how many headers are allowed to be checked. This is useful +environments like corporate test environments with application proxies restricting +access to environment with their own auth scheme. +Defaults to 1.

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/basic_auth.go:97

+

ToMiddleware converts BasicAuthConfig to middleware or returns an error for invalid configuration

+
+
+
+

type BasicAuthValidator

+

Source: middleware/basic_auth.go:76

+

BasicAuthValidator defines a function to validate BasicAuthWithConfig credentials.

+

SECURITY WARNING: To prevent timing attacks that could allow attackers to enumerate +valid usernames or passwords, validator implementations MUST use constant-time +comparison for credential checking. Use crypto/subtle.ConstantTimeCompare instead +of standard string equality (==) or switch statements.

+

Example of SECURE implementation:

+
+
+ +
+
import "crypto/subtle"
+
+validator := func(c *echo.Context, username, password string) (bool, error) {
+    // Fetch expected credentials from database/config
+    expectedUser := "admin"
+    expectedPass := "secretpassword"
+
+    // Use constant-time comparison to prevent timing attacks
+    userMatch := subtle.ConstantTimeCompare([]byte(username), []byte(expectedUser)) == 1
+    passMatch := subtle.ConstantTimeCompare([]byte(password), []byte(expectedPass)) == 1
+
+    if userMatch && passMatch {
+        return true, nil
+    }
+    return false, nil
+}
+

Example of INSECURE implementation (DO NOT USE):

+
+
+ +
+
// VULNERABLE TO TIMING ATTACKS - DO NOT USE
+validator := func(c *echo.Context, username, password string) (bool, error) {
+    if username == "admin" && password == "secret" {  // Timing leak!
+        return true, nil
+    }
+    return false, nil
+}
+
+
+
+ +
+
type BasicAuthValidator func(c *echo.Context, user string, password string) (bool, error)
+
+
+
+

type BeforeFunc

+

Source: middleware/middleware.go:19

+

BeforeFunc defines a function which is executed just before the middleware.

+
+
+ +
+
type BeforeFunc func(c *echo.Context)
+
+
+
+

type BodyDumpConfig

+

Source: middleware/body_dump.go:19

+

BodyDumpConfig defines the config for BodyDump middleware.

+
+
+ +
+
type BodyDumpConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// Handler receives request, response payloads and handler error if there are any.
+	// Required.
+	Handler BodyDumpHandler
+
+	// MaxRequestBytes limits how much of the request body to dump.
+	// If the request body exceeds this limit, only the first MaxRequestBytes
+	// are dumped. The handler callback receives truncated data.
+	// Default: 5 * MB (5,242,880 bytes)
+	// Set to -1 to disable limits (not recommended in production).
+	MaxRequestBytes int64
+
+	// MaxResponseBytes limits how much of the response body to dump.
+	// If the response body exceeds this limit, only the first MaxResponseBytes
+	// are dumped. The handler callback receives truncated data.
+	// Default: 5 * MB (5,242,880 bytes)
+	// Set to -1 to disable limits (not recommended in production).
+	MaxResponseBytes int64
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • Handler BodyDumpHandler

    Handler receives request, response payloads and handler error if there are any. +Required.

  • MaxRequestBytes int64

    MaxRequestBytes limits how much of the request body to dump. +If the request body exceeds this limit, only the first MaxRequestBytes +are dumped. The handler callback receives truncated data. +Default: 5 * MB (5,242,880 bytes) +Set to -1 to disable limits (not recommended in production).

  • MaxResponseBytes int64

    MaxResponseBytes limits how much of the response body to dump. +If the response body exceeds this limit, only the first MaxResponseBytes +are dumped. The handler callback receives truncated data. +Default: 5 * MB (5,242,880 bytes) +Set to -1 to disable limits (not recommended in production).

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/body_dump.go:73

+

ToMiddleware converts BodyDumpConfig to middleware or returns an error for invalid configuration

+
+
+
+

type BodyDumpHandler

+

Source: middleware/body_dump.go:43

+

BodyDumpHandler receives the request and response payload.

+
+
+ +
+
type BodyDumpHandler func(c *echo.Context, reqBody []byte, resBody []byte, err error)
+
+
+
+

type BodyLimitConfig

+

Source: middleware/body_limit.go:15

+

BodyLimitConfig defines the config for BodyLimitWithConfig middleware.

+
+
+ +
+
type BodyLimitConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// LimitBytes is maximum allowed size in bytes for a request body
+	LimitBytes int64
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • LimitBytes int64

    LimitBytes is maximum allowed size in bytes for a request body

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/body_limit.go:47

+

ToMiddleware converts BodyLimitConfig to middleware or returns an error for invalid configuration

+
+
+
+

type CORSConfig

+

Source: middleware/cors.go:17

+

CORSConfig defines the config for CORS middleware.

+
+
+ +
+
type CORSConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// AllowOrigins determines the value of the Access-Control-Allow-Origin
+	// response header.  This header defines a list of origins that may access the
+	// resource.
+	//
+	// Origin consist of following parts: `scheme + "://" + host + optional ":" + port`
+	// Wildcard can be used, but has to be set explicitly []string{"*"}
+	// Example: `https://example.com`, `http://example.com:8080`, `*`
+	//
+	// Security: use extreme caution when handling the origin, and carefully
+	// validate any logic. Remember that attackers may register hostile domain names.
+	// See https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html
+	// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
+	//
+	// Mandatory.
+	AllowOrigins []string
+
+	// UnsafeAllowOriginFunc is an optional custom function to validate the origin. It takes the
+	// origin as an argument and returns
+	// - string, allowed origin
+	// - bool, true if allowed or false otherwise.
+	// - error, if an error is returned, it is returned immediately by the handler.
+	// If this option is set, AllowOrigins is ignored.
+	//
+	// Security: use extreme caution when handling the origin, and carefully
+	// validate any logic. Remember that attackers may register hostile (sub)domain names.
+	// See https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html
+	//
+	// Sub-domain checks example:
+	// 		UnsafeAllowOriginFunc: func(c *echo.Context, origin string) (string, bool, error) {
+	//			if strings.HasSuffix(origin, ".example.com") {
+	//				return origin, true, nil
+	//			}
+	//			return "", false, nil
+	//		},
+	//
+	// Optional.
+	UnsafeAllowOriginFunc func(c *echo.Context, origin string) (allowedOrigin string, allowed bool, err error)
+
+	// AllowMethods determines the value of the Access-Control-Allow-Methods
+	// response header.  This header specified the list of methods allowed when
+	// accessing the resource.  This is used in response to a preflight request.
+	//
+	// Optional. Default value DefaultCORSConfig.AllowMethods.
+	// If `allowMethods` is left empty, this middleware will fill for preflight
+	// request `Access-Control-Allow-Methods` header value
+	// from `Allow` header that echo.Router set into context.
+	//
+	// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods
+	AllowMethods []string
+
+	// AllowHeaders determines the value of the Access-Control-Allow-Headers
+	// response header.  This header is used in response to a preflight request to
+	// indicate which HTTP headers can be used when making the actual request.
+	//
+	// Optional. Defaults to empty list. No domains allowed for CORS.
+	//
+	// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers
+	AllowHeaders []string
+
+	// AllowCredentials determines the value of the
+	// Access-Control-Allow-Credentials response header.  This header indicates
+	// whether or not the response to the request can be exposed when the
+	// credentials mode (Request.credentials) is true. When used as part of a
+	// response to a preflight request, this indicates whether or not the actual
+	// request can be made using credentials.  See also
+	// [MDN: Access-Control-Allow-Credentials].
+	//
+	// Optional. Default value false, in which case the header is not set.
+	//
+	// Security: avoid using `AllowCredentials = true` with `AllowOrigins = *`.
+	// See "Exploiting CORS misconfigurations for Bitcoins and bounties",
+	// https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html
+	//
+	// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
+	AllowCredentials bool
+
+	// ExposeHeaders determines the value of Access-Control-Expose-Headers, which
+	// defines a list of headers that clients are allowed to access.
+	//
+	// Optional. Default value []string{}, in which case the header is not set.
+	//
+	// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Header
+	ExposeHeaders []string
+
+	// MaxAge determines the value of the Access-Control-Max-Age response header.
+	// This header indicates how long (in seconds) the results of a preflight
+	// request can be cached.
+	// The header is set only if MaxAge != 0, negative value sends "0" which instructs browsers not to cache that response.
+	//
+	// Optional. Default value 0 - meaning header is not sent.
+	//
+	// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age
+	MaxAge int
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • AllowOrigins []string

    AllowOrigins determines the value of the Access-Control-Allow-Origin +response header. This header defines a list of origins that may access the +resource.

    +

    Origin consist of following parts: scheme + "://" + host + optional ":" + port +Wildcard can be used, but has to be set explicitly []string{"*"} +Example: https://example.com, http://example.com:8080, *

    +

    Security: use extreme caution when handling the origin, and carefully +validate any logic. Remember that attackers may register hostile domain names. +See https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html +See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin

    +

    Mandatory.

  • UnsafeAllowOriginFunc func(c *echo.Context, origin string) (allowedOrigin string, allowed bool, err error)

    UnsafeAllowOriginFunc is an optional custom function to validate the origin. It takes the +origin as an argument and returns

    +
      +
    • string, allowed origin
    • +
    • bool, true if allowed or false otherwise.
    • +
    • error, if an error is returned, it is returned immediately by the handler. +If this option is set, AllowOrigins is ignored.
    • +
    +

    Security: use extreme caution when handling the origin, and carefully +validate any logic. Remember that attackers may register hostile (sub)domain names. +See https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html

    +

    Sub-domain checks example: + UnsafeAllowOriginFunc: func(c *echo.Context, origin string) (string, bool, error) { + if strings.HasSuffix(origin, ".example.com") { + return origin, true, nil + } + return "", false, nil + },

    +

    Optional.

  • AllowMethods []string

    AllowMethods determines the value of the Access-Control-Allow-Methods +response header. This header specified the list of methods allowed when +accessing the resource. This is used in response to a preflight request.

    +

    Optional. Default value DefaultCORSConfig.AllowMethods. +If allowMethods is left empty, this middleware will fill for preflight +request Access-Control-Allow-Methods header value +from Allow header that echo.Router set into context.

    +

    See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods

  • AllowHeaders []string

    AllowHeaders determines the value of the Access-Control-Allow-Headers +response header. This header is used in response to a preflight request to +indicate which HTTP headers can be used when making the actual request.

    +

    Optional. Defaults to empty list. No domains allowed for CORS.

    +

    See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers

  • AllowCredentials bool

    AllowCredentials determines the value of the +Access-Control-Allow-Credentials response header. This header indicates +whether or not the response to the request can be exposed when the +credentials mode (Request.credentials) is true. When used as part of a +response to a preflight request, this indicates whether or not the actual +request can be made using credentials. See also +[MDN: Access-Control-Allow-Credentials].

    +

    Optional. Default value false, in which case the header is not set.

    +

    Security: avoid using AllowCredentials = true with AllowOrigins = *. +See "Exploiting CORS misconfigurations for Bitcoins and bounties", +https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html

    +

    See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials

  • ExposeHeaders []string

    ExposeHeaders determines the value of Access-Control-Expose-Headers, which +defines a list of headers that clients are allowed to access.

    +

    Optional. Default value []string{}, in which case the header is not set.

    +

    See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Header

  • MaxAge int

    MaxAge determines the value of the Access-Control-Max-Age response header. +This header indicates how long (in seconds) the results of a preflight +request can be cached. +The header is set only if MaxAge != 0, negative value sends "0" which instructs browsers not to cache that response.

    +

    Optional. Default value 0 - meaning header is not sent.

    +

    See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/cors.go:151

+

ToMiddleware converts CORSConfig to middleware or returns an error for invalid configuration

+
+
+
+

type CSRFConfig

+

Source: middleware/csrf.go:26

+

CSRFConfig defines the config for CSRF middleware.

+
+
+ +
+
type CSRFConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+	// TrustedOrigins permits any request with `Sec-Fetch-Site` header whose `Origin` header
+	// exactly matches a configured origin.
+	// Values should be formatted as Origin header "scheme://host[:port]".
+	//
+	// See [Origin]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin
+	// See [Sec-Fetch-Site]: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#fetch-metadata-headers
+	TrustedOrigins []string
+
+	// AllowSecFetchSiteFunc allows custom behaviour for `Sec-Fetch-Site` requests that are about to
+	// fail with CSRF error, to be allowed or replaced with custom error.
+	// This function applies to `Sec-Fetch-Site` values:
+	// - `same-site` 		same registrable domain (subdomain and/or different port)
+	// - `cross-site`		request originates from different site
+	// See [Sec-Fetch-Site]: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#fetch-metadata-headers
+	AllowSecFetchSiteFunc func(c *echo.Context) (bool, error)
+
+	// TokenLength is the length of the generated token.
+	TokenLength uint8
+
+	// TokenLookup is a string in the form of "<source>:<name>" or "<source>:<name>,<source>:<name>" that is used
+	// to extract token from the request.
+	// Optional. Default value "header:X-CSRF-Token".
+	// Possible values:
+	// - "header:<name>" or "header:<name>:<cut-prefix>"
+	// - "query:<name>"
+	// - "form:<name>"
+	// Multiple sources example:
+	// - "header:X-CSRF-Token,query:csrf"
+	TokenLookup string `yaml:"token_lookup"`
+
+	// Generator defines a function to generate token.
+	// Optional. Defaults to randomString(TokenLength).
+	Generator func() string
+
+	// Context key to store generated CSRF token into context.
+	// Optional. Default value "csrf".
+	ContextKey string
+
+	// Name of the CSRF cookie. This cookie will store CSRF token.
+	// Optional. Default value "csrf".
+	CookieName string
+
+	// Domain of the CSRF cookie.
+	// Optional. Default value none.
+	CookieDomain string
+
+	// Path of the CSRF cookie.
+	// Optional. Default value none.
+	CookiePath string
+
+	// Max age (in seconds) of the CSRF cookie.
+	// Optional. Default value 86400 (24hr).
+	CookieMaxAge int
+
+	// Indicates if CSRF cookie is secure.
+	// Optional. Default value false.
+	CookieSecure bool
+
+	// Indicates if CSRF cookie is HTTP only.
+	// Optional. Default value false.
+	CookieHTTPOnly bool
+
+	// Indicates SameSite mode of the CSRF cookie.
+	// Optional. Default value SameSiteDefaultMode.
+	CookieSameSite http.SameSite
+
+	// ErrorHandler defines a function which is executed for returning custom errors.
+	ErrorHandler func(c *echo.Context, err error) error
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • TrustedOrigins []string

    TrustedOrigins permits any request with Sec-Fetch-Site header whose Origin header +exactly matches a configured origin. +Values should be formatted as Origin header "scheme://host[:port]".

    +

    See [Origin]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin +See [Sec-Fetch-Site]: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#fetch-metadata-headers

  • AllowSecFetchSiteFunc func(c *echo.Context) (bool, error)

    AllowSecFetchSiteFunc allows custom behaviour for Sec-Fetch-Site requests that are about to +fail with CSRF error, to be allowed or replaced with custom error. +This function applies to Sec-Fetch-Site values:

    +
  • TokenLength uint8

    TokenLength is the length of the generated token.

  • TokenLookup string `yaml:"token_lookup"`

    TokenLookup is a string in the form of ":" or ":,:" that is used +to extract token from the request. +Optional. Default value "header:X-CSRF-Token". +Possible values:

    +
      +
    • "header:" or "header::"
    • +
    • "query:"
    • +
    • "form:" +Multiple sources example:
    • +
    • "header:X-CSRF-Token,query:csrf"
    • +
  • Generator func() string

    Generator defines a function to generate token. +Optional. Defaults to randomString(TokenLength).

  • ContextKey string

    Context key to store generated CSRF token into context. +Optional. Default value "csrf".

  • CookieName string

    Name of the CSRF cookie. This cookie will store CSRF token. +Optional. Default value "csrf".

  • CookieDomain string

    Domain of the CSRF cookie. +Optional. Default value none.

  • CookiePath string

    Path of the CSRF cookie. +Optional. Default value none.

  • CookieMaxAge int

    Max age (in seconds) of the CSRF cookie. +Optional. Default value 86400 (24hr).

  • CookieSecure bool

    Indicates if CSRF cookie is secure. +Optional. Default value false.

  • CookieHTTPOnly bool

    Indicates if CSRF cookie is HTTP only. +Optional. Default value false.

  • CookieSameSite http.SameSite

    Indicates SameSite mode of the CSRF cookie. +Optional. Default value SameSiteDefaultMode.

  • ErrorHandler func(c *echo.Context, err error) error

    ErrorHandler defines a function which is executed for returning custom errors.

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/csrf.go:126

+

ToMiddleware converts CSRFConfig to middleware or returns an error for invalid configuration

+
+
+
+

type ContextTimeoutConfig

+

Source: middleware/context_timeout.go:15

+

ContextTimeoutConfig defines the config for ContextTimeout middleware.

+
+
+ +
+
type ContextTimeoutConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// ErrorHandler is a function when error arises in middeware execution.
+	ErrorHandler func(c *echo.Context, err error) error
+
+	// Timeout configures a timeout for the middleware
+	Timeout time.Duration
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • ErrorHandler func(c *echo.Context, err error) error

    ErrorHandler is a function when error arises in middeware execution.

  • Timeout time.Duration

    Timeout configures a timeout for the middleware

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/context_timeout.go:38

+

ToMiddleware converts Config to middleware.

+
+
+
+

type DecompressConfig

+

Source: middleware/decompress.go:16

+

DecompressConfig defines the config for Decompress middleware.

+
+
+ +
+
type DecompressConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// GzipDecompressPool defines an interface to provide the sync.Pool used to create/store Gzip readers
+	GzipDecompressPool Decompressor
+
+	// MaxDecompressedSize limits the maximum size of decompressed request body in bytes.
+	// If the decompressed body exceeds this limit, the middleware returns HTTP 413 error.
+	// This prevents zip bomb attacks where small compressed payloads decompress to huge sizes.
+	// Default: 100 * MB (104,857,600 bytes)
+	// Set to -1 to disable limits (not recommended in production).
+	MaxDecompressedSize int64
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • GzipDecompressPool Decompressor

    GzipDecompressPool defines an interface to provide the sync.Pool used to create/store Gzip readers

  • MaxDecompressedSize int64

    MaxDecompressedSize limits the maximum size of decompressed request body in bytes. +If the decompressed body exceeds this limit, the middleware returns HTTP 413 error. +This prevents zip bomb attacks where small compressed payloads decompress to huge sizes. +Default: 100 * MB (104,857,600 bytes) +Set to -1 to disable limits (not recommended in production).

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/decompress.go:65

+

ToMiddleware converts DecompressConfig to middleware or returns an error for invalid configuration

+
+
+
+

type Decompressor

+

Source: middleware/decompress.go:35

+

Decompressor is used to get the sync.Pool used by the middleware to get Gzip readers

+
+
+ +
+
type Decompressor interface {
+	// contains filtered or unexported methods
+}
+
+
+
+

type DefaultGzipDecompressPool

+

Source: middleware/decompress.go:40

+

DefaultGzipDecompressPool is the default implementation of Decompressor interface

+
+
+ +
+
type DefaultGzipDecompressPool struct {
+}
+
+
+
+

type Extractor

+

Source: middleware/rate_limiter.go:52

+

Extractor is used to extract data from *echo.Context

+
+
+ +
+
type Extractor func(c *echo.Context) (string, error)
+
+
+
+

type ExtractorSource

+

Source: middleware/extractor.go:21

+

ExtractorSource is type to indicate source for extracted value

+
+
+ +
+
type ExtractorSource string
+
+
+
+

type GzipConfig

+

Source: middleware/compress.go:25

+

GzipConfig defines the config for Gzip middleware.

+
+
+ +
+
type GzipConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// Gzip compression level.
+	// Optional. Default value -1.
+	Level int
+
+	// Length threshold before gzip compression is applied.
+	// Optional. Default value 0.
+	//
+	// Most of the time you will not need to change the default. Compressing
+	// a short response might increase the transmitted data because of the
+	// gzip format overhead. Compressing the response will also consume CPU
+	// and time on the server and the client (for decompressing). Depending on
+	// your use case such a threshold might be useful.
+	//
+	// See also:
+	// https://webmasters.stackexchange.com/questions/31750/what-is-recommended-minimum-object-size-for-gzip-performance-benefits
+	MinLength int
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • Level int

    Gzip compression level. +Optional. Default value -1.

  • MinLength int

    Length threshold before gzip compression is applied. +Optional. Default value 0.

    +

    Most of the time you will not need to change the default. Compressing +a short response might increase the transmitted data because of the +gzip format overhead. Compressing the response will also consume CPU +and time on the server and the client (for decompressing). Depending on +your use case such a threshold might be useful.

    +

    See also: +https://webmasters.stackexchange.com/questions/31750/what-is-recommended-minimum-object-size-for-gzip-performance-benefits

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/compress.go:69

+

ToMiddleware converts GzipConfig to middleware or returns an error for invalid configuration

+
+
+
+

type KeyAuthConfig

+

Source: middleware/key_auth.go:19

+

KeyAuthConfig defines the config for KeyAuth middleware.

+

SECURITY: The Validator function is responsible for securely comparing API keys. +See KeyAuthValidator documentation for guidance on preventing timing attacks.

+
+
+ +
+
type KeyAuthConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// KeyLookup is a string in the form of "<source>:<name>" or "<source>:<name>,<source>:<name>" that is used
+	// to extract key from the request.
+	// Optional. Default value "header:Authorization:Bearer ".
+	// Possible values:
+	// - "header:<name>" or "header:<name>:<cut-prefix>"
+	// 			`<cut-prefix>` is argument value to cut/trim prefix of the extracted value. This is useful if header
+	//			value has static prefix like `Authorization: <auth-scheme> <authorisation-parameters>` where part that we
+	//			want to cut is `<auth-scheme> ` note the space at the end.
+	//			In case of basic authentication `Authorization: Basic <credentials>` prefix we want to remove is `Basic `.
+	// - "query:<name>"
+	// - "form:<name>"
+	// - "cookie:<name>"
+	// Multiple sources example:
+	// - "header:Authorization,header:X-Api-Key"
+	KeyLookup string
+
+	// AllowedCheckLimit set how many KeyLookup values are allowed to be checked. This is
+	// useful environments like corporate test environments with application proxies restricting
+	// access to environment with their own auth scheme.
+	AllowedCheckLimit uint
+
+	// Validator is a function to validate key.
+	// Required.
+	Validator KeyAuthValidator
+
+	// ErrorHandler defines a function which is executed when all lookups have been done and none of them passed Validator
+	// function. ErrorHandler is executed with last missing (ErrExtractionValueMissing) or an invalid key.
+	// It may be used to define a custom error.
+	//
+	// Note: when error handler swallows the error (returns nil) middleware continues handler chain execution towards handler.
+	// This is useful in cases when portion of your site/api is publicly accessible and has extra features for authorized users
+	// In that case you can use ErrorHandler to set default public auth value to request and continue with handler chain.
+	ErrorHandler KeyAuthErrorHandler
+
+	// ContinueOnIgnoredError allows the next middleware/handler to be called when ErrorHandler decides to
+	// ignore the error (by returning `nil`).
+	// This is useful when parts of your site/api allow public access and some authorized routes provide extra functionality.
+	// In that case you can use ErrorHandler to set a default public key auth value in the request context
+	// and continue. Some logic down the remaining execution chain needs to check that (public) key auth value then.
+	ContinueOnIgnoredError bool
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • KeyLookup string

    KeyLookup is a string in the form of ":" or ":,:" that is used +to extract key from the request. +Optional. Default value "header:Authorization:Bearer ". +Possible values:

    +
      +
    • "header:" or "header::" + <cut-prefix> is argument value to cut/trim prefix of the extracted value. This is useful if header + value has static prefix like Authorization: <auth-scheme> <authorisation-parameters> where part that we + want to cut is <auth-scheme> note the space at the end. + In case of basic authentication Authorization: Basic <credentials> prefix we want to remove is Basic .
    • +
    • "query:"
    • +
    • "form:"
    • +
    • "cookie:" +Multiple sources example:
    • +
    • "header:Authorization,header:X-Api-Key"
    • +
  • AllowedCheckLimit uint

    AllowedCheckLimit set how many KeyLookup values are allowed to be checked. This is +useful environments like corporate test environments with application proxies restricting +access to environment with their own auth scheme.

  • Validator KeyAuthValidator

    Validator is a function to validate key. +Required.

  • ErrorHandler KeyAuthErrorHandler

    ErrorHandler defines a function which is executed when all lookups have been done and none of them passed Validator +function. ErrorHandler is executed with last missing (ErrExtractionValueMissing) or an invalid key. +It may be used to define a custom error.

    +

    Note: when error handler swallows the error (returns nil) middleware continues handler chain execution towards handler. +This is useful in cases when portion of your site/api is publicly accessible and has extra features for authorized users +In that case you can use ErrorHandler to set default public auth value to request and continue with handler chain.

  • ContinueOnIgnoredError bool

    ContinueOnIgnoredError allows the next middleware/handler to be called when ErrorHandler decides to +ignore the error (by returning nil). +This is useful when parts of your site/api allow public access and some authorized routes provide extra functionality. +In that case you can use ErrorHandler to set a default public key auth value in the request context +and continue. Some logic down the remaining execution chain needs to check that (public) key auth value then.

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/key_auth.go:138

+

ToMiddleware converts KeyAuthConfig to middleware or returns an error for invalid configuration

+
+
+
+

type KeyAuthErrorHandler

+

Source: middleware/key_auth.go:103

+

KeyAuthErrorHandler defines a function which is executed for an invalid key.

+
+
+ +
+
type KeyAuthErrorHandler func(c *echo.Context, err error) error
+
+
+
+

type KeyAuthValidator

+

Source: middleware/key_auth.go:100

+

KeyAuthValidator defines a function to validate KeyAuth credentials.

+

SECURITY WARNING: To prevent timing attacks that could allow attackers to enumerate +valid API keys, validator implementations MUST use constant-time comparison. +Use crypto/subtle.ConstantTimeCompare instead of standard string equality (==) +or switch statements.

+

Example of SECURE implementation:

+
+
+ +
+
import "crypto/subtle"
+
+validator := func(c *echo.Context, key string, source ExtractorSource) (bool, error) {
+    // Fetch valid keys from database/config
+    validKeys := []string{"key1", "key2", "key3"}
+
+    for _, validKey := range validKeys {
+        // Use constant-time comparison to prevent timing attacks
+        if subtle.ConstantTimeCompare([]byte(key), []byte(validKey)) == 1 {
+            return true, nil
+        }
+    }
+    return false, nil
+}
+

Example of INSECURE implementation (DO NOT USE):

+
+
+ +
+
// VULNERABLE TO TIMING ATTACKS - DO NOT USE
+validator := func(c *echo.Context, key string, source ExtractorSource) (bool, error) {
+    switch key {  // Timing leak!
+    case "valid-key":
+        return true, nil
+    default:
+        return false, nil
+    }
+}
+
+
+
+ +
+
type KeyAuthValidator func(c *echo.Context, key string, source ExtractorSource) (bool, error)
+
+
+
+

type MethodOverrideConfig

+

Source: middleware/method_override.go:13

+

MethodOverrideConfig defines the config for MethodOverride middleware.

+
+
+ +
+
type MethodOverrideConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// Getter is a function that gets overridden method from the request.
+	// Optional. Default values MethodFromHeader(echo.HeaderXHTTPMethodOverride).
+	Getter MethodOverrideGetter
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • Getter MethodOverrideGetter

    Getter is a function that gets overridden method from the request. +Optional. Default values MethodFromHeader(echo.HeaderXHTTPMethodOverride).

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/method_override.go:46

+

ToMiddleware converts MethodOverrideConfig to middleware or returns an error for invalid configuration

+
+
+
+

type MethodOverrideGetter

+

Source: middleware/method_override.go:23

+

MethodOverrideGetter is a function that gets overridden method from the request

+
+
+ +
+
type MethodOverrideGetter func(c *echo.Context) string
+
+
+
+

type PanicStackError

+

Source: middleware/recover.go:92

+

PanicStackError is an error type that wraps an error along with its stack trace. +It is returned when config.DisablePrintStack is set to false.

+
+
+ +
+
type PanicStackError struct {
+	Stack []byte
+	Err   error
+}
+
+
Fields
  • Stack []byte
  • Err error
+
+

func Error) Error() string

+

Source: middleware/recover.go:97

+
+
+

func Unwrap() error

+

Source: middleware/recover.go:101

+
+
+
+

type ProxyBalancer

+

Source: middleware/proxy.go:100

+

ProxyBalancer defines an interface to implement a load balancing technique.

+
+
+ +
+
type ProxyBalancer interface {
+	AddTarget(target *ProxyTarget) bool
+	RemoveTarget(targetName string) bool
+	Next(c *echo.Context) (*ProxyTarget, error)
+}
+
+
Methods
  • AddTarget func(target *ProxyTarget) bool
  • RemoveTarget func(targetName string) bool
  • Next func(c *echo.Context) (*ProxyTarget, error)
+
+
+

type ProxyConfig

+

Source: middleware/proxy.go:29

+

ProxyConfig defines the config for Proxy middleware.

+
+
+ +
+
type ProxyConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// Balancer defines a load balancing technique.
+	// Required.
+	Balancer ProxyBalancer
+
+	// RetryCount defines the number of times a failed proxied request should be retried
+	// using the next available ProxyTarget. Defaults to 0, meaning requests are never retried.
+	RetryCount int
+
+	// RetryFilter defines a function used to determine if a failed request to a
+	// ProxyTarget should be retried. The RetryFilter will only be called when the number
+	// of previous retries is less than RetryCount. If the function returns true, the
+	// request will be retried. The provided error indicates the reason for the request
+	// failure. When the ProxyTarget is unavailable, the error will be an instance of
+	// echo.HTTPError with a code of http.StatusBadGateway. In all other cases, the error
+	// will indicate an internal error in the Proxy middleware. When a RetryFilter is not
+	// specified, all requests that fail with http.StatusBadGateway will be retried. A custom
+	// RetryFilter can be provided to only retry specific requests. Note that RetryFilter is
+	// only called when the request to the target fails, or an internal error in the Proxy
+	// middleware has occurred. Successful requests that return a non-200 response code cannot
+	// be retried.
+	RetryFilter func(c *echo.Context, e error) bool
+
+	// ErrorHandler defines a function which can be used to return custom errors from
+	// the Proxy middleware. ErrorHandler is only invoked when there has been
+	// either an internal error in the Proxy middleware or the ProxyTarget is
+	// unavailable. Due to the way requests are proxied, ErrorHandler is not invoked
+	// when a ProxyTarget returns a non-200 response. In these cases, the response
+	// is already written so errors cannot be modified. ErrorHandler is only
+	// invoked after all retry attempts have been exhausted.
+	ErrorHandler func(c *echo.Context, err error) error
+
+	// Rewrite defines URL path rewrite rules. The values captured in asterisk can be
+	// retrieved by index e.g. $1, $2 and so on.
+	// Examples:
+	// "/old":              "/new",
+	// "/api/*":            "/$1",
+	// "/js/*":             "/public/javascripts/$1",
+	// "/users/*/orders/*": "/user/$1/order/$2",
+	Rewrite map[string]string
+
+	// RegexRewrite defines rewrite rules using regexp.Rexexp with captures
+	// Every capture group in the values can be retrieved by index e.g. $1, $2 and so on.
+	// Example:
+	// "^/old/[0.9]+/":     "/new",
+	// "^/api/.+?/(.*)":    "/v2/$1",
+	RegexRewrite map[*regexp.Regexp]string
+
+	// Context key to store selected ProxyTarget into context.
+	// Optional. Default value "target".
+	ContextKey string
+
+	// To customize the transport to remote.
+	// Examples: If custom TLS certificates are required.
+	Transport http.RoundTripper
+
+	// ModifyResponse defines function to modify response from ProxyTarget.
+	ModifyResponse func(*http.Response) error
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • Balancer ProxyBalancer

    Balancer defines a load balancing technique. +Required.

  • RetryCount int

    RetryCount defines the number of times a failed proxied request should be retried +using the next available ProxyTarget. Defaults to 0, meaning requests are never retried.

  • RetryFilter func(c *echo.Context, e error) bool

    RetryFilter defines a function used to determine if a failed request to a +ProxyTarget should be retried. The RetryFilter will only be called when the number +of previous retries is less than RetryCount. If the function returns true, the +request will be retried. The provided error indicates the reason for the request +failure. When the ProxyTarget is unavailable, the error will be an instance of +echo.HTTPError with a code of http.StatusBadGateway. In all other cases, the error +will indicate an internal error in the Proxy middleware. When a RetryFilter is not +specified, all requests that fail with http.StatusBadGateway will be retried. A custom +RetryFilter can be provided to only retry specific requests. Note that RetryFilter is +only called when the request to the target fails, or an internal error in the Proxy +middleware has occurred. Successful requests that return a non-200 response code cannot +be retried.

  • ErrorHandler func(c *echo.Context, err error) error

    ErrorHandler defines a function which can be used to return custom errors from +the Proxy middleware. ErrorHandler is only invoked when there has been +either an internal error in the Proxy middleware or the ProxyTarget is +unavailable. Due to the way requests are proxied, ErrorHandler is not invoked +when a ProxyTarget returns a non-200 response. In these cases, the response +is already written so errors cannot be modified. ErrorHandler is only +invoked after all retry attempts have been exhausted.

  • Rewrite map[string]string

    Rewrite defines URL path rewrite rules. The values captured in asterisk can be +retrieved by index e.g. $1, $2 and so on. +Examples: +"/old": "/new", +"/api/": "/$1", +"/js/": "/public/javascripts/$1", +"/users//orders/": "/user/$1/order/$2",

  • RegexRewrite map[*regexp.Regexp]string

    RegexRewrite defines rewrite rules using regexp.Rexexp with captures +Every capture group in the values can be retrieved by index e.g. $1, $2 and so on. +Example: +"^/old/[0.9]+/": "/new", +"^/api/.+?/(.*)": "/v2/$1",

  • ContextKey string

    Context key to store selected ProxyTarget into context. +Optional. Default value "target".

  • Transport http.RoundTripper

    To customize the transport to remote. +Examples: If custom TLS certificates are required.

  • ModifyResponse func(*http.Response) error

    ModifyResponse defines function to modify response from ProxyTarget.

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/proxy.go:306

+

ToMiddleware converts ProxyConfig to middleware or returns an error for invalid configuration

+
+
+
+

type ProxyTarget

+

Source: middleware/proxy.go:93

+

ProxyTarget defines the upstream target.

+
+
+ +
+
type ProxyTarget struct {
+	Name string
+	URL  *url.URL
+	Meta map[string]any
+}
+
+
Fields
  • Name string
  • URL *url.URL
  • Meta map[string]any
+
+
+

type RateLimiterConfig

+

Source: middleware/rate_limiter.go:38

+

RateLimiterConfig defines the configuration for the rate limiter

+
+
+ +
+
type RateLimiterConfig struct {
+	Skipper    Skipper
+	BeforeFunc BeforeFunc
+	// IdentifierExtractor uses *echo.Context to extract the identifier for a visitor
+	IdentifierExtractor Extractor
+	// Store defines a store for the rate limiter
+	Store RateLimiterStore
+	// ErrorHandler provides a handler to be called when IdentifierExtractor returns an error
+	ErrorHandler func(c *echo.Context, err error) error
+	// DenyHandler provides a handler to be called when RateLimiter denies access
+	DenyHandler func(c *echo.Context, identifier string, err error) error
+}
+
+
Fields
  • Skipper Skipper
  • BeforeFunc BeforeFunc
  • IdentifierExtractor Extractor

    IdentifierExtractor uses *echo.Context to extract the identifier for a visitor

  • Store RateLimiterStore

    Store defines a store for the rate limiter

  • ErrorHandler func(c *echo.Context, err error) error

    ErrorHandler provides a handler to be called when IdentifierExtractor returns an error

  • DenyHandler func(c *echo.Context, identifier string, err error) error

    DenyHandler provides a handler to be called when RateLimiter denies access

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/rate_limiter.go:124

+

ToMiddleware converts RateLimiterConfig to middleware or returns an error for invalid configuration

+
+
+
+

type RateLimiterMemoryStore

+

Source: middleware/rate_limiter.go:170

+

RateLimiterMemoryStore is the built-in store implementation for RateLimiter

+
+
+ +
+
type RateLimiterMemoryStore struct {
+	// contains filtered or unexported fields
+}
+
+
+

func Allow(identifier string) (bool, error)

+

Source: middleware/rate_limiter.go:256

+

Allow implements RateLimiterStore.Allow

+
+
+

func AllowContext(c *echo.Context, identifier string) (bool, error)

+

Source: middleware/rate_limiter.go:263

+

AllowContext implements RateLimiterStoreContext: it makes the allow/deny decision +and sets the X-RateLimit-* (and Retry-After when denied) response headers.

+
+
+
+

type RateLimiterMemoryStoreConfig

+

Source: middleware/rate_limiter.go:244

+

RateLimiterMemoryStoreConfig represents configuration for RateLimiterMemoryStore

+
+
+ +
+
type RateLimiterMemoryStoreConfig struct {
+	Rate      float64       // Rate of requests allowed to pass as req/s. For more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit.
+	Burst     int           // Burst is maximum number of requests to pass at the same moment. It additionally allows a number of requests to pass when rate limit is reached.
+	ExpiresIn time.Duration // ExpiresIn is the duration after that a rate limiter is cleaned up
+}
+
+
Fields
  • Rate float64

    Rate of requests allowed to pass as req/s. For more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit.

  • Burst int

    Burst is maximum number of requests to pass at the same moment. It additionally allows a number of requests to pass when rate limit is reached.

  • ExpiresIn time.Duration

    ExpiresIn is the duration after that a rate limiter is cleaned up

+
+
+

type RateLimiterStore

+

Source: middleware/rate_limiter.go:25

+

RateLimiterStore is the interface to be implemented by custom stores.

+
+
+ +
+
type RateLimiterStore interface {
+	Allow(identifier string) (bool, error)
+}
+
+
Methods
  • Allow func(identifier string) (bool, error)
+
+
+

type RateLimiterStoreContext

+

Source: middleware/rate_limiter.go:33

+

RateLimiterStoreContext is an optional interface a RateLimiterStore may implement. +When the configured store implements it, the rate limiter calls AllowContext +(with the request context) instead of Allow, allowing the store to set response +headers such as Retry-After or X-RateLimit-* on the allow/deny decision.

+
+
+ +
+
type RateLimiterStoreContext interface {
+	AllowContext(c *echo.Context, identifier string) (bool, error)
+}
+
+
Methods
  • AllowContext func(c *echo.Context, identifier string) (bool, error)
+
+
+

type RecoverConfig

+

Source: middleware/recover.go:15

+

RecoverConfig defines the config for Recover middleware.

+
+
+ +
+
type RecoverConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// Size of the stack to be printed.
+	// Optional. Default value 4KB.
+	StackSize int
+
+	// DisableStackAll disables formatting stack traces of all other goroutines
+	// into buffer after the trace for the current goroutine.
+	// Optional. Default value false.
+	DisableStackAll bool
+
+	// DisablePrintStack disables printing stack trace.
+	// Optional. Default value as false.
+	DisablePrintStack bool
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • StackSize int

    Size of the stack to be printed. +Optional. Default value 4KB.

  • DisableStackAll bool

    DisableStackAll disables formatting stack traces of all other goroutines +into buffer after the trace for the current goroutine. +Optional. Default value false.

  • DisablePrintStack bool

    DisablePrintStack disables printing stack trace. +Optional. Default value as false.

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/recover.go:53

+

ToMiddleware converts RecoverConfig to middleware or returns an error for invalid configuration

+
+
+
+

type RedirectConfig

+

Source: middleware/redirect.go:15

+

RedirectConfig defines the config for Redirect middleware.

+
+
+ +
+
type RedirectConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper
+
+	// Status code to be used when redirecting the request.
+	// Optional. Default value http.StatusMovedPermanently.
+	Code int
+	// contains filtered or unexported fields
+}
+
+
Fields
  • Skipper

    Skipper defines a function to skip middleware.

  • Code int

    Status code to be used when redirecting the request. +Optional. Default value http.StatusMovedPermanently.

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/redirect.go:119

+

ToMiddleware converts RedirectConfig to middleware or returns an error for invalid configuration

+
+
+
+

type RemoveTrailingSlashConfig

+

Source: middleware/slash.go:80

+

RemoveTrailingSlashConfig is the middleware config for removing trailing slash from the request.

+
+
+ +
+
type RemoveTrailingSlashConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// Status code to be used when redirecting the request.
+	// Optional, but when provided the request is redirected using this code.
+	RedirectCode int
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • RedirectCode int

    Status code to be used when redirecting the request. +Optional, but when provided the request is redirected using this code.

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/slash.go:103

+

ToMiddleware converts RemoveTrailingSlashConfig to middleware or returns an error for invalid configuration

+
+
+
+

type RequestIDConfig

+

Source: middleware/request_id.go:11

+

RequestIDConfig defines the config for RequestID middleware.

+
+
+ +
+
type RequestIDConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// Generator defines a function to generate an ID.
+	// Optional. Default value random.String(32).
+	Generator func() string
+
+	// RequestIDHandler defines a function which is executed for a request id.
+	RequestIDHandler func(c *echo.Context, requestID string)
+
+	// TargetHeader defines what header to look for to populate the id.
+	// Optional. Default value is `X-Request-Id`
+	TargetHeader string
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • Generator func() string

    Generator defines a function to generate an ID. +Optional. Default value random.String(32).

  • RequestIDHandler func(c *echo.Context, requestID string)

    RequestIDHandler defines a function which is executed for a request id.

  • TargetHeader string

    TargetHeader defines what header to look for to populate the id. +Optional. Default value is X-Request-Id

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/request_id.go:42

+

ToMiddleware converts RequestIDConfig to middleware or returns an error for invalid configuration

+
+
+
+

type RequestLoggerConfig

+

Source: middleware/request_logger.go:124

+

RequestLoggerConfig is configuration for Request Logger middleware.

+
+
+ +
+
type RequestLoggerConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// BeforeNextFunc defines a function that is called before next middleware or handler is called in chain.
+	BeforeNextFunc func(c *echo.Context)
+	// LogValuesFunc defines a function that is called with values extracted by logger from request/response.
+	// Mandatory.
+	LogValuesFunc func(c *echo.Context, v RequestLoggerValues) error
+
+	// HandleError instructs logger to call global error handler when next middleware/handler returns an error.
+	// This is useful when you have custom error handler that can decide to use different status codes.
+	//
+	// A side-effect of calling global error handler is that now Response has been committed and sent to the client
+	// and middlewares up in chain can not change Response status code or response body.
+	HandleError bool
+
+	// LogLatency instructs logger to record duration it took to execute rest of the handler chain (next(c) call).
+	LogLatency bool
+	// LogProtocol instructs logger to extract request protocol (i.e. `HTTP/1.1` or `HTTP/2`)
+	LogProtocol bool
+	// LogRemoteIP instructs logger to extract request remote IP. See `echo.Context.RealIP()` for implementation details.
+	LogRemoteIP bool
+	// LogHost instructs logger to extract request host value (i.e. `example.com`)
+	LogHost bool
+	// LogMethod instructs logger to extract request method value (i.e. `GET` etc)
+	LogMethod bool
+	// LogURI instructs logger to extract request URI (i.e. `/list?lang=en&page=1`)
+	LogURI bool
+	// LogURIPath instructs logger to extract request URI path part (i.e. `/list`)
+	LogURIPath bool
+	// LogRoutePath instructs logger to extract route path part to which request was matched to (i.e. `/user/:id`)
+	LogRoutePath bool
+	// LogRequestID instructs logger to extract request ID from request `X-Request-ID` header or response if request did not have value.
+	LogRequestID bool
+	// LogReferer instructs logger to extract request referer values.
+	LogReferer bool
+	// LogUserAgent instructs logger to extract request user agent values.
+	LogUserAgent bool
+	// LogStatus instructs logger to extract response status code. If handler chain returns an error,
+	// the status code is extracted from the error satisfying echo.StatusCoder interface.
+	LogStatus bool
+	// LogContentLength instructs logger to extract content length header value. Note: this value could be different from
+	// actual request body size as it could be spoofed etc.
+	LogContentLength bool
+	// LogResponseSize instructs logger to extract response content length value. Note: when used with Gzip middleware
+	// this value may not be always correct.
+	LogResponseSize bool
+	// LogHeaders instructs logger to extract given list of headers from request. Note: request can contain more than
+	// one header with same value so slice of values is been logger for each given header.
+	//
+	// Note: header values are converted to canonical form with http.CanonicalHeaderKey as this how request parser converts header
+	// names to. For example, the canonical key for "accept-encoding" is "Accept-Encoding".
+	LogHeaders []string
+	// LogQueryParams instructs logger to extract given list of query parameters from request URI. Note: request can
+	// contain more than one query parameter with same name so slice of values is been logger for each given query param name.
+	LogQueryParams []string
+	// LogFormValues instructs logger to extract given list of form values from request body+URI. Note: request can
+	// contain more than one form value with same name so slice of values is been logger for each given form value name.
+	LogFormValues []string
+	// contains filtered or unexported fields
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • BeforeNextFunc func(c *echo.Context)

    BeforeNextFunc defines a function that is called before next middleware or handler is called in chain.

  • LogValuesFunc func(c *echo.Context, v RequestLoggerValues) error

    LogValuesFunc defines a function that is called with values extracted by logger from request/response. +Mandatory.

  • HandleError bool

    HandleError instructs logger to call global error handler when next middleware/handler returns an error. +This is useful when you have custom error handler that can decide to use different status codes.

    +

    A side-effect of calling global error handler is that now Response has been committed and sent to the client +and middlewares up in chain can not change Response status code or response body.

  • LogLatency bool

    LogLatency instructs logger to record duration it took to execute rest of the handler chain (next(c) call).

  • LogProtocol bool

    LogProtocol instructs logger to extract request protocol (i.e. HTTP/1.1 or HTTP/2)

  • LogRemoteIP bool

    LogRemoteIP instructs logger to extract request remote IP. See echo.Context.RealIP() for implementation details.

  • LogHost bool

    LogHost instructs logger to extract request host value (i.e. example.com)

  • LogMethod bool

    LogMethod instructs logger to extract request method value (i.e. GET etc)

  • LogURI bool

    LogURI instructs logger to extract request URI (i.e. /list?lang=en&page=1)

  • LogURIPath bool

    LogURIPath instructs logger to extract request URI path part (i.e. /list)

  • LogRoutePath bool

    LogRoutePath instructs logger to extract route path part to which request was matched to (i.e. /user/:id)

  • LogRequestID bool

    LogRequestID instructs logger to extract request ID from request X-Request-ID header or response if request did not have value.

  • LogReferer bool

    LogReferer instructs logger to extract request referer values.

  • LogUserAgent bool

    LogUserAgent instructs logger to extract request user agent values.

  • LogStatus bool

    LogStatus instructs logger to extract response status code. If handler chain returns an error, +the status code is extracted from the error satisfying echo.StatusCoder interface.

  • LogContentLength bool

    LogContentLength instructs logger to extract content length header value. Note: this value could be different from +actual request body size as it could be spoofed etc.

  • LogResponseSize bool

    LogResponseSize instructs logger to extract response content length value. Note: when used with Gzip middleware +this value may not be always correct.

  • LogHeaders []string

    LogHeaders instructs logger to extract given list of headers from request. Note: request can contain more than +one header with same value so slice of values is been logger for each given header.

    +

    Note: header values are converted to canonical form with http.CanonicalHeaderKey as this how request parser converts header +names to. For example, the canonical key for "accept-encoding" is "Accept-Encoding".

  • LogQueryParams []string

    LogQueryParams instructs logger to extract given list of query parameters from request URI. Note: request can +contain more than one query parameter with same name so slice of values is been logger for each given query param name.

  • LogFormValues []string

    LogFormValues instructs logger to extract given list of form values from request body+URI. Note: request can +contain more than one form value with same name so slice of values is been logger for each given form value name.

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/request_logger.go:246

+

ToMiddleware converts RequestLoggerConfig into middleware or returns an error for invalid configuration.

+
+
+
+

type RequestLoggerValues

+

Source: middleware/request_logger.go:189

+

RequestLoggerValues contains extracted values from logger.

+
+
+ +
+
type RequestLoggerValues struct {
+	// StartTime is time recorded before next middleware/handler is executed.
+	StartTime time.Time
+	// Latency is duration it took to execute rest of the handler chain (next(c) call).
+	Latency time.Duration
+	// Protocol is request protocol (i.e. `HTTP/1.1` or `HTTP/2`)
+	Protocol string
+	// RemoteIP is request remote IP. See `echo.Context.RealIP()` for implementation details.
+	RemoteIP string
+	// Host is request host value (i.e. `example.com`)
+	Host string
+	// Method is request method value (i.e. `GET` etc)
+	Method string
+	// URI is request URI (i.e. `/list?lang=en&page=1`)
+	URI string
+	// URIPath is request URI path part (i.e. `/list`)
+	URIPath string
+	// RoutePath is route path part to which request was matched to (i.e. `/user/:id`)
+	RoutePath string
+	// RequestID is request ID from request `X-Request-ID` header or response if request did not have value.
+	RequestID string
+	// Referer is request referer values.
+	Referer string
+	// UserAgent is request user agent values.
+	UserAgent string
+	// Status is a response status code. When the handler returns an error satisfying echo.StatusCoder interface, then code from it.
+	Status int
+	// Error is error returned from executed handler chain.
+	Error error
+	// ContentLength is content length header value. Note: this value could be different from actual request body size
+	// as it could be spoofed etc.
+	ContentLength string
+	// ResponseSize is response content length value. Note: when used with Gzip middleware this value may not be always correct.
+	ResponseSize int64
+	// Headers are list of headers from request. Note: request can contain more than one header with same value so slice
+	// of values is what will be returned/logged for each given header.
+	// Note: header values are converted to canonical form with http.CanonicalHeaderKey as this how request parser converts header
+	// names to. For example, the canonical key for "accept-encoding" is "Accept-Encoding".
+	Headers map[string][]string
+	// QueryParams are list of query parameters from request URI. Note: request can contain more than one query parameter
+	// with same name so slice of values is what will be returned/logged for each given query param name.
+	QueryParams map[string][]string
+	// FormValues are list of form values from request body+URI. Note: request can contain more than one form value with
+	// same name so slice of values is what will be returned/logged for each given form value name.
+	FormValues map[string][]string
+}
+
+
Fields
  • StartTime time.Time

    StartTime is time recorded before next middleware/handler is executed.

  • Latency time.Duration

    Latency is duration it took to execute rest of the handler chain (next(c) call).

  • Protocol string

    Protocol is request protocol (i.e. HTTP/1.1 or HTTP/2)

  • RemoteIP string

    RemoteIP is request remote IP. See echo.Context.RealIP() for implementation details.

  • Host string

    Host is request host value (i.e. example.com)

  • Method string

    Method is request method value (i.e. GET etc)

  • URI string

    URI is request URI (i.e. /list?lang=en&page=1)

  • URIPath string

    URIPath is request URI path part (i.e. /list)

  • RoutePath string

    RoutePath is route path part to which request was matched to (i.e. /user/:id)

  • RequestID string

    RequestID is request ID from request X-Request-ID header or response if request did not have value.

  • Referer string

    Referer is request referer values.

  • UserAgent string

    UserAgent is request user agent values.

  • Status int

    Status is a response status code. When the handler returns an error satisfying echo.StatusCoder interface, then code from it.

  • Error error

    Error is error returned from executed handler chain.

  • ContentLength string

    ContentLength is content length header value. Note: this value could be different from actual request body size +as it could be spoofed etc.

  • ResponseSize int64

    ResponseSize is response content length value. Note: when used with Gzip middleware this value may not be always correct.

  • Headers map[string][]string

    Headers are list of headers from request. Note: request can contain more than one header with same value so slice +of values is what will be returned/logged for each given header. +Note: header values are converted to canonical form with http.CanonicalHeaderKey as this how request parser converts header +names to. For example, the canonical key for "accept-encoding" is "Accept-Encoding".

  • QueryParams map[string][]string

    QueryParams are list of query parameters from request URI. Note: request can contain more than one query parameter +with same name so slice of values is what will be returned/logged for each given query param name.

  • FormValues map[string][]string

    FormValues are list of form values from request body+URI. Note: request can contain more than one form value with +same name so slice of values is what will be returned/logged for each given form value name.

+
+
+

type RewriteConfig

+

Source: middleware/rewrite.go:15

+

RewriteConfig defines the config for Rewrite middleware.

+
+
+ +
+
type RewriteConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// Rules defines the URL path rewrite rules. The values captured in asterisk can be
+	// retrieved by index e.g. $1, $2 and so on.
+	// Example:
+	// "/old":              "/new",
+	// "/api/*":            "/$1",
+	// "/js/*":             "/public/javascripts/$1",
+	// "/users/*/orders/*": "/user/$1/order/$2",
+	// Required.
+	Rules map[string]string
+
+	// RegexRules defines the URL path rewrite rules using regexp.Rexexp with captures
+	// Every capture group in the values can be retrieved by index e.g. $1, $2 and so on.
+	// Example:
+	// "^/old/[0.9]+/":     "/new",
+	// "^/api/.+?/(.*)":     "/v2/$1",
+	RegexRules map[*regexp.Regexp]string
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • Rules map[string]string

    Rules defines the URL path rewrite rules. The values captured in asterisk can be +retrieved by index e.g. $1, $2 and so on. +Example: +"/old": "/new", +"/api/": "/$1", +"/js/": "/public/javascripts/$1", +"/users//orders/": "/user/$1/order/$2", +Required.

  • RegexRules map[*regexp.Regexp]string

    RegexRules defines the URL path rewrite rules using regexp.Rexexp with captures +Every capture group in the values can be retrieved by index e.g. $1, $2 and so on. +Example: +"^/old/[0.9]+/": "/new", +"^/api/.+?/(.*)": "/v2/$1",

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/rewrite.go:54

+

ToMiddleware converts RewriteConfig to middleware or returns an error for invalid configuration

+
+
+
+

type SecureConfig

+

Source: middleware/secure.go:13

+

SecureConfig defines the config for Secure middleware.

+
+
+ +
+
type SecureConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// XSSProtection provides protection against cross-site scripting attack (XSS)
+	// by setting the `X-XSS-Protection` header.
+	// Optional. Default value "1; mode=block".
+	XSSProtection string
+
+	// ContentTypeNosniff provides protection against overriding Content-Type
+	// header by setting the `X-Content-Type-Options` header.
+	// Optional. Default value "nosniff".
+	ContentTypeNosniff string
+
+	// XFrameOptions can be used to indicate whether or not a browser should
+	// be allowed to render a page in a <frame>, <iframe> or <object> .
+	// Sites can use this to avoid clickjacking attacks, by ensuring that their
+	// content is not embedded into other sites.provides protection against
+	// clickjacking.
+	// Optional. Default value "SAMEORIGIN".
+	// Possible values:
+	// - "SAMEORIGIN" - The page can only be displayed in a frame on the same origin as the page itself.
+	// - "DENY" - The page cannot be displayed in a frame, regardless of the site attempting to do so.
+	// - "ALLOW-FROM uri" - The page can only be displayed in a frame on the specified origin.
+	XFrameOptions string
+
+	// HSTSMaxAge sets the `Strict-Transport-Security` header to indicate how
+	// long (in seconds) browsers should remember that this site is only to
+	// be accessed using HTTPS. This reduces your exposure to some SSL-stripping
+	// man-in-the-middle (MITM) attacks.
+	// Optional. Default value 0.
+	HSTSMaxAge int
+
+	// HSTSExcludeSubdomains won't include subdomains tag in the `Strict Transport Security`
+	// header, excluding all subdomains from security policy. It has no effect
+	// unless HSTSMaxAge is set to a non-zero value.
+	// Optional. Default value false.
+	HSTSExcludeSubdomains bool
+
+	// ContentSecurityPolicy sets the `Content-Security-Policy` header providing
+	// security against cross-site scripting (XSS), clickjacking and other code
+	// injection attacks resulting from execution of malicious content in the
+	// trusted web page context.
+	// Optional. Default value "".
+	ContentSecurityPolicy string
+
+	// CSPReportOnly would use the `Content-Security-Policy-Report-Only` header instead
+	// of the `Content-Security-Policy` header. This allows iterative updates of the
+	// content security policy by only reporting the violations that would
+	// have occurred instead of blocking the resource.
+	// Optional. Default value false.
+	CSPReportOnly bool
+
+	// HSTSPreloadEnabled will add the preload tag in the `Strict Transport Security`
+	// header, which enables the domain to be included in the HSTS preload list
+	// maintained by Chrome (and used by Firefox and Safari): https://hstspreload.org/
+	// Optional.  Default value false.
+	HSTSPreloadEnabled bool
+
+	// ReferrerPolicy sets the `Referrer-Policy` header providing security against
+	// leaking potentially sensitive request paths to third parties.
+	// Optional. Default value "".
+	ReferrerPolicy string
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • XSSProtection string

    XSSProtection provides protection against cross-site scripting attack (XSS) +by setting the X-XSS-Protection header. +Optional. Default value "1; mode=block".

  • ContentTypeNosniff string

    ContentTypeNosniff provides protection against overriding Content-Type +header by setting the X-Content-Type-Options header. +Optional. Default value "nosniff".

  • XFrameOptions string

    XFrameOptions can be used to indicate whether or not a browser should +be allowed to render a page in a ,

  • HSTSMaxAge int

    HSTSMaxAge sets the Strict-Transport-Security header to indicate how +long (in seconds) browsers should remember that this site is only to +be accessed using HTTPS. This reduces your exposure to some SSL-stripping +man-in-the-middle (MITM) attacks. +Optional. Default value 0.

  • HSTSExcludeSubdomains bool

    HSTSExcludeSubdomains won't include subdomains tag in the Strict Transport Security +header, excluding all subdomains from security policy. It has no effect +unless HSTSMaxAge is set to a non-zero value. +Optional. Default value false.

  • ContentSecurityPolicy string

    ContentSecurityPolicy sets the Content-Security-Policy header providing +security against cross-site scripting (XSS), clickjacking and other code +injection attacks resulting from execution of malicious content in the +trusted web page context. +Optional. Default value "".

  • CSPReportOnly bool

    CSPReportOnly would use the Content-Security-Policy-Report-Only header instead +of the Content-Security-Policy header. This allows iterative updates of the +content security policy by only reporting the violations that would +have occurred instead of blocking the resource. +Optional. Default value false.

  • HSTSPreloadEnabled bool

    HSTSPreloadEnabled will add the preload tag in the Strict Transport Security +header, which enables the domain to be included in the HSTS preload list +maintained by Chrome (and used by Firefox and Safari): https://hstspreload.org/ +Optional. Default value false.

  • ReferrerPolicy string

    ReferrerPolicy sets the Referrer-Policy header providing security against +leaking potentially sensitive request paths to third parties. +Optional. Default value "".

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/secure.go:101

+

ToMiddleware converts SecureConfig to middleware or returns an error for invalid configuration

+
+
+
+

type Skipper

+

Source: middleware/middleware.go:16

+

Skipper defines a function to skip middleware. Returning true skips processing the middleware.

+
+
+ +
+
type Skipper func(c *echo.Context) bool
+
+
+
+

type StaticConfig

+

Source: middleware/static.go:24

+

StaticConfig defines the config for Static middleware.

+
+
+ +
+
type StaticConfig struct {
+	// Skipper defines a function to skip middleware.
+	Skipper Skipper
+
+	// Root directory from where the static content is served (relative to given Filesystem).
+	// `Root: "."` means root folder from Filesystem.
+	// Required.
+	Root string
+
+	// Filesystem provides access to the static content.
+	// Optional. Defaults to echo.Filesystem (serves files from `.` folder where executable is started)
+	Filesystem fs.FS
+
+	// Index file for serving a directory.
+	// Optional. Default value "index.html".
+	Index string
+
+	// Enable HTML5 mode by forwarding all not-found requests to root so that
+	// SPA (single-page application) can handle the routing.
+	// Optional. Default value false.
+	HTML5 bool
+
+	// Enable directory browsing.
+	// Optional. Default value false.
+	Browse bool
+
+	// Enable ignoring of the base of the URL path.
+	// Example: when assigning a static middleware to a non root path group,
+	// the filesystem path is not doubled
+	// Optional. Default value false.
+	IgnoreBase bool
+
+	// Deprecated: this field is ignored, use EnablePathUnescaping instead. DisablePathUnescaping will be removed in a future version.
+	// Note: previously the zero value (false) enabled unescaping, which was the unsafe default.
+	DisablePathUnescaping bool
+
+	// EnablePathUnescaping enables path parameter (param: *) unescaping.
+	// Default false (safe): encoded slashes (%2f) in the wildcard param are NOT decoded,
+	// preventing ACL bypass where /admin%2fprivate.txt bypasses a /admin/* route guard by
+	// not matching that route but having its wildcard param decoded to admin/private.txt.
+	// Set to true only when serving files whose names contain URL-encoded characters
+	// (e.g. "hello world.txt" via /hello%20world.txt) and you are not relying on
+	// route-based ACL guards to restrict access.
+	//
+	// Enabling echo.RouterConfig.UseEscapedPathForMatching makes this field irrelevant and can lead to security issues when
+	// using different Routes to exclude some of the files from being served.
+	// e.g. if you serve files from directory as such and use different route to exclude some of the files from being served.
+	// 0. given folder structure:
+	//   public/
+	//   public/index.html
+	//   public/admin/private.txt
+	// 1. share `public/` folder contents from the server root with `e.Static("/", "public")`
+	// 2. naively assume that everything under /admin folder is now forbidden
+	//       e.GET("/admin/*", func(c *Context) error { return echo.ErrForbidden })
+	// Then request to `/assets/../admin%2fprivate.txt` will be served as router does not match it to guarded route.
+	EnablePathUnescaping bool
+
+	// DirectoryListTemplate is template to list directory contents
+	// Optional. Default to `directoryListHTMLTemplate` constant below.
+	DirectoryListTemplate string
+}
+
+
Fields
  • Skipper Skipper

    Skipper defines a function to skip middleware.

  • Root string

    Root directory from where the static content is served (relative to given Filesystem). +Root: "." means root folder from Filesystem. +Required.

  • Filesystem fs.FS

    Filesystem provides access to the static content. +Optional. Defaults to echo.Filesystem (serves files from . folder where executable is started)

  • Index string

    Index file for serving a directory. +Optional. Default value "index.html".

  • HTML5 bool

    Enable HTML5 mode by forwarding all not-found requests to root so that +SPA (single-page application) can handle the routing. +Optional. Default value false.

  • Browse bool

    Enable directory browsing. +Optional. Default value false.

  • IgnoreBase bool

    Enable ignoring of the base of the URL path. +Example: when assigning a static middleware to a non root path group, +the filesystem path is not doubled +Optional. Default value false.

  • DisablePathUnescaping bool

    Deprecated: this field is ignored, use EnablePathUnescaping instead. DisablePathUnescaping will be removed in a future version. +Note: previously the zero value (false) enabled unescaping, which was the unsafe default.

  • EnablePathUnescaping bool

    EnablePathUnescaping enables path parameter (param: ) unescaping. +Default false (safe): encoded slashes (%2f) in the wildcard param are NOT decoded, +preventing ACL bypass where /admin%2fprivate.txt bypasses a /admin/ route guard by +not matching that route but having its wildcard param decoded to admin/private.txt. +Set to true only when serving files whose names contain URL-encoded characters +(e.g. "hello world.txt" via /hello%20world.txt) and you are not relying on +route-based ACL guards to restrict access.

    +

    Enabling echo.RouterConfig.UseEscapedPathForMatching makes this field irrelevant and can lead to security issues when +using different Routes to exclude some of the files from being served. +e.g. if you serve files from directory as such and use different route to exclude some of the files from being served. +0. given folder structure: + public/ + public/index.html + public/admin/private.txt

    +
      +
    1. share public/ folder contents from the server root with e.Static("/", "public")
    2. +
    3. naively assume that everything under /admin folder is now forbidden + e.GET("/admin/*", func(c *Context) error { return echo.ErrForbidden }) +Then request to /assets/../admin%2fprivate.txt will be served as router does not match it to guarded route.
    4. +
  • DirectoryListTemplate string

    DirectoryListTemplate is template to list directory contents +Optional. Default to directoryListHTMLTemplate constant below.

+
+

func ToMiddleware() (echo.MiddlewareFunc, error)

+

Source: middleware/static.go:177

+

ToMiddleware converts StaticConfig to middleware or returns an error for invalid configuration

+
+
+
+

type ValueExtractorError

+

Source: middleware/extractor.go:37

+

ValueExtractorError is error type when middleware extractor is unable to extract value from lookups

+
+
+ +
+
type ValueExtractorError struct {
+	// contains filtered or unexported fields
+}
+
+
+

func Error) Error() string

+

Source: middleware/extractor.go:42

+

Error returns errors text

+
+
+
+

type ValuesExtractor

+

Source: middleware/extractor.go:54

+

ValuesExtractor defines a function for extracting values (keys/tokens) from the given context.

+
+
+ +
+
type ValuesExtractor func(c *echo.Context) ([]string, ExtractorSource, error)
+
+
+
+

type Visitor

+

Source: middleware/rate_limiter.go:182

+

Visitor signifies a unique user's limiter details

+
+
+ +
+
type Visitor struct {
+	*rate.Limiter
+	// contains filtered or unexported fields
+}
+
+
Fields
  • *rate.Limiter
+
\ No newline at end of file diff --git a/docs/api-reference/evidence.json b/docs/api-reference/evidence.json new file mode 100644 index 000000000..014b7ca0d --- /dev/null +++ b/docs/api-reference/evidence.json @@ -0,0 +1,15 @@ +{ + "summary": "Sourcey-generated API reference documentation for labstack/echo, a high-performance Go web framework", + "observations": [ + "runx-cli 0.6.14 confirmed via runx --version", + "Target repository: https://github.com/labstack/echo at commit 70b31c2ca5131f4eda9c56d78294e8a0573f8645, MIT licensed", + "Sourcey v3.6.5 used with godoc adapter in snapshot mode to generate docs from Go source", + "3 packages documented: echo (main), echotest (testing), middleware (HTTP middleware) with87 public APIs total", + "5 HTML pages generated: index, api-reference index, package-root, pkg-echotest, pkg-middleware", + "Sourcey command: sourcey godoc -m . -o godoc.json && sourcey build -o dist", + "Docs deployed to GitHub Pages at https://patrick6x6.github.io/echo/", + "PR submitted to upstream: https://github.com/labstack/echo/pull/3045", + "sourcey.config.ts uses godoc adapter with snapshot mode for reproducible builds", + "Coverage includes all exported types, functions, interfaces, and methods across all packages" + ] +} diff --git a/docs/api-reference/index.html b/docs/api-reference/index.html new file mode 100644 index 000000000..179191931 --- /dev/null +++ b/docs/api-reference/index.html @@ -0,0 +1,3257 @@ + +github.com/labstack/echo/v5 - Echo API Reference
Root

github.com/labstack/echo/v5

Package echo implements high performance, minimalist Go web framework.

import "github.com/labstack/echo/v5"

+

Package echo implements high performance, minimalist Go web framework.

+

Example:

+
+
+ +
+
package main
+
+import (
+	"log/slog"
+	"net/http"
+
+	"github.com/labstack/echo/v5"
+	"github.com/labstack/echo/v5/middleware"
+)
+
+// Handler
+func hello(c *echo.Context) error {
+	return c.String(http.StatusOK, "Hello, World!")
+}
+
+func main() {
+	// Echo instance
+	e := echo.New()
+
+	// Middleware
+	e.Use(middleware.RequestLogger())
+	e.Use(middleware.Recover())
+
+	// Routes
+	e.GET("/", hello)
+
+	// Start server
+	if err := e.Start(":8080"); err != nil {
+		slog.Error("failed to start server", "error", err)
+	}
+}
+

Learn more at https://echo.labstack.com

+ +

Constants

+

TimeLayout constants for parsing Unix timestamps in different precisions.

Source: binder_generic.go:43

+
+ +
+
const (
+	TimeLayoutUnixTime      = TimeLayout("UnixTime")      // Unix timestamp in seconds
+	TimeLayoutUnixTimeMilli = TimeLayout("UnixTimeMilli") // Unix timestamp in milliseconds
+	TimeLayoutUnixTimeNano  = TimeLayout("UnixTimeNano")  // Unix timestamp in nanoseconds
+)
+
+ + +

MIME types

Source: echo.go:148

+
+ +
+
const (
+	// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259
+	MIMEApplicationJSON = "application/json"
+	// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.
+	// No "charset" parameter is defined for this registration.
+	// Adding one really has no effect on compliant recipients.
+	// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n"
+	MIMEApplicationJSONCharsetUTF8       = MIMEApplicationJSON + "; " + charsetUTF8
+	MIMEApplicationJavaScript            = "application/javascript"
+	MIMEApplicationJavaScriptCharsetUTF8 = MIMEApplicationJavaScript + "; " + charsetUTF8
+	MIMEApplicationXML                   = "application/xml"
+	MIMEApplicationXMLCharsetUTF8        = MIMEApplicationXML + "; " + charsetUTF8
+	MIMETextXML                          = "text/xml"
+	MIMETextXMLCharsetUTF8               = MIMETextXML + "; " + charsetUTF8
+	MIMEApplicationForm                  = "application/x-www-form-urlencoded"
+	MIMEApplicationProtobuf              = "application/protobuf"
+	MIMEApplicationMsgpack               = "application/msgpack"
+	MIMETextHTML                         = "text/html"
+	MIMETextHTMLCharsetUTF8              = MIMETextHTML + "; " + charsetUTF8
+	MIMETextPlain                        = "text/plain"
+	MIMETextPlainCharsetUTF8             = MIMETextPlain + "; " + charsetUTF8
+	MIMEMultipartForm                    = "multipart/form-data"
+	MIMEOctetStream                      = "application/octet-stream"
+)
+
+ + + + + + + + + + + + + + + + +

Source: echo.go:174

+
+ +
+
const (
+
+	// PROPFIND Method can be used on collection and property resources.
+	PROPFIND = "PROPFIND"
+	// REPORT Method can be used to get information about a resource, see rfc 3253
+	REPORT = "REPORT"
+	// QUERY Method is a safe, idempotent request method carrying request content (a query) in its body, see rfc 10008.
+	// It is not (yet) part of the `net/http` standard library, so Echo defines it here.
+	QUERY = "QUERY"
+	// RouteNotFound is special method type for routes handling "route not found" (404) cases
+	RouteNotFound = "echo_route_not_found"
+	// RouteAny is special method type that matches any HTTP method in request. Any has lower
+	// priority that other methods that have been registered with Router to that path.
+	RouteAny = "echo_route_any"
+)
+
+ + + + +

Headers

Source: echo.go:189

+
+ +
+
const (
+	HeaderAccept         = "Accept"
+	HeaderAcceptEncoding = "Accept-Encoding"
+	// HeaderAllow is the name of the "Allow" header field used to list the set of methods
+	// advertised as supported by the target resource. Returning an Allow header is mandatory
+	// for status 405 (method not found) and useful for the OPTIONS method in responses.
+	// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1
+	HeaderAllow               = "Allow"
+	HeaderAuthorization       = "Authorization"
+	HeaderContentDisposition  = "Content-Disposition"
+	HeaderContentEncoding     = "Content-Encoding"
+	HeaderContentLength       = "Content-Length"
+	HeaderContentType         = "Content-Type"
+	HeaderCookie              = "Cookie"
+	HeaderSetCookie           = "Set-Cookie"
+	HeaderIfModifiedSince     = "If-Modified-Since"
+	HeaderLastModified        = "Last-Modified"
+	HeaderLocation            = "Location"
+	HeaderRetryAfter          = "Retry-After"
+	HeaderUpgrade             = "Upgrade"
+	HeaderVary                = "Vary"
+	HeaderWWWAuthenticate     = "WWW-Authenticate"
+	HeaderXForwardedFor       = "X-Forwarded-For"
+	HeaderXForwardedProto     = "X-Forwarded-Proto"
+	HeaderXForwardedProtocol  = "X-Forwarded-Protocol"
+	HeaderXForwardedSsl       = "X-Forwarded-Ssl"
+	HeaderXUrlScheme          = "X-Url-Scheme"
+	HeaderXHTTPMethodOverride = "X-HTTP-Method-Override"
+	HeaderXRealIP             = "X-Real-Ip"
+	HeaderXRequestID          = "X-Request-Id"
+	HeaderXCorrelationID      = "X-Correlation-Id"
+	HeaderXRequestedWith      = "X-Requested-With"
+	HeaderServer              = "Server"
+
+	// HeaderOrigin request header indicates the origin (scheme, hostname, and port) that caused the request.
+	// See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin
+	HeaderOrigin       = "Origin"
+	HeaderCacheControl = "Cache-Control"
+	HeaderConnection   = "Connection"
+
+	// Access control
+	HeaderAccessControlRequestMethod    = "Access-Control-Request-Method"
+	HeaderAccessControlRequestHeaders   = "Access-Control-Request-Headers"
+	HeaderAccessControlAllowOrigin      = "Access-Control-Allow-Origin"
+	HeaderAccessControlAllowMethods     = "Access-Control-Allow-Methods"
+	HeaderAccessControlAllowHeaders     = "Access-Control-Allow-Headers"
+	HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials"
+	HeaderAccessControlExposeHeaders    = "Access-Control-Expose-Headers"
+	HeaderAccessControlMaxAge           = "Access-Control-Max-Age"
+
+	// Security
+	HeaderStrictTransportSecurity         = "Strict-Transport-Security"
+	HeaderXContentTypeOptions             = "X-Content-Type-Options"
+	HeaderXXSSProtection                  = "X-XSS-Protection"
+	HeaderXFrameOptions                   = "X-Frame-Options"
+	HeaderContentSecurityPolicy           = "Content-Security-Policy"
+	HeaderContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only"
+	HeaderXCSRFToken                      = "X-CSRF-Token" // #nosec G101
+	HeaderReferrerPolicy                  = "Referrer-Policy"
+
+	// HeaderSecFetchSite fetch metadata request header indicates the relationship between a request initiator's
+	// origin and the origin of the requested resource.
+	// See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Fetch-Site
+	HeaderSecFetchSite = "Sec-Fetch-Site"
+)
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Source: router.go:49

+
+ +
+
const (
+	// NotFoundRouteName is name of RouteInfo returned when router did not find matching route (404: not found).
+	NotFoundRouteName = "echo_route_not_found_name"
+	// MethodNotAllowedRouteName is name of RouteInfo returned when router did not find matching method for route  (405: method not allowed).
+	MethodNotAllowedRouteName = "echo_route_method_not_allowed_name"
+)
+
+ +

Source: context.go:52

+
+ +
+
const (
+	// ContextKeyHeaderAllow is set by Router for getting value for `Allow` header in later stages of handler call chain.
+	// Allow header is mandatory for status 405 (method not found) and useful for OPTIONS method requests.
+	// It is added to context only when Router does not find matching method handler for request.
+	ContextKeyHeaderAllow = "echo_header_allow"
+)
+
+

Source: version.go:8

+
+ +
+
const (
+	// Version of Echo
+	Version = "5.3.0"
+)
+
+

Variables

+

The following errors can produce HTTP status code by implementing HTTPStatusCoder interface

Source: httperror.go:14

+
+ +
+
var (
+	ErrBadRequest                  = &httpError{http.StatusBadRequest}            // 400
+	ErrUnauthorized                = &httpError{http.StatusUnauthorized}          // 401
+	ErrForbidden                   = &httpError{http.StatusForbidden}             // 403
+	ErrNotFound                    = &httpError{http.StatusNotFound}              // 404
+	ErrMethodNotAllowed            = &httpError{http.StatusMethodNotAllowed}      // 405
+	ErrRequestTimeout              = &httpError{http.StatusRequestTimeout}        // 408
+	ErrStatusRequestEntityTooLarge = &httpError{http.StatusRequestEntityTooLarge} // 413
+	ErrUnsupportedMediaType        = &httpError{http.StatusUnsupportedMediaType}  // 415
+	ErrTooManyRequests             = &httpError{http.StatusTooManyRequests}       // 429
+	ErrInternalServerError         = &httpError{http.StatusInternalServerError}   // 500
+	ErrBadGateway                  = &httpError{http.StatusBadGateway}            // 502
+	ErrServiceUnavailable          = &httpError{http.StatusServiceUnavailable}    // 503
+)
+
+ + + + + + + + + + + +

The following errors fall into 500 (InternalServerError) category

Source: httperror.go:30

+
+ +
+
var (
+	ErrValidatorNotRegistered = errors.New("validator not registered")
+	ErrRendererNotRegistered  = errors.New("renderer not registered")
+	ErrInvalidRedirectCode    = errors.New("invalid redirect status code")
+	ErrCookieNotFound         = errors.New("cookie not found")
+	ErrInvalidCertOrKeyType   = errors.New("invalid cert or key type, must be string or []byte")
+	ErrInvalidListenerNetwork = errors.New("invalid listener network")
+)
+
+ + + + + +

ErrInvalidKeyType is error that is returned when the value is not castable to expected type.

Source: context_generic.go:12

+
+ +
+
var ErrInvalidKeyType = errors.New("invalid key type")
+
+

ErrNonExistentKey is error that is returned when key does not exist

Source: context_generic.go:9

+
+ +
+
var ErrNonExistentKey = errors.New("non existent key")
+
+

Functions

+
+

func BindBody(c *Context, target any) (err error)

+

Source: bind.go:68

+

BindBody binds request body contents to bindable object +NB: then binding forms take note that this implementation uses standard library form parsing +which parses form data from BOTH URL and BODY if content type is not MIMEMultipartForm +See non-MIMEMultipartForm: https://golang.org/pkg/net/http/#Request.ParseForm +See MIMEMultipartForm: https://golang.org/pkg/net/http/#Request.ParseMultipartForm

+
+
+

func BindHeaders(c *Context, target any) error

+

Source: bind.go:114

+

BindHeaders binds HTTP headers to a bindable object

+
+
+

func BindPathValues(c *Context, target any) error

+

Source: bind.go:44

+

BindPathValues binds path parameter values to bindable object

+
+
+

func BindQueryParams(c *Context, target any) error

+

Source: bind.go:56

+

BindQueryParams binds query params to bindable object

+
+
+

func ContextGet[T any](c *Context, key string) (T, error)

+

Source: context_generic.go:16

+

ContextGet retrieves a value from the context store or ErrNonExistentKey error the key is missing. +Returns ErrInvalidKeyType error if the value is not castable to type T.

+
+
+

func ContextGetOr[T any](c *Context, key string, defaultValue T) (T, error)

+

Source: context_generic.go:37

+

ContextGetOr retrieves a value from the context store or returns a default value when the key +is missing. Returns ErrInvalidKeyType error if the value is not castable to type T.

+
+
+

func DefaultHTTPErrorHandler(exposeError bool) HTTPErrorHandler

+

Source: echo.go:448

+

DefaultHTTPErrorHandler creates new default HTTP error handler implementation. It sends a JSON response +with status code. exposeError parameter decides if returned message will contain also error message or not

+

Note: DefaultHTTPErrorHandler does not log errors. Use middleware for it if errors need to be logged (separately) +Note: In case errors happens in middleware call-chain that is returning from handler (which did not return an error). +When handler has already sent response (ala c.JSON()) and there is error in middleware that is returning from +handler. Then the error that global error handler received will be ignored because we have already "committed" the +response and status code header has been sent to the client.

+
Example +
+
+ +
+
// SPDX-License-Identifier: MIT
+// SPDX-FileCopyrightText: © 2015 LabStack LLC and Echo contributors
+
+// run tests as external package to get real feel for API
+package echo_test
+
+import (
+	"encoding/json"
+	"fmt"
+	"github.com/labstack/echo/v5"
+	"net/http"
+	"net/http/httptest"
+)
+
+func ExampleDefaultHTTPErrorHandler() {
+	e := echo.New()
+	e.GET("/api/endpoint", func(c *echo.Context) error {
+		return &apiError{
+			Code: http.StatusBadRequest,
+			Body: map[string]any{"message": "custom error"},
+		}
+	})
+
+	req := httptest.NewRequest(http.MethodGet, "/api/endpoint?err=1", nil)
+	resp := httptest.NewRecorder()
+
+	e.ServeHTTP(resp, req)
+
+	fmt.Printf("%d %s", resp.Code, resp.Body.String())
+
+	// Output: 400 {"error":{"message":"custom error"}}
+}
+
+type apiError struct {
+	Code int
+	Body any
+}
+
+func (e *apiError) StatusCode() int {
+	return e.Code
+}
+
+func (e *apiError) MarshalJSON() ([]byte, error) {
+	type body struct {
+		Error any `json:"error"`
+	}
+	return json.Marshal(body{Error: e.Body})
+}
+
+func (e *apiError) Error() string {
+	return http.StatusText(e.Code)
+}
+
+
+

Output:

+
+
+ +
+
400 {"error":{"message":"custom error"}}
+
+
+
+
+

func ExtractIPDirect() IPExtractor

+

Source: ip.go:207

+

ExtractIPDirect extracts an IP address using an actual IP address. +Use this if your server faces to internet directly (i.e.: uses no proxy).

+
+
+

func ExtractIPFromRealIPHeader(options ...TrustOption) IPExtractor

+

Source: ip.go:224

+

ExtractIPFromRealIPHeader extracts IP address using x-real-ip header. +Use this if you put proxy which uses this header.

+
+
+

func ExtractIPFromXFFHeader(options ...TrustOption) IPExtractor

+

Source: ip.go:242

+

ExtractIPFromXFFHeader extracts IP address using x-forwarded-for header. +Use this if you put proxy which uses this header. +This returns nearest untrustable IP. If all IPs are trustable, returns furthest one (i.e.: XFF[0]).

+
+
+

func FormFieldBinder(c *Context) *ValueBinder

+

Source: binder.go:168

+

FormFieldBinder creates form field value binder +For all requests, FormFieldBinder parses the raw query from the URL and uses query params as form fields

+

For POST, PUT, and PATCH requests, it also reads the request body, parses it +as a form and uses query params as form fields. Request body parameters take precedence over URL query +string values in r.Form.

+

NB: when binding forms take note that this implementation uses standard library form parsing +which parses form data from BOTH URL and BODY if content type is not MIMEMultipartForm +See https://golang.org/pkg/net/http/#Request.ParseForm

+
+
+

func FormValue[T any](c *Context, key string, opts ...any) (T, error)

+

Source: binder_generic.go:213

+

FormValue extracts and parses a single form value from the request by key. +It returns the typed value and an error if binding fails. Returns ErrNonExistentKey if parameter not found.

+

Empty String Handling:

+
+
+ +
+
If the form field exists but has an empty value, the zero value of type T is returned
+with no error. For example, an empty form field returns (0, nil) for int types.
+This differs from standard library behavior where parsing empty strings returns errors.
+To treat empty values as errors, validate the result separately or check the raw value.
+

See ParseValue for supported types and options

+
+
+

func FormValueOr[T any](c *Context, key string, defaultValue T, opts ...any) (T, error)

+

Source: binder_generic.go:248

+

FormValueOr extracts and parses a single form value from the request by key. +Returns defaultValue if the parameter is not found or has an empty value. +Returns an error only if parsing fails or form parsing errors occur.

+

Example:

+
+
+ +
+
limit, err := echo.FormValueOr[int](c, "limit", 100)
+// If "limit" is missing: returns (100, nil)
+// If "limit" is "50": returns (50, nil)
+// If "limit" is "abc": returns (100, BindingError)
+

See ParseValue for supported types and options

+
+
+

func FormValues[T any](c *Context, key string, opts ...any) ([]T, error)

+

Source: binder_generic.go:273

+

FormValues extracts and parses all values for a form values key as a slice. +It returns the typed slice and an error if binding any value fails. Returns ErrNonExistentKey if parameter not found.

+

See ParseValues for supported types and options

+
+
+

func FormValuesOr[T any](c *Context, key string, defaultValue []T, opts ...any) ([]T, error)

+

Source: binder_generic.go:300

+

FormValuesOr extracts and parses all values for a form values key as a slice. +Returns defaultValue if the parameter is not found. +Returns an error only if parsing any value fails or form parsing errors occur.

+

Example:

+
+
+ +
+
tags, err := echo.FormValuesOr[string](c, "tags", []string{})
+// If "tags" is missing: returns ([], nil)
+// If form parsing fails: returns (nil, error)
+

See ParseValues for supported types and options

+
+
+

func HandlerName(h HandlerFunc) string

+

Source: route.go:102

+

HandlerName returns string name for given function.

+
+
+

func LegacyIPExtractor() IPExtractor

+

Source: ip.go:288

+

LegacyIPExtractor returns an IPExtractor that derives the client IP address +from common proxy headers, falling back to the request's remote address.

+

Resolution order:

+
    +
  1. X-Forwarded-For: returns the first IP in the comma-separated list. +If multiple values are present, only the left-most (original client) +is used. Surrounding brackets (for IPv6) are stripped.
  2. +
  3. X-Real-IP: used if X-Forwarded-For is absent. Surrounding brackets +(for IPv6) are stripped.
  4. +
  5. req.RemoteAddr: used as a fallback; the host portion is extracted +via net.SplitHostPort.
  6. +
+

Notes:

+
    +
  • No validation is performed on header values.
  • +
  • This function trusts headers as-is and is therefore not safe against +spoofing unless the application is behind a trusted proxy that is +configured to strip/replace/modify headers correctly.
  • +
+

Use ExtractIPFromXFFHeader or ExtractIPFromRealIPHeader instead of LegacyIPExtractor.

+
+
+

func MustSubFS(currentFs fs.FS, fsRoot string) fs.FS

+

Source: echo.go:946

+

MustSubFS creates sub FS from current filesystem or panic on failure. +Panic happens when fsRoot contains invalid path according to fs.ValidPath rules.

+

MustSubFS is helpful when dealing with embed.FS because for example //go:embed assets/images embeds files with +paths including assets/images as their prefix. In that case use `fs := echo.MustSubFS(fs, "rootDirectory") to +create sub fs which uses necessary prefix for directory path.

+
+
+

func New() *Echo

+

Source: echo.go:386

+

New creates an instance of Echo.

+
+
+

func NewBindingError(sourceParam string, values []string, message string, err error) error

+

Source: binder.go:81

+

NewBindingError creates new instance of binding error

+
+
+

func NewConcurrentRouter(r Router) Router

+

Source: router_concurrent.go:9

+

NewConcurrentRouter creates concurrency safe Router which routes can be added/removed safely +even after http.Server has been started.

+
+
+

func NewContext(r *http.Request, w http.ResponseWriter, opts ...any) *Context

+

Source: context.go:98

+

NewContext returns a new Context instance.

+

Note: request,response and e can be left to nil as Echo.ServeHTTP will call c.Reset(req,resp) anyway +these arguments are useful when creating context for tests and cases like that.

+
+
+

func NewDefaultFS(dir string) fs.FS

+

Source: echo.go:900

+

NewDefaultFS returns a new defaultFS instance which allows fs.FS.Open to have absolute paths as input if it matches +then given dir as prefix.

+
+
+

func NewHTTPError(code int, message string) *HTTPError

+

Source: httperror.go:99

+

NewHTTPError creates a new instance of HTTPError

+
+
+

func NewResponse(w http.ResponseWriter, logger *slog.Logger) (r *Response)

+

Source: response.go:32

+

NewResponse creates a new instance of Response.

+
+
+

func NewRouter(config RouterConfig) *DefaultRouter

+

Source: router.go:127

+

NewRouter returns a new Router instance.

+
+
+

func NewVirtualHostHandler(vhosts map[string]*Echo) *Echo

+

Source: vhost.go:10

+

NewVirtualHostHandler creates instance of Echo that routes requests to given virtual hosts +when hosts in request does not exist in given map the request is served by returned Echo instance.

+
+
+

func NewWithConfig(config Config) *Echo

+

Source: echo.go:343

+

NewWithConfig creates an instance of Echo with given configuration.

+
+
+

func ParseValue[T any](value string, opts ...any) (T, error)

+

Source: binder_generic.go:366

+

ParseValue parses value to generic type

+

Types that are supported:

+
    +
  • bool
  • +
  • float32
  • +
  • float64
  • +
  • int
  • +
  • int8
  • +
  • int16
  • +
  • int32
  • +
  • int64
  • +
  • uint
  • +
  • uint8/byte
  • +
  • uint16
  • +
  • uint32
  • +
  • uint64
  • +
  • string
  • +
  • echo.BindUnmarshaler interface
  • +
  • encoding.TextUnmarshaler interface
  • +
  • json.Unmarshaler interface
  • +
  • time.Duration
  • +
  • time.Time use echo.TimeOpts or echo.TimeLayout to set time parsing configuration
  • +
+
+
+

func ParseValueOr[T any](value string, defaultValue T, opts ...any) (T, error)

+

Source: binder_generic.go:393

+

ParseValueOr parses value to generic type, when value is empty defaultValue is returned.

+

Types that are supported:

+
    +
  • bool
  • +
  • float32
  • +
  • float64
  • +
  • int
  • +
  • int8
  • +
  • int16
  • +
  • int32
  • +
  • int64
  • +
  • uint
  • +
  • uint8/byte
  • +
  • uint16
  • +
  • uint32
  • +
  • uint64
  • +
  • string
  • +
  • echo.BindUnmarshaler interface
  • +
  • encoding.TextUnmarshaler interface
  • +
  • json.Unmarshaler interface
  • +
  • time.Duration
  • +
  • time.Time use echo.TimeOpts or echo.TimeLayout to set time parsing configuration
  • +
+
+
+

func ParseValues[T any](values []string, opts ...any) ([]T, error)

+

Source: binder_generic.go:320

+

ParseValues parses value to generic type slice. Same types are supported as ParseValue +function but the result type is slice instead of scalar value.

+

See ParseValue for supported types and options

+
+
+

func ParseValuesOr[T any](values []string, defaultValue []T, opts ...any) ([]T, error)

+

Source: binder_generic.go:329

+

ParseValuesOr parses value to generic type slice, when value is empty defaultValue is returned. +Same types are supported as ParseValue function but the result type is slice instead of scalar value.

+

See ParseValue for supported types and options

+
+
+

func PathParam[T any](c *Context, paramName string, opts ...any) (T, error)

+

Source: binder_generic.go:59

+

PathParam extracts and parses a path parameter from the context by name. +It returns the typed value and an error if binding fails. Returns ErrNonExistentKey if parameter not found.

+

Empty String Handling:

+
+
+ +
+
If the parameter exists but has an empty value, the zero value of type T is returned
+with no error. For example, a path parameter with value "" returns (0, nil) for int types.
+This differs from standard library behavior where parsing empty strings returns errors.
+To treat empty values as errors, validate the result separately or check the raw value.
+

See ParseValue for supported types and options

+
+
+

func PathParamOr[T any](c *Context, paramName string, defaultValue T, opts ...any) (T, error)

+

Source: binder_generic.go:85

+

PathParamOr extracts and parses a path parameter from the context by name. +Returns defaultValue if the parameter is not found or has an empty value. +Returns an error only if parsing fails (e.g., "abc" for int type).

+

Example:

+
+
+ +
+
id, err := echo.PathParamOr[int](c, "id", 0)
+// If "id" is missing: returns (0, nil)
+// If "id" is "123": returns (123, nil)
+// If "id" is "abc": returns (0, BindingError)
+

See ParseValue for supported types and options

+
+
+

func PathValuesBinder(c *Context) *ValueBinder

+

Source: binder.go:142

+

PathValuesBinder creates path parameter value binder

+
+
+

func QueryParam[T any](c *Context, key string, opts ...any) (T, error)

+

Source: binder_generic.go:114

+

QueryParam extracts and parses a single query parameter from the request by key. +It returns the typed value and an error if binding fails. Returns ErrNonExistentKey if parameter not found.

+

Empty String Handling:

+
+
+ +
+
If the parameter exists but has an empty value (?key=), the zero value of type T is returned
+with no error. For example, "?count=" returns (0, nil) for int types.
+This differs from standard library behavior where parsing empty strings returns errors.
+To treat empty values as errors, validate the result separately or check the raw value.
+

Behavior Summary:

+
    +
  • Missing key (?other=value): returns (zero, ErrNonExistentKey)
  • +
  • Empty value (?key=): returns (zero, nil)
  • +
  • Invalid value (?key=abc for int): returns (zero, BindingError)
  • +
+

See ParseValue for supported types and options

+
+
+

func QueryParamOr[T any](c *Context, key string, defaultValue T, opts ...any) (T, error)

+

Source: binder_generic.go:144

+

QueryParamOr extracts and parses a single query parameter from the request by key. +Returns defaultValue if the parameter is not found or has an empty value. +Returns an error only if parsing fails (e.g., "abc" for int type).

+

Example:

+
+
+ +
+
page, err := echo.QueryParamOr[int](c, "page", 1)
+// If "page" is missing: returns (1, nil)
+// If "page" is "5": returns (5, nil)
+// If "page" is "abc": returns (1, BindingError)
+

See ParseValue for supported types and options

+
+
+

func QueryParams[T any](c *Context, key string, opts ...any) ([]T, error)

+

Source: binder_generic.go:164

+

QueryParams extracts and parses all values for a query parameter key as a slice. +It returns the typed slice and an error if binding any value fails. Returns ErrNonExistentKey if parameter not found.

+

See ParseValues for supported types and options

+
+
+

func QueryParamsBinder(c *Context) *ValueBinder

+

Source: binder.go:126

+

QueryParamsBinder creates query parameter value binder

+
+
+

func QueryParamsOr[T any](c *Context, key string, defaultValue []T, opts ...any) ([]T, error)

+

Source: binder_generic.go:189

+

QueryParamsOr extracts and parses all values for a query parameter key as a slice. +Returns defaultValue if the parameter is not found. +Returns an error only if parsing any value fails.

+

Example:

+
+
+ +
+
ids, err := echo.QueryParamsOr[int](c, "ids", []int{})
+// If "ids" is missing: returns ([], nil)
+// If "ids" is "1&ids=2": returns ([1, 2], nil)
+// If "ids" contains "abc": returns ([], BindingError)
+

See ParseValues for supported types and options

+
+
+

func ResolveResponseStatus(rw http.ResponseWriter, err error) (resp *Response, status int)

+

Source: httperror.go:66

+

ResolveResponseStatus returns the Response and HTTP status code that should be (or has been) sent for rw, +given an optional error.

+

This function is useful for middleware and handlers that need to figure out the HTTP status +code to return based on the error that occurred or what was set in the response.

+

Precedence rules:

+
    +
  1. If the response has already been committed, the committed status wins (err is ignored).
  2. +
  3. Otherwise, start with 200 OK (net/http default if WriteHeader is never called).
  4. +
  5. If the response has a non-zero suggested status, use it.
  6. +
  7. If err != nil, it overrides the suggested status:
      +
    • StatusCode(err) if non-zero
    • +
    • otherwise 500 Internal Server Error.
    • +
    +
  8. +
+
+
+

func StaticDirectoryHandler(fileSystem fs.FS, disablePathUnescaping bool) HandlerFunc

+

Source: echo.go:650

+

StaticDirectoryHandler creates handler function to serve files from provided file system +When disablePathUnescaping is set then file name from path is not unescaped and is served as is.

+

Note: when disablePathUnescaping=false, the handler decodes the wildcard param before serving. +If route guards (e.g. e.GET("/admin/*", forbidden)) are used to restrict parts of the +filesystem, an encoded separator (%2F) or encoded dot-dot (%2E%2E) in the URL can resolve to +a path that the router never matched against the guard route. Enabling +RouterConfig.UseEscapedPathForMatching does NOT fix this — it changes which path the router +uses for matching but still lets path.Clean resolve ".." segments into a guarded directory. +Do not rely on route guards alone to restrict a filesystem served by this handler. +See https://github.com/labstack/echo/security/advisories/GHSA-vfp3-v2gw-7wfq

+
+
+

func StaticFileHandler(file string, filesystem fs.FS) HandlerFunc

+

Source: echo.go:693

+

StaticFileHandler creates handler function to serve file from provided file system.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func StatusCode(err error) int

+

Source: httperror.go:45

+

StatusCode returns status code from err if it implements HTTPStatusCoder interface. +If err does not implement the interface, it returns 0.

+
+
+

func TrustIPRange(ipRange *net.IPNet) TrustOption

+

Source: ip.go:168

+

TrustIPRange add trustable IP ranges using CIDR notation.

+
+
+

func TrustLinkLocal(v bool) TrustOption

+

Source: ip.go:154

+

TrustLinkLocal configures if you trust link-local address (default: true).

+
+
+

func TrustLoopback(v bool) TrustOption

+

Source: ip.go:147

+

TrustLoopback configures if you trust loopback address (default: true).

+
+
+

func TrustPrivateNet(v bool) TrustOption

+

Source: ip.go:161

+

TrustPrivateNet configures if you trust private network address (default: true).

+
+
+

func UnwrapResponse(rw http.ResponseWriter) (*Response, error)

+

Source: response.go:121

+

UnwrapResponse unwraps given ResponseWriter to return contexts original Echo Response. rw has to implement +following method Unwrap() http.ResponseWriter

+
+
+

func WrapHandler(h http.Handler) HandlerFunc

+

Source: echo.go:848

+

WrapHandler wraps http.Handler into echo.HandlerFunc.

+
+
+

func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc

+

Source: echo.go:862

+

WrapMiddleware wraps func(http.Handler) http.Handler into echo.MiddlewareFunc

+
+

Types

+
+

type AddRouteError

+

Source: router.go:489

+

AddRouteError is error returned by Router.Add containing information what actual route adding failed. Useful for +mass adding (i.e. Any() routes)

+
+
+ +
+
type AddRouteError struct {
+	Err    error
+	Method string
+	Path   string
+}
+
+
Fields
  • Err error
  • Method string
  • Path string
+
+

func Error) Error() string

+

Source: router.go:495

+
+
+

func Unwrap() error

+

Source: router.go:497

+
+
+
+

type BindUnmarshaler

+

Source: bind.go:31

+

BindUnmarshaler is the interface used to wrap the UnmarshalParam method. +Types that don't implement this, but do implement encoding.TextUnmarshaler +will use that interface instead.

+
+
+ +
+
type BindUnmarshaler interface {
+	// UnmarshalParam decodes and assigns a value from an form or query param.
+	UnmarshalParam(param string) error
+}
+
+
Methods
  • UnmarshalParam func(param string) error

    UnmarshalParam decodes and assigns a value from an form or query param.

+
+
+

type Binder

+

Source: bind.go:21

+

Binder is the interface that wraps the Bind method.

+
+
+ +
+
type Binder interface {
+	Bind(c *Context, target any) error
+}
+
+
Methods
  • Bind func(c *Context, target any) error
+
+
+

type BindingError

+

Source: binder.go:72

+

BindingError represents an error that occurred while binding request data.

+

Note: JSON serialization is handled by the MarshalJSON method below, not by the +struct tags (which are kept for documentation). MarshalJSON emits {"field","message"}.

+
+
+ +
+
type BindingError struct {
+	// Field is the field name where value binding failed
+	Field string `json:"field"`
+	*HTTPError
+	// Values of parameter that failed to bind.
+	Values []string `json:"-"`
+}
+
+
Fields
  • Field string `json:"field"`

    Field is the field name where value binding failed

  • *HTTPError
  • Values []string `json:"-"`

    Values of parameter that failed to bind.

+
+

func Error) Error() string

+

Source: binder.go:90

+

Error returns error message

+
+
+

func MarshalJSON() ([]byte, error)

+

Source: binder.go:98

+

MarshalJSON implements json.Marshaler so that binding errors are serialized into +a structured response (e.g. {"field":"id","message":"..."}) rather than being +flattened to a generic message. DefaultHTTPErrorHandler routes errors that +implement json.Marshaler through their own encoding.

+
+
+
+

type Config

+

Source: echo.go:255

+

Config is configuration for NewWithConfig function

+
+
+ +
+
type Config struct {
+	// Logger is the slog logger instance used for application-wide structured logging.
+	// If not set, a default TextHandler writing to stdout is created.
+	Logger *slog.Logger
+
+	// HTTPErrorHandler is the centralized error handler that processes errors returned
+	// by handlers and middleware, converting them to appropriate HTTP responses.
+	// If not set, DefaultHTTPErrorHandler(false) is used.
+	HTTPErrorHandler HTTPErrorHandler
+
+	// Router is the HTTP request router responsible for matching URLs to handlers
+	// using a radix tree-based algorithm.
+	// If not set, NewRouter(RouterConfig{}) is used.
+	Router Router
+
+	// OnAddRoute is an optional callback hook executed when routes are registered.
+	// Useful for route validation, logging, or custom route processing.
+	// If not set, no callback is executed.
+	OnAddRoute func(route Route) error
+
+	// Filesystem is the fs.FS implementation used for serving static files.
+	// Supports os.DirFS, embed.FS, and custom implementations.
+	// If not set, defaults to current working directory.
+	Filesystem fs.FS
+
+	// Binder handles automatic data binding from HTTP requests to Go structs.
+	// Supports JSON, XML, form data, query parameters, and path parameters.
+	// If not set, DefaultBinder is used.
+	Binder Binder
+
+	// Validator provides optional struct validation after data binding.
+	// Commonly used with third-party validation libraries.
+	// If not set, Context.Validate() returns ErrValidatorNotRegistered.
+	Validator Validator
+
+	// Renderer provides template rendering for generating HTML responses.
+	// Requires integration with a template engine like html/template.
+	// If not set, Context.Render() returns ErrRendererNotRegistered.
+	Renderer Renderer
+
+	// JSONSerializer handles JSON encoding and decoding for HTTP requests/responses.
+	// Can be replaced with faster alternatives like jsoniter or sonic.
+	// If not set, DefaultJSONSerializer using encoding/json is used.
+	JSONSerializer JSONSerializer
+
+	// IPExtractor defines the strategy for extracting the real client IP address
+	// from requests, particularly important when behind proxies or load balancers.
+	// Used for rate limiting, access control, and logging.
+	// If not set, falls back to checking X-Forwarded-For and X-Real-IP headers.
+	IPExtractor IPExtractor
+
+	// FormParseMaxMemory is default value for memory limit that is used
+	// when parsing multipart forms (See (*http.Request).ParseMultipartForm)
+	FormParseMaxMemory int64
+
+	// EnablePathUnescapingStaticFiles enables path parameter (param: *) unescaping for static file methods.
+	// Default false (safe): encoded slashes (%2f) in the wildcard param are NOT decoded,
+	// preventing ACL bypass where /admin%2fprivate.txt bypasses a /admin/* route guard by
+	// not matching that route but having its wildcard param decoded to admin/private.txt.
+	// Set to true only when serving files whose names contain URL-encoded characters
+	// (e.g. "hello world.txt" via /hello%20world.txt) and you are not relying on
+	// route-based ACL guards to restrict access.
+	// If you are enabling this option, make sure you understand the security implications.
+	// See: https://github.com/labstack/echo/security/advisories/GHSA-vfp3-v2gw-7wfq
+	//
+	// Enabling RouterConfig.UseEscapedPathForMatching makes this field irrelevant and can lead to security issues when
+	// using different Routes to exclude some of the files from being served.
+	// e.g. if you serve files from directory as such and use different route to exclude some of the files from being served.
+	// 0. given folder structure:
+	//   public/
+	//   public/index.html
+	//   public/admin/private.txt
+	// 1. share `public/` folder contents from the server root with `e.Static("/", "public")`
+	// 2. naively assume that everything under /admin folder is now forbidden
+	//       e.GET("/admin/*", func(c *Context) error { return echo.ErrForbidden })
+	// Then request to `/assets/../admin%2fprivate.txt` will be served as router does not match it to guarded route.
+	//
+	// Applies to methods: Echo.Static, Echo.StaticFS, Group.Static, Group.StaticFS.
+	EnablePathUnescapingStaticFiles bool
+
+	// NoGroupAutoRegister404Routes bool is a flag that indicates whether echo.Group should NOT register 404 routes automatically
+	// when there are middlewares registered with the group.
+	// Note: if you decide not to register 404 routes automatically, make sure to check if all your middlewares are executed
+	// as expected. For example - CORS middleware.
+	NoGroupAutoRegister404Routes bool
+}
+
+
Fields
  • Logger *slog.Logger

    Logger is the slog logger instance used for application-wide structured logging. +If not set, a default TextHandler writing to stdout is created.

  • HTTPErrorHandler HTTPErrorHandler

    HTTPErrorHandler is the centralized error handler that processes errors returned +by handlers and middleware, converting them to appropriate HTTP responses. +If not set, DefaultHTTPErrorHandler(false) is used.

  • Router Router

    Router is the HTTP request router responsible for matching URLs to handlers +using a radix tree-based algorithm. +If not set, NewRouter(RouterConfig{}) is used.

  • OnAddRoute func(route Route) error

    OnAddRoute is an optional callback hook executed when routes are registered. +Useful for route validation, logging, or custom route processing. +If not set, no callback is executed.

  • Filesystem fs.FS

    Filesystem is the fs.FS implementation used for serving static files. +Supports os.DirFS, embed.FS, and custom implementations. +If not set, defaults to current working directory.

  • Binder Binder

    Binder handles automatic data binding from HTTP requests to Go structs. +Supports JSON, XML, form data, query parameters, and path parameters. +If not set, DefaultBinder is used.

  • Validator Validator

    Validator provides optional struct validation after data binding. +Commonly used with third-party validation libraries. +If not set, Context.Validate() returns ErrValidatorNotRegistered.

  • Renderer Renderer

    Renderer provides template rendering for generating HTML responses. +Requires integration with a template engine like html/template. +If not set, Context.Render() returns ErrRendererNotRegistered.

  • JSONSerializer JSONSerializer

    JSONSerializer handles JSON encoding and decoding for HTTP requests/responses. +Can be replaced with faster alternatives like jsoniter or sonic. +If not set, DefaultJSONSerializer using encoding/json is used.

  • IPExtractor IPExtractor

    IPExtractor defines the strategy for extracting the real client IP address +from requests, particularly important when behind proxies or load balancers. +Used for rate limiting, access control, and logging. +If not set, falls back to checking X-Forwarded-For and X-Real-IP headers.

  • FormParseMaxMemory int64

    FormParseMaxMemory is default value for memory limit that is used +when parsing multipart forms (See (*http.Request).ParseMultipartForm)

  • EnablePathUnescapingStaticFiles bool

    EnablePathUnescapingStaticFiles enables path parameter (param: ) unescaping for static file methods. +Default false (safe): encoded slashes (%2f) in the wildcard param are NOT decoded, +preventing ACL bypass where /admin%2fprivate.txt bypasses a /admin/ route guard by +not matching that route but having its wildcard param decoded to admin/private.txt. +Set to true only when serving files whose names contain URL-encoded characters +(e.g. "hello world.txt" via /hello%20world.txt) and you are not relying on +route-based ACL guards to restrict access. +If you are enabling this option, make sure you understand the security implications. +See: https://github.com/labstack/echo/security/advisories/GHSA-vfp3-v2gw-7wfq

    +

    Enabling RouterConfig.UseEscapedPathForMatching makes this field irrelevant and can lead to security issues when +using different Routes to exclude some of the files from being served. +e.g. if you serve files from directory as such and use different route to exclude some of the files from being served. +0. given folder structure: + public/ + public/index.html + public/admin/private.txt

    +
      +
    1. share public/ folder contents from the server root with e.Static("/", "public")
    2. +
    3. naively assume that everything under /admin folder is now forbidden + e.GET("/admin/*", func(c *Context) error { return echo.ErrForbidden }) +Then request to /assets/../admin%2fprivate.txt will be served as router does not match it to guarded route.
    4. +
    +

    Applies to methods: Echo.Static, Echo.StaticFS, Group.Static, Group.StaticFS.

  • NoGroupAutoRegister404Routes bool

    NoGroupAutoRegister404Routes bool is a flag that indicates whether echo.Group should NOT register 404 routes automatically +when there are middlewares registered with the group. +Note: if you decide not to register 404 routes automatically, make sure to check if all your middlewares are executed +as expected. For example - CORS middleware.

+
+
+

type Context

+

Source: context.go:64

+

Context represents the context of the current HTTP request. It holds request and +response objects, path, path parameters, data and registered handler.

+
+
+ +
+
type Context struct {
+	// contains filtered or unexported fields
+}
+
+
+

func Attachment(file, name string) error

+

Source: context.go:706

+

Attachment sends a response as attachment, prompting client to save the file.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func Bind(i any) error

+

Source: context.go:478

+

Bind binds path params, query params and the request body into provided type i. The default binder +binds body based on Content-Type header.

+
+
+

func Blob(code int, contentType string, b []byte) (err error)

+

Source: context.go:642

+

Blob sends a blob response with status code and content type.

+
+ +
+

func Cookies() []*http.Cookie

+

Source: context.go:452

+

Cookies returns the HTTP cookies sent with the request.

+
+
+

func Echo() *Echo

+

Source: context.go:755

+

Echo returns the Echo instance.

+
+
+

func File(file string) error

+

Source: context.go:661

+

File sends a response with the content of the file.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func FileFS(file string, filesystem fs.FS) error

+

Source: context.go:670

+

FileFS serves file from given file system.

+

When dealing with embed.FS use fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary prefix for directory path. This is necessary as //go:embed assets/imagesembeds files with paths includingassets/images` as their prefix.

+
+
+

func FormFile(name string) (*multipart.FileHeader, error)

+

Source: context.go:426

+

FormFile returns the multipart form file for the provided name.

+
+
+

func FormValue(name string) string

+

Source: context.go:397

+

FormValue returns the form field value for the provided name.

+
+
+

func FormValueOr(name, defaultValue string) string

+

Source: context.go:403

+

FormValueOr returns the form field value or default value for the provided name. +Note: FormValueOr does not distinguish if form had no value by that name or value was empty string

+
+
+

func FormValues() (url.Values, error)

+

Source: context.go:412

+

FormValues returns the form field values as url.Values.

+
+
+

func Get(key string) any

+

Source: context.go:458

+

Get retrieves data from the context. +Method returns any(nil) when key does not exist which is different from typed nil (eg. []byte(nil)).

+
+
+

func HTML(code int, html string) (err error)

+

Source: context.go:514

+

HTML sends an HTTP response with status code.

+
+
+

func HTMLBlob(code int, b []byte) (err error)

+

Source: context.go:519

+

HTMLBlob sends an HTTP blob response with status code.

+
+
+

func InitializeRoute(ri *RouteInfo, pathValues *PathValues)

+

Source: context.go:313

+

InitializeRoute sets the route related variables of this request to the context.

+
+
+

func Inline(file, name string) error

+

Source: context.go:714

+

Inline sends a response as inline, opening the file in the browser.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func IsTLS() bool

+

Source: context.go:188

+

IsTLS returns true if HTTP connection is TLS otherwise false.

+
+
+

func IsWebSocket() bool

+

Source: context.go:193

+

IsWebSocket returns true if HTTP connection is WebSocket otherwise false.

+
+
+

func JSON(code int, i any) (err error)

+

Source: context.go:569

+

JSON sends a JSON response with status code.

+
+
+

func JSONBlob(code int, b []byte) (err error)

+

Source: context.go:579

+

JSONBlob sends a JSON blob response with status code.

+
+
+

func JSONP(code int, callback string, i any) (err error)

+

Source: context.go:585

+

JSONP sends a JSONP response with status code. It uses callback to construct +the JSONP payload.

+
+
+

func JSONPBlob(code int, callback string, b []byte) (err error)

+

Source: context.go:591

+

JSONPBlob sends a JSONP blob response with status code. It uses callback +to construct the JSONP payload.

+
+
+

func JSONPretty(code int, i any, indent string) (err error)

+

Source: context.go:574

+

JSONPretty sends a pretty-print JSON with status code.

+
+
+

func Logger() *slog.Logger

+

Source: context.go:742

+

Logger returns logger in Context

+
+
+

func MultipartForm() (*multipart.Form, error)

+

Source: context.go:436

+

MultipartForm returns the multipart form.

+
+
+

func NoContent(code int) error

+

Source: context.go:726

+

NoContent sends a response with no body and a status code.

+
+
+

func Param(name string) string

+

Source: context.go:283

+

Param returns path parameter by name.

+
+
+

func ParamOr(name, defaultValue string) string

+

Source: context.go:295

+

ParamOr returns the path parameter or default value for the provided name.

+

Notes for DefaultRouter implementation: +Path parameter could be empty for cases like that:

+
    +
  • route /release-:version/bin and request URL is /release-/bin
  • +
  • route /api/:version/image.jpg and request URL is /api//image.jpg +but not when path parameter is last part of route path
  • +
  • route /download/file.:ext will not match request /download/file.
  • +
+
+
+

func Path() string

+

Source: context.go:260

+

Path returns the registered path for the handler.

+
+
+

func PathValues() PathValues

+

Source: context.go:300

+

PathValues returns path parameter values.

+
+
+

func QueryParam(name string) string

+

Source: context.go:337

+

QueryParam returns the query param for the provided name.

+
+
+

func QueryParamOr(name, defaultValue string) string

+

Source: context.go:375

+

QueryParamOr returns the query param or default value for the provided name. +Note: QueryParamOr does not distinguish if query had no value by that name or value was empty string +This means URLs /test?search= and /test would both return 1 for c.QueryParamOr("search", "1")

+
+
+

func QueryParams() url.Values

+

Source: context.go:384

+

QueryParams returns the query parameters as url.Values.

+
+
+

func QueryString() string

+

Source: context.go:392

+

QueryString returns the URL query string.

+
+
+

func RealIP() string

+

Source: context.go:249

+

RealIP returns the client IP address using the configured extraction strategy.

+

If Echo#IPExtractor is set, it is used to resolve the client IP from the incoming request (typically via proxy +headers such as X-Forwarded-For or X-Real-IP). +Look into the ip.go file for comments and examples.

+

See:

+
    +
  • Echo#ExtractIPFromXFFHeader for X-Forwarded-For handling with trust checks
  • +
  • Echo#ExtractIPFromRealIPHeader for X-Real-IP handling with trust checks
  • +
  • Echo#LegacyIPExtractor for v4 compatibility (spoofable, no trust checks built in)
  • +
+

If no extractor is configured, RealIP falls back to the request RemoteAddr, returning only the host portion.

+

Notes:

+
    +
  • No validation or trust enforcement is performed unless implemented by the configured IPExtractor.
  • +
  • When relying on proxy headers, ensure the application is deployed behind trusted intermediaries to avoid spoofing.
  • +
+
+
+

func Redirect(code int, url string) error

+

Source: context.go:732

+

Redirect redirects the request to a provided URL with status code.

+
+
+

func Render(code int, name string, data any) (err error)

+

Source: context.go:493

+

Render renders a template with data and sends a text/html response with status +code. Renderer must be registered using Echo.Renderer.

+
+
+

func Request() *http.Request

+

Source: context.go:167

+

Request returns *http.Request.

+
+
+

func Reset(r *http.Request, w http.ResponseWriter)

+

Source: context.go:141

+

Reset resets the context after request completes. It must be called along +with Echo#AcquireContext() and Echo#ReleaseContext(). +See Echo#ServeHTTP()

+
+
+

func Response() http.ResponseWriter

+

Source: context.go:177

+

Response returns *Response.

+
+
+

func RouteInfo() RouteInfo

+

Source: context.go:275

+

RouteInfo returns current request route information. Method, Path, Name and params if they exist for matched route.

+

RouteInfo returns generic "empty" struct for these cases:

+
    +
  • Context is accessed before Routing is done. For example inside Pre middlewares (e.Pre())
  • +
  • Router did not find matching route - 404 (route not found)
  • +
  • Router did not find matching route with same method - 405 (method not allowed)
  • +
+
+
+

func Scheme() string

+

Source: context.go:212

+

Scheme returns the HTTP protocol scheme, http or https.

+
+
+

func Set(key string, val any)

+

Source: context.go:467

+

Set saves data in the context.

+
+
+

func SetCookie(cookie *http.Cookie)

+

Source: context.go:447

+

SetCookie adds a Set-Cookie header in HTTP response.

+
+
+

func SetLogger(logger *slog.Logger)

+

Source: context.go:750

+

SetLogger sets logger in Context

+
+
+

func SetPath(p string)

+

Source: context.go:265

+

SetPath sets the registered path for the handler.

+
+
+

func SetPathValues(pathValues PathValues)

+

Source: context.go:305

+

SetPathValues sets path parameters for current request.

+
+
+

func SetRequest(r *http.Request)

+

Source: context.go:172

+

SetRequest sets *http.Request.

+
+
+

func SetResponse(r http.ResponseWriter)

+

Source: context.go:183

+

SetResponse sets *http.ResponseWriter. Some context methods and/or middleware require that given ResponseWriter implements following +method Unwrap() http.ResponseWriter which eventually should return *echo.Response instance.

+
+
+

func Stream(code int, contentType string, r io.Reader) (err error)

+

Source: context.go:650

+

Stream sends a streaming response with status code and content type.

+
+
+

func String(code int, s string) (err error)

+

Source: context.go:524

+

String sends a string response with status code.

+
+
+

func Validate(i any) error

+

Source: context.go:484

+

Validate validates provided i. It is usually called after Context#Bind(). +Validator must be registered using Echo#Validator.

+
+
+

func XML(code int, i any) (err error)

+

Source: context.go:621

+

XML sends an XML response with status code.

+
+
+

func XMLBlob(code int, b []byte) (err error)

+

Source: context.go:631

+

XMLBlob sends an XML blob response with status code.

+
+
+

func XMLPretty(code int, i any, indent string) (err error)

+

Source: context.go:626

+

XMLPretty sends a pretty-print XML with status code.

+
+
+
+

type DefaultBinder

+

Source: bind.go:26

+

DefaultBinder is the default implementation of the Binder interface.

+
+
+ +
+
type DefaultBinder struct{}
+
+
+

func Binder) Bind(c *Context, target any) error

+

Source: bind.go:124

+

Bind implements the Binder#Bind function. +Binding is done in following order: 1) path params; 2) query params; 3) request body. Each step COULD override previous +step bound values. For single source binding use their own methods BindBody, BindQueryParams, BindPathValues.

+
+
+
+

type DefaultJSONSerializer

+

Source: json.go:13

+

DefaultJSONSerializer implements JSON encoding using encoding/json.

+
+
+ +
+
type DefaultJSONSerializer struct{}
+
+
+

func Deserialize(c *Context, target any) error

+

Source: json.go:47

+

Deserialize reads a JSON from a request body and converts it into an interface.

+

The body is read into a pooled buffer and decoded with json.Unmarshal rather +than streaming through json.NewDecoder. This avoids allocating a decoder and +its internal read buffer on every request. json.Unmarshal does not retain a +reference to the input slice, so the buffer is safe to reuse afterwards.

+

Note: the full request body is read into memory before decoding. As with any +JSON parser, decoding untrusted input can allocate large amounts of memory; +guard such endpoints with middleware.BodyLimit (or http.MaxBytesReader), +which makes the body read here fail fast once the limit is exceeded.

+
+
+

func Serializer) Serialize(c *Context, target any, indent string) error

+

Source: json.go:28

+

Serialize converts an interface into a json and writes it to the response. +You can optionally use the indent parameter to produce pretty JSONs.

+
+
+
+

type DefaultRouter

+

Source: router.go:60

+

DefaultRouter is the registry of all registered routes for an Echo instance for +request matching and URL path parameter parsing. +Note: DefaultRouter is not coroutine-safe. Do not Add/Remove routes after HTTP server has been started with Echo.

+
+
+ +
+
type DefaultRouter struct {
+	// contains filtered or unexported fields
+}
+
+
+

func Add(route Route) (RouteInfo, error)

+

Source: router.go:508

+

Add registers a new route for method and path with matching handler.

+
+
+

func Remove(method string, path string) error

+

Source: router.go:384

+

Remove unregisters registered route

+
+
+

func Router) Route(c *Context) HandlerFunc

+

Source: router.go:884

+

Route looks up a handler registered for method and path. It also parses URL for path parameters and loads them +into context.

+

For performance:

+
    +
  • Get context from Echo#AcquireContext()
  • +
  • Reset it Context#Reset()
  • +
  • Return it Echo#ReleaseContext().
  • +
+
+
+

func Routes() Routes

+

Source: router.go:379

+

Routes returns all registered routes

+
+
+
+

type Echo

+

Source: echo.go:69

+

Echo is the top-level framework instance.

+

Goroutine safety: Do not mutate Echo instance fields after server has started. Accessing these +fields from handlers/middlewares and changing field values at the same time leads to data-races. +Same rule applies to adding new routes after server has been started - Adding a route is not Goroutine safe action.

+
+
+ +
+
type Echo struct {
+	Binder Binder
+
+	// Filesystem is the file system used for serving static files. Defaults to the current working directory (os.Getwd()).
+	//
+	// Note: fs.FS.Open() already assumes that file names are relative to FS root path and considers name with prefix `/` as invalid
+	// so if you have `fs := os.DirFS("/tmp")` and you try to `fs.Open("/tmp/file.txt")` it will fail, but "file.txt"
+	// would succeed. `echo.NewDefaultFS("/tmp")` overwrites this behavior and allows you to use Open with a matching
+	// absolute path prefix.
+	Filesystem fs.FS
+
+	Renderer         Renderer
+	Validator        Validator
+	JSONSerializer   JSONSerializer
+	IPExtractor      IPExtractor
+	OnAddRoute       func(route Route) error
+	HTTPErrorHandler HTTPErrorHandler
+	Logger           *slog.Logger
+	// contains filtered or unexported fields
+}
+
+
Fields
  • Binder Binder
  • Filesystem fs.FS

    Filesystem is the file system used for serving static files. Defaults to the current working directory (os.Getwd()).

    +

    Note: fs.FS.Open() already assumes that file names are relative to FS root path and considers name with prefix / as invalid +so if you have fs := os.DirFS("/tmp") and you try to fs.Open("/tmp/file.txt") it will fail, but "file.txt" +would succeed. echo.NewDefaultFS("/tmp") overwrites this behavior and allows you to use Open with a matching +absolute path prefix.

  • Renderer Renderer
  • Validator Validator
  • JSONSerializer JSONSerializer
  • IPExtractor IPExtractor
  • OnAddRoute func(route Route) error
  • HTTPErrorHandler HTTPErrorHandler
  • Logger *slog.Logger
+
+

func AcquireContext() *Context

+

Source: echo.go:782

+

AcquireContext returns an empty Context instance from the pool. +You must return the context by calling ReleaseContext().

+
+
+

func Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo

+

Source: echo.go:736

+

Add registers a new route for an HTTP method and path with matching handler +in the router with optional route-level middleware.

+
+
+

func AddRoute(route Route) (RouteInfo, error)

+

Source: echo.go:711

+

AddRoute registers a new Route with default host Router

+
+
+

func Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo

+

Source: echo.go:586

+

Any registers a new route for all HTTP methods (supported by Echo) and path with matching handler +in the router with optional route-level middleware.

+

Note: this method only adds specific set of supported HTTP methods as handler and is not true +"catch-any-arbitrary-method" way of matching requests.

+
+
+

func CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:513

+

CONNECT registers a new CONNECT route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:519

+

DELETE registers a new DELETE route for a path with matching handler in the router +with optional route-level middleware. Panics on error.

+
+
+

func File(path, file string, middleware ...MiddlewareFunc) RouteInfo

+

Source: echo.go:703

+

File registers a new route with path to serve a static file with optional route-level middleware. Panics on error.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func FileFS(path, file string, filesystem fs.FS, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:685

+

FileFS registers a new route with path to serve file from the provided file system.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func GET(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:525

+

GET registers a new GET route for a path with matching handler in the router +with optional route-level middleware. Panics on error.

+
+
+

func Group(prefix string, m ...MiddlewareFunc) (g *Group)

+

Source: echo.go:753

+

Group creates a new router group with prefix and optional group-level middleware.

+
+
+

func HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:531

+

HEAD registers a new HEAD route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) Routes

+

Source: echo.go:592

+

Match registers a new route for multiple HTTP methods and path with matching +handler in the router with optional route-level middleware. Panics on error.

+
+
+

func Middlewares() []MiddlewareFunc

+

Source: echo.go:776

+

Middlewares returns registered route level middlewares. Does not contain any group level +middlewares. Use this method to build your own ServeHTTP method.

+

NOTE: returned slice is not a copy. Do not mutate.

+
+
+

func NewContext(r *http.Request, w http.ResponseWriter) *Context

+

Source: echo.go:431

+

NewContext returns a new Context instance.

+

Note: both request and response can be left to nil as Echo.ServeHTTP will call c.Reset(req,resp) anyway +these arguments are useful when creating context for tests and cases like that.

+
+
+

func OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:537

+

OPTIONS registers a new OPTIONS route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:543

+

PATCH registers a new PATCH route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func POST(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:549

+

POST registers a new POST route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func PUT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:555

+

PUT registers a new PUT route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func Pre(middleware ...MiddlewareFunc)

+

Source: echo.go:500

+

Pre adds middleware to the chain which is run before router tries to find matching route. +Meaning middleware is executed even for 404 (not found) cases.

+
+
+

func PreMiddlewares() []MiddlewareFunc

+

Source: echo.go:768

+

PreMiddlewares returns registered pre middlewares. These are middleware to the chain +which are run before router tries to find matching route. +Use this method to build your own ServeHTTP method.

+

NOTE: returned slice is not a copy. Do not mutate.

+
+
+

func QUERY(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:561

+

QUERY registers a new QUERY route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func ReleaseContext(c *Context)

+

Source: echo.go:788

+

ReleaseContext returns the Context instance back to the pool. +You must call it after AcquireContext().

+
+
+

func RouteNotFound(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:577

+

RouteNotFound registers a special-case route which is executed when no other route is found (i.e. HTTP 404 cases) +for current request URL. +Path supports static and named/any parameters just like other http method is defined. Generally path is ended with +wildcard/match-any character (/*, /download/* etc).

+

Example: e.RouteNotFound("/*", func(c *echo.Context) error { return c.NoContent(http.StatusNotFound) })

+
+
+

func Router() Router

+

Source: echo.go:436

+

Router returns the default router.

+
+
+

func ServeHTTP(w http.ResponseWriter, r *http.Request)

+

Source: echo.go:793

+

ServeHTTP implements http.Handler interface, which serves HTTP requests.

+
+
+

func Start(address string) error

+

Source: echo.go:840

+

Start stars HTTP server on given address with Echo as a handler serving requests. The server can be shutdown by +sending os.Interrupt signal with ctrl+c. Method returns only errors that are not http.ErrServerClosed.

+

Note: this method is created for use in examples/demos and is deliberately simple without providing configuration +options.

+

In need of customization use:

+
+
+ +
+
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
+defer cancel()
+sc := echo.StartConfig{Address: ":8080"}
+if err := sc.Start(ctx, e); err != nil && !errors.Is(err, http.ErrServerClosed) {
+	slog.Error(err.Error())
+}
+

// or standard library http.Server

+
+
+ +
+
s := http.Server{Addr: ":8080", Handler: e}
+if err := s.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
+	slog.Error(err.Error())
+}
+
+
+
+

func Static(pathPrefix, fsRoot string, middleware ...MiddlewareFunc) RouteInfo

+

Source: echo.go:615

+

Static registers a new route with path prefix to serve static files from the provided root directory.

+
+
+

func StaticFS(pathPrefix string, filesystem fs.FS, middleware ...MiddlewareFunc) RouteInfo

+

Source: echo.go:630

+

StaticFS registers a new route with path prefix to serve static files from the provided file system.

+

When dealing with embed.FS use fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary prefix for directory path. This is necessary as //go:embed assets/imagesembeds files with paths includingassets/images` as their prefix.

+
+
+

func TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: echo.go:567

+

TRACE registers a new TRACE route for a path with matching handler in the +router with optional route-level middleware. Panics on error.

+
+
+

func Use(middleware ...MiddlewareFunc)

+

Source: echo.go:506

+

Use adds middleware to the chain which is run after router has found matching route and before route/request handler method is executed.

+
+
+
+

type Group

+

Source: group.go:14

+

Group is a set of sub-routes for a specified route. It can be used for inner +routes that share a common middleware or functionality that should be separate +from the parent echo instance while still inheriting from it.

+
+
+ +
+
type Group struct {
+	// contains filtered or unexported fields
+}
+
+
+

func Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo

+

Source: group.go:186

+

Add implements Echo#Add() for sub-routes within the Group. Panics on error.

+
+
+

func AddRoute(route Route) (RouteInfo, error)

+

Source: group.go:200

+

AddRoute registers a new Routable with Router

+
+
+

func Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo

+

Source: group.go:99

+

Any implements Echo#Any() for sub-routes within the Group. Panics on error.

+
+
+

func CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:49

+

CONNECT implements Echo#CONNECT() for sub-routes within the Group. Panics on error.

+
+
+

func DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:54

+

DELETE implements Echo#DELETE() for sub-routes within the Group. Panics on error.

+
+
+

func File(path, file string, middleware ...MiddlewareFunc) RouteInfo

+

Source: group.go:171

+

File implements Echo#File() for sub-routes within the Group. Panics on error.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func FileFS(path, file string, filesystem fs.FS, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:163

+

FileFS implements Echo#FileFS() for sub-routes within the Group.

+

Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for +file operations.

+
+
+

func GET(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:59

+

GET implements Echo#GET() for sub-routes within the Group. Panics on error.

+
+
+

func Group) Group(prefix string, middleware ...MiddlewareFunc) (sg *Group)

+

Source: group.go:131

+

Group creates a new sub-group with prefix and optional sub-group-level middleware.

+

Important! Group middlewares are executed in case there was no exact route match as by default Group registers +/* NotFound routes for itself. If this kind of behavior is not needed, then create an Echo instance with the noAutoRegisterRoutes +flag set to true. Example echo.NewWithConfig(echo.Config{NoGroupAutoRegister404Routes: true}).

+
+
+

func HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:64

+

HEAD implements Echo#HEAD() for sub-routes within the Group. Panics on error.

+
+
+

func Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) Routes

+

Source: group.go:104

+

Match implements Echo#Match() for sub-routes within the Group. Panics on error.

+
+
+

func OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:69

+

OPTIONS implements Echo#OPTIONS() for sub-routes within the Group. Panics on error.

+
+
+

func PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:74

+

PATCH implements Echo#PATCH() for sub-routes within the Group. Panics on error.

+
+
+

func POST(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:79

+

POST implements Echo#POST() for sub-routes within the Group. Panics on error.

+
+
+

func PUT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:84

+

PUT implements Echo#PUT() for sub-routes within the Group. Panics on error.

+
+
+

func QUERY(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:89

+

QUERY implements Echo#QUERY() for sub-routes within the Group. Panics on error.

+
+
+

func RouteNotFound(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:181

+

RouteNotFound implements Echo#RouteNotFound() for sub-routes within the Group.

+

Example: g.RouteNotFound("/*", func(c *echo.Context) error { return c.NoContent(http.StatusNotFound) })

+
+
+

func Static(pathPrefix, fsRoot string, middleware ...MiddlewareFunc) RouteInfo

+

Source: group.go:140

+

Static implements Echo#Static() for sub-routes within the Group.

+
+
+

func StaticFS(pathPrefix string, filesystem fs.FS, middleware ...MiddlewareFunc) RouteInfo

+

Source: group.go:150

+

StaticFS implements Echo#StaticFS() for sub-routes within the Group.

+

When dealing with embed.FS use fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary prefix for directory path. This is necessary as //go:embed assets/imagesembeds files with paths includingassets/images` as their prefix.

+
+
+

func TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo

+

Source: group.go:94

+

TRACE implements Echo#TRACE() for sub-routes within the Group. Panics on error.

+
+
+

func Use(middleware ...MiddlewareFunc)

+

Source: group.go:31

+

Use implements Echo#Use() for sub-routes within the Group.

+

Important! Group middlewares are executed in case there was no exact route match as by default Group registers +/* NotFound routes for itself. If this kind of behavior is not needed, then create an Echo instance with the noAutoRegisterRoutes +flag set to true. Example echo.NewWithConfig(echo.Config{NoGroupAutoRegister404Routes: true}).

+
+
+
+

type HTTPError

+

Source: httperror.go:107

+

HTTPError represents an error that occurred while handling a request.

+
+
+ +
+
type HTTPError struct {
+	// Code is status code for HTTP response
+	Code    int    `json:"-"`
+	Message string `json:"message"`
+	// contains filtered or unexported fields
+}
+
+
Fields
  • Code int `json:"-"`

    Code is status code for HTTP response

  • Message string `json:"message"`
+
+

func Error) Error() string

+

Source: httperror.go:120

+

Error makes it compatible with the error interface.

+
+
+

func StatusCode() int

+

Source: httperror.go:115

+

StatusCode returns status code for HTTP response

+
+
+

func Unwrap() error

+

Source: httperror.go:140

+
+
+

func Wrap(err error) error

+

Source: httperror.go:132

+

Wrap returns a new HTTPError with given errors wrapped inside

+
+
+
+

type HTTPErrorHandler

+

Source: echo.go:127

+

HTTPErrorHandler is a centralized HTTP error handler.

+
+
+ +
+
type HTTPErrorHandler func(c *Context, err error)
+
+
+
+

type HTTPStatusCoder

+

Source: httperror.go:39

+

HTTPStatusCoder is an interface that errors can implement to produce status code for HTTP response

+
+
+ +
+
type HTTPStatusCoder interface {
+	StatusCode() int
+}
+
+
Methods
  • StatusCode func() int
+
+
+

type HandlerFunc

+

Source: echo.go:130

+

HandlerFunc defines a function to serve HTTP requests.

+
+
+ +
+
type HandlerFunc func(c *Context) error
+
+
+
+

type IPExtractor

+

Source: ip.go:203

+

IPExtractor is a function to extract IP addr from http.Request. +Set appropriate one to Echo#IPExtractor. +See https://echo.labstack.com/guide/ip-address for more details.

+
+
+ +
+
type IPExtractor func(*http.Request) string
+
+
+
+

type JSONSerializer

+

Source: echo.go:121

+

JSONSerializer is the interface that encodes and decodes JSON to and from interfaces.

+
+
+ +
+
type JSONSerializer interface {
+	Serialize(c *Context, target any, indent string) error
+	Deserialize(c *Context, target any) error
+}
+
+
Methods
  • Serialize func(c *Context, target any, indent string) error
  • Deserialize func(c *Context, target any) error
+
+
+

type MiddlewareConfigurator

+

Source: echo.go:136

+

MiddlewareConfigurator defines interface for creating middleware handlers with possibility to return configuration errors instead of panicking.

+
+
+ +
+
type MiddlewareConfigurator interface {
+	ToMiddleware() (MiddlewareFunc, error)
+}
+
+
Methods
  • ToMiddleware func() (MiddlewareFunc, error)
+
+
+

type MiddlewareFunc

+

Source: echo.go:133

+

MiddlewareFunc defines a function to process middleware.

+
+
+ +
+
type MiddlewareFunc func(next HandlerFunc) HandlerFunc
+
+
+
+

type PathValue

+

Source: router.go:1146

+

PathValue is tuple pf path parameter name and its value in request path

+
+
+ +
+
type PathValue struct {
+	Name  string
+	Value string
+}
+
+
Fields
  • Name string
  • Value string
+
+
+

type PathValues

+

Source: router.go:1143

+

PathValues is collections of PathValue instances with various helper methods

+
+
+ +
+
type PathValues []PathValue
+
+
+

func Get(name string) (string, bool)

+

Source: router.go:1152

+

Get returns path parameter value for given name or false.

+
+
+

func GetOr(name string, defaultValue string) string

+

Source: router.go:1162

+

GetOr returns path parameter value for given name or default value if the name does not exist.

+
+
+
+

type Renderer

+

Source: renderer.go:9

+

Renderer is the interface that wraps the Render function.

+
+
+ +
+
type Renderer interface {
+	Render(c *Context, w io.Writer, templateName string, data any) error
+}
+
+
Methods
  • Render func(c *Context, w io.Writer, templateName string, data any) error
+
+
+

type Response

+

Source: response.go:19

+

Response wraps an http.ResponseWriter and implements its interface to be used +by an HTTP handler to construct an HTTP response. +See: https://golang.org/pkg/net/http/#ResponseWriter

+
+
+ +
+
type Response struct {
+	http.ResponseWriter
+
+	Status    int
+	Size      int64
+	Committed bool
+	// contains filtered or unexported fields
+}
+
+
Fields
  • http.ResponseWriter
  • Status int
  • Size int64
  • Committed bool
+
+

func After(fn func())

+

Source: response.go:42

+

After registers a function which is called just after the response is written.

+
+
+

func Before(fn func())

+

Source: response.go:37

+

Before registers a function which is called just before the response (status) is written.

+
+
+

func Flush()

+

Source: response.go:82

+

Flush implements the http.Flusher interface to allow an HTTP handler to flush +buffered data to the client. +See http.Flusher

+
+
+

func Hijack() (net.Conn, *bufio.ReadWriter, error)

+

Source: response.go:93

+

Hijack implements the http.Hijacker interface to allow an HTTP handler to +take over the connection. +This method is relevant to Websocket connection upgrades, proxis, and other advanced use cases. +See http.Hijacker

+
+
+

func Unwrap() http.ResponseWriter

+

Source: response.go:106

+

Unwrap returns the original http.ResponseWriter. +ResponseController can be used to access the original http.ResponseWriter. +See [https://go.dev/blog/go1.20]

+
+
+

func Write(b []byte) (n int, err error)

+

Source: response.go:64

+

Write writes the data to the connection as part of an HTTP reply.

+
+
+

func WriteHeader(code int)

+

Source: response.go:50

+

WriteHeader sends an HTTP response header with status code. If WriteHeader is +not called explicitly, the first call to Write will trigger an implicit +WriteHeader(http.StatusOK). Thus explicit calls to WriteHeader are mainly +used to send error codes.

+
+
+
+

type Route

+

Source: route.go:16

+

Route contains information to adding/registering new route with the router. +Method+Path pair uniquely identifies the Route. It is mandatory to provide Method+Path fields.

+
+
+ +
+
type Route struct {
+	Method string
+	Path   string
+	Name   string
+
+	// HandlerFunc is a function that handles HTTP requests. This could be left nil when the Router implementation allows
+	// fallback to default/global handlers in certain situations.
+	Handler     HandlerFunc
+	Middlewares []MiddlewareFunc
+}
+
+
Fields
  • Method string
  • Path string
  • Name string
  • Handler HandlerFunc

    HandlerFunc is a function that handles HTTP requests. This could be left nil when the Router implementation allows +fallback to default/global handlers in certain situations.

  • Middlewares []MiddlewareFunc
+
+

func ToRouteInfo(params []string) RouteInfo

+

Source: route.go:28

+

ToRouteInfo converts Route to RouteInfo

+
+
+

func WithPrefix(pathPrefix string, middlewares []MiddlewareFunc) Route

+

Source: route.go:43

+

WithPrefix recreates Route with added group prefix and group middlewares it is grouped to.

+
+
+
+

type RouteInfo

+

Source: route.go:56

+

RouteInfo contains information about registered Route.

+
+
+ +
+
type RouteInfo struct {
+	Name       string
+	Method     string
+	Path       string
+	Parameters []string
+}
+
+
Fields
  • Name string
  • Method string
  • Path string
  • Parameters []string
+
+

func Clone() RouteInfo

+

Source: route.go:68

+

Clone creates copy of RouteInfo

+
+
+

func Reverse(pathValues ...any) string

+

Source: route.go:78

+

Reverse reverses route to URL string by replacing path parameters with given params values.

+
+
+
+

type Router

+

Source: router.go:21

+

Router is interface for routing request contexts to registered routes.

+

Contract between Echo/Context instance and the router:

+
    +
  • all routes must be added through methods on echo.Echo instance. +Reason: Echo instance uses RouteInfo.Params() length to allocate slice for paths parameters (see Echo.contextPathParamAllocSize).
  • +
  • Router must populate Context during Router.Route call with:
  • +
  • Context.InitializeRoute (IMPORTANT! to reduce allocations use same slice that c.PathValues() returns)
  • +
  • Optionally can set additional information to Context with Context.Set
  • +
+
+
+ +
+
type Router interface {
+	// Add registers Routable with the Router and returns registered RouteInfo.
+	//
+	// Router may change Route.Path value in returned RouteInfo.Path.
+	// Router generates RouteInfo.Parameters values from Route.Path.
+	// Router generates RouteInfo.Name value if it is not provided.
+	Add(routable Route) (RouteInfo, error)
+
+	// Remove removes route from the Router.
+	//
+	// Router may choose not to implement this method.
+	Remove(method string, path string) error
+
+	// Routes returns information about all registered routes
+	Routes() Routes
+
+	// Route searches Router for matching route and applies it to the given context. In case when no matching method
+	// was not found (405) or no matching route exists for path (404), router will return its implementation of 405/404
+	// handler function.
+	//
+	// Router must populate Context during Router.Route call with:
+	// - Context.InitializeRoute() (IMPORTANT! to reduce allocations use same slice that c.PathValues() returns)
+	// - optionally can set additional information to Context with Context.Set()
+	Route(c *Context) HandlerFunc
+}
+
+
Methods
  • Add func(routable Route) (RouteInfo, error)

    Add registers Routable with the Router and returns registered RouteInfo.

    +

    Router may change Route.Path value in returned RouteInfo.Path. +Router generates RouteInfo.Parameters values from Route.Path. +Router generates RouteInfo.Name value if it is not provided.

  • Remove func(method string, path string) error

    Remove removes route from the Router.

    +

    Router may choose not to implement this method.

  • Routes func() Routes

    Routes returns information about all registered routes

  • Route func(c *Context) HandlerFunc

    Route searches Router for matching route and applies it to the given context. In case when no matching method +was not found (405) or no matching route exists for path (404), router will return its implementation of 405/404 +handler function.

    +

    Router must populate Context during Router.Route call with:

    +
      +
    • Context.InitializeRoute() (IMPORTANT! to reduce allocations use same slice that c.PathValues() returns)
    • +
    • optionally can set additional information to Context with Context.Set()
    • +
+
+
+

type RouterConfig

+

Source: router.go:76

+

RouterConfig is configuration options for (default) router

+
+
+ +
+
type RouterConfig struct {
+	// NotFoundHandler is a handler that is executed when no route matches the request.
+	NotFoundHandler HandlerFunc
+
+	// MethodNotAllowedHandler is a handler that is executed when no route with exact METHOD matches the request but
+	// there is a route with same path but different method.
+	MethodNotAllowedHandler HandlerFunc
+
+	// OptionsMethodHandler is a handler that is executed when an OPTIONS request is made.
+	OptionsMethodHandler HandlerFunc
+
+	// AllowOverwritingRoute allows overwriting existing routes. If false, then adding a route with the same method
+	// and path will return an error.
+	AllowOverwritingRoute bool
+
+	// UnescapePathParamValues forces router to unescape path parameter values before setting them in context.
+	UnescapePathParamValues bool
+
+	// UseEscapedPathForMatching forces router to use an escaped path (req.URL.RawPath instead of req.URL.Path) for matching.
+	// Difference between URL.RawPath and URL.Path is:
+	//  * URL.Path is where request path is stored. Value is stored in decoded form: /%47%6f%2f becomes /Go/.
+	//  * URL.RawPath is an optional field which only gets set if the default encoding is different from Path.
+	UseEscapedPathForMatching bool
+
+	// AutoHandleHEAD enables automatic handling of HTTP HEAD requests by
+	// falling back to the corresponding GET route.
+	//
+	// When enabled, a HEAD request will match the same handler as GET for
+	// the route, but the response body is suppressed in accordance with
+	// HTTP semantics. Headers (e.g., Content-Length, Content-Type) are
+	// preserved as if a GET request was made.
+	//
+	// Security considerations: the GET handler is fully executed for every
+	// HEAD request, including all side effects:
+	//   - State-mutating operations (DB writes, audit logs, counters) run.
+	//   - Rate-limiting middleware consumes quota, enabling low-cost exhaustion.
+	//   - Expensive computations run with no response body returned to the
+	//     caller, making HEAD cheaper to abuse for DoS than GET.
+	//   - All GET routes become enumerable via HEAD probing (200 = route
+	//     exists, 405 = route absent).
+	//
+	// If route confidentiality/state-mutation is a concern, leave AutoHandleHEAD disabled
+	// and register explicit HEAD handlers only for routes that are safe to
+	// expose (e.g. e.HEAD("/public", handler)).
+	// You can leverage Echo.OnAddRoute callback to add HEAD routes explicitly from a single place.
+	//
+	// Disabled by default.
+	AutoHandleHEAD bool
+}
+
+
Fields
  • NotFoundHandler HandlerFunc

    NotFoundHandler is a handler that is executed when no route matches the request.

  • MethodNotAllowedHandler HandlerFunc

    MethodNotAllowedHandler is a handler that is executed when no route with exact METHOD matches the request but +there is a route with same path but different method.

  • OptionsMethodHandler HandlerFunc

    OptionsMethodHandler is a handler that is executed when an OPTIONS request is made.

  • AllowOverwritingRoute bool

    AllowOverwritingRoute allows overwriting existing routes. If false, then adding a route with the same method +and path will return an error.

  • UnescapePathParamValues bool

    UnescapePathParamValues forces router to unescape path parameter values before setting them in context.

  • UseEscapedPathForMatching bool

    UseEscapedPathForMatching forces router to use an escaped path (req.URL.RawPath instead of req.URL.Path) for matching. +Difference between URL.RawPath and URL.Path is:

    +
      +
    • URL.Path is where request path is stored. Value is stored in decoded form: /%47%6f%2f becomes /Go/.
    • +
    • URL.RawPath is an optional field which only gets set if the default encoding is different from Path.
    • +
  • AutoHandleHEAD bool

    AutoHandleHEAD enables automatic handling of HTTP HEAD requests by +falling back to the corresponding GET route.

    +

    When enabled, a HEAD request will match the same handler as GET for +the route, but the response body is suppressed in accordance with +HTTP semantics. Headers (e.g., Content-Length, Content-Type) are +preserved as if a GET request was made.

    +

    Security considerations: the GET handler is fully executed for every +HEAD request, including all side effects:

    +
      +
    • State-mutating operations (DB writes, audit logs, counters) run.
    • +
    • Rate-limiting middleware consumes quota, enabling low-cost exhaustion.
    • +
    • Expensive computations run with no response body returned to the +caller, making HEAD cheaper to abuse for DoS than GET.
    • +
    • All GET routes become enumerable via HEAD probing (200 = route +exists, 405 = route absent).
    • +
    +

    If route confidentiality/state-mutation is a concern, leave AutoHandleHEAD disabled +and register explicit HEAD handlers only for routes that are safe to +expose (e.g. e.HEAD("/public", handler)). +You can leverage Echo.OnAddRoute callback to add HEAD routes explicitly from a single place.

    +

    Disabled by default.

+
+
+

type Routes

+

Source: router.go:55

+

Routes is collection of RouteInfo instances with various helper methods.

+
+
+ +
+
type Routes []RouteInfo
+
+
+

func Clone() Routes

+

Source: route.go:111

+

Clone creates copy of Routes

+
+
+

func FilterByMethod(method string) (Routes, error)

+

Source: route.go:144

+

FilterByMethod searched for matching route info by method

+
+
+

func FilterByName(name string) (Routes, error)

+

Source: route.go:180

+

FilterByName searched for matching route info by name

+
+
+

func FilterByPath(path string) (Routes, error)

+

Source: route.go:162

+

FilterByPath searched for matching route info by path

+
+
+

func FindByMethodPath(method string, path string) (RouteInfo, error)

+

Source: route.go:130

+

FindByMethodPath searched for matching route info by method and path

+
+
+

func Reverse(routeName string, pathValues ...any) (string, error)

+

Source: route.go:120

+

Reverse reverses route to URL string by replacing path parameters with given params values.

+
+
+
+

type StartConfig

+

Source: server.go:26

+

StartConfig is for creating configured http.Server instance to start serve http(s) requests with given Echo instance

+
+
+ +
+
type StartConfig struct {
+	// Address specifies the address where listener will start listening on to serve HTTP(s) requests
+	Address string
+
+	// HideBanner instructs Start* method not to print banner when starting the Server.
+	HideBanner bool
+	// HidePort instructs Start* method not to print port when starting the Server.
+	HidePort bool
+
+	// CertFilesystem is filesystem is used to read `certFile` and `keyFile` when StartTLS method is called.
+	CertFilesystem fs.FS
+
+	// TLSConfig is used to configure TLS. If Listener is set, TLSConfig is not used to create the listener.
+	TLSConfig *tls.Config
+
+	// Listener is used to start server with the custom listener.
+	Listener net.Listener
+	// ListenerNetwork is used configure on which Network listener will use.
+	// If Listener is set, ListenerNetwork is not used.
+	ListenerNetwork string
+	// ListenerAddrFunc will be called after listener is created and started to listen for connections. This is useful in
+	// testing situations when server is started on random port `address = ":0"` in that case you can get actual port where
+	// listener is listening on.
+	ListenerAddrFunc func(addr net.Addr)
+
+	// GracefulTimeout is timeout value (defaults to 10sec) graceful shutdown will wait for server to handle ongoing requests
+	// before shutting down the server.
+	GracefulTimeout time.Duration
+	// OnShutdownError is called when graceful shutdown results an error. for example when listeners are not shut down within
+	// given timeout
+	OnShutdownError func(err error)
+
+	// BeforeServeFunc is callback that is called just before server starts to serve HTTP request.
+	// Use this callback when you want to configure http.Server different timeouts/limits/etc
+	BeforeServeFunc func(s *http.Server) error
+}
+
+
Fields
  • Address string

    Address specifies the address where listener will start listening on to serve HTTP(s) requests

  • HideBanner bool

    HideBanner instructs Start* method not to print banner when starting the Server.

  • HidePort bool

    HidePort instructs Start* method not to print port when starting the Server.

  • CertFilesystem fs.FS

    CertFilesystem is filesystem is used to read certFile and keyFile when StartTLS method is called.

  • TLSConfig *tls.Config

    TLSConfig is used to configure TLS. If Listener is set, TLSConfig is not used to create the listener.

  • Listener net.Listener

    Listener is used to start server with the custom listener.

  • ListenerNetwork string

    ListenerNetwork is used configure on which Network listener will use. +If Listener is set, ListenerNetwork is not used.

  • ListenerAddrFunc func(addr net.Addr)

    ListenerAddrFunc will be called after listener is created and started to listen for connections. This is useful in +testing situations when server is started on random port address = ":0" in that case you can get actual port where +listener is listening on.

  • GracefulTimeout time.Duration

    GracefulTimeout is timeout value (defaults to 10sec) graceful shutdown will wait for server to handle ongoing requests +before shutting down the server.

  • OnShutdownError func(err error)

    OnShutdownError is called when graceful shutdown results an error. for example when listeners are not shut down within +given timeout

  • BeforeServeFunc func(s *http.Server) error

    BeforeServeFunc is callback that is called just before server starts to serve HTTP request. +Use this callback when you want to configure http.Server different timeouts/limits/etc

+
+

func StartConfig) Start(ctx stdContext.Context, h http.Handler) error

+

Source: server.go:64

+

Start starts given Handler with HTTP(s) server.

+
+
+

func StartTLS(ctx stdContext.Context, h http.Handler, certFile, keyFile any) error

+

Source: server.go:71

+

StartTLS starts given Handler with HTTPS server. +If certFile or keyFile is string the values are treated as file paths. +If certFile or keyFile is []byte the values are treated as the certificate or key as-is.

+
+
+
+

type TemplateRenderer

+

Source: renderer.go:23

+

TemplateRenderer is helper to ease creating renderers for html/template and text/template packages. +Example usage:

+
+
+ +
+
	e.Renderer = &echo.TemplateRenderer{
+		Template: template.Must(template.ParseGlob("templates/*.html")),
+	}
+
+  e.Renderer = &echo.TemplateRenderer{
+		Template: template.Must(template.New("hello").Parse("Hello, {{.}}!")),
+	}
+
+
+
+ +
+
type TemplateRenderer struct {
+	Template interface {
+		ExecuteTemplate(wr io.Writer, name string, data any) error
+	}
+}
+
+
Fields
  • Template interface { + ExecuteTemplate(wr io.Writer, name string, data any) error +}
+
+

func Renderer) Render(c *Context, w io.Writer, name string, data any) error

+

Source: renderer.go:30

+

Render renders the template with given data.

+
+
+
+

type TimeLayout

+

Source: binder_generic.go:16

+

TimeLayout specifies the format for parsing time values in request parameters. +It can be a standard Go time layout string or one of the special Unix time layouts.

+
+
+ +
+
type TimeLayout string
+
+
+
+

type TimeOpts

+

Source: binder_generic.go:19

+

TimeOpts is options for parsing time.Time values

+
+
+ +
+
type TimeOpts struct {
+	// Layout specifies the format for parsing time values in request parameters.
+	// It can be a standard Go time layout string or one of the special Unix time layouts.
+	//
+	// Parsing layout defaults to: echo.TimeLayout(time.RFC3339Nano)
+	// - To convert to custom layout use `echo.TimeLayout("2006-01-02")`
+	// - To convert unix timestamp (integer) to time.Time use `echo.TimeLayoutUnixTime`
+	// - To convert unix timestamp in milliseconds to time.Time use `echo.TimeLayoutUnixTimeMilli`
+	// - To convert unix timestamp in nanoseconds to time.Time use `echo.TimeLayoutUnixTimeNano`
+	Layout TimeLayout
+
+	// ParseInLocation is location used with time.ParseInLocation for layout that do not contain
+	// timezone information to set output time in given location.
+	// Defaults to time.UTC
+	ParseInLocation *time.Location
+
+	// ToInLocation is location to which parsed time is converted to after parsing.
+	// The parsed time will be converted using time.In(ToInLocation).
+	// Defaults to time.UTC
+	ToInLocation *time.Location
+}
+
+
Fields
  • Layout TimeLayout

    Layout specifies the format for parsing time values in request parameters. +It can be a standard Go time layout string or one of the special Unix time layouts.

    +

    Parsing layout defaults to: echo.TimeLayout(time.RFC3339Nano)

    +
      +
    • To convert to custom layout use echo.TimeLayout("2006-01-02")
    • +
    • To convert unix timestamp (integer) to time.Time use echo.TimeLayoutUnixTime
    • +
    • To convert unix timestamp in milliseconds to time.Time use echo.TimeLayoutUnixTimeMilli
    • +
    • To convert unix timestamp in nanoseconds to time.Time use echo.TimeLayoutUnixTimeNano
    • +
  • ParseInLocation *time.Location

    ParseInLocation is location used with time.ParseInLocation for layout that do not contain +timezone information to set output time in given location. +Defaults to time.UTC

  • ToInLocation *time.Location

    ToInLocation is location to which parsed time is converted to after parsing. +The parsed time will be converted using time.In(ToInLocation). +Defaults to time.UTC

+
+
+

type TrustOption

+

Source: ip.go:144

+

TrustOption is config for which IP address to trust

+
+
+ +
+
type TrustOption func(*ipChecker)
+
+
+
+

type Validator

+

Source: echo.go:141

+

Validator is the interface that wraps the Validate function.

+
+
+ +
+
type Validator interface {
+	Validate(i any) error
+}
+
+
Methods
  • Validate func(i any) error
+
+
+

type ValueBinder

+

Source: binder.go:113

+

ValueBinder provides utility methods for binding query or path parameter to various Go built-in types

+
+
+ +
+
type ValueBinder struct {
+	// ValueFunc is used to get single parameter (first) value from request
+	ValueFunc func(sourceParam string) string
+	// ValuesFunc is used to get all values for parameter from request. i.e. `/api/search?ids=1&ids=2`
+	ValuesFunc func(sourceParam string) []string
+	// ErrorFunc is used to create errors. Allows you to use your own error type, that for example marshals to your specific json response
+	ErrorFunc func(sourceParam string, values []string, message string, internalError error) error
+	// contains filtered or unexported fields
+}
+
+
Fields
  • ValueFunc func(sourceParam string) string

    ValueFunc is used to get single parameter (first) value from request

  • ValuesFunc func(sourceParam string) []string

    ValuesFunc is used to get all values for parameter from request. i.e. /api/search?ids=1&ids=2

  • ErrorFunc func(sourceParam string, values []string, message string, internalError error) error

    ErrorFunc is used to create errors. Allows you to use your own error type, that for example marshals to your specific json response

+
+

func BindError() error

+

Source: binder.go:207

+

BindError returns first seen bind error and resets/empties binder errors for further calls

+
Example +
+
+ +
+
{
+
+	failFastRouteFunc := func(c *echo.Context) error {
+		var opts struct {
+			IDs    []int64
+			Active bool
+		}
+		length := int64(50)
+
+		b := echo.QueryParamsBinder(c)
+
+		err := b.Int64("length", &length).
+			Int64s("ids", &opts.IDs).
+			Bool("active", &opts.Active).
+			BindError()
+		if err != nil {
+			bErr := err.(*echo.BindingError)
+			return fmt.Errorf("my own custom error for field: %s values: %v", bErr.Field, bErr.Values)
+		}
+		fmt.Printf("active = %v, length = %v, ids = %v\n", opts.Active, length, opts.IDs)
+
+		return c.JSON(http.StatusOK, opts)
+	}
+
+	e := echo.New()
+	c := e.NewContext(
+		httptest.NewRequest(http.MethodGet, "/api/endpoint?active=true&length=25&ids=1&ids=2&ids=3", nil),
+		httptest.NewRecorder(),
+	)
+
+	_ = failFastRouteFunc(c)
+
+}
+
+

Output:

+
+
+ +
+
active = true, length = 25, ids = [1 2 3]
+
+
+
+
+

func BindErrors() []error

+

Source: binder.go:217

+

BindErrors returns all bind errors and resets/empties binder errors for further calls

+
Example +
+
+ +
+
{
+
+	routeFunc := func(c *echo.Context) error {
+		var opts struct {
+			IDs    []int64
+			Active bool
+		}
+		length := int64(50)
+
+		b := echo.QueryParamsBinder(c)
+
+		errs := b.Int64("length", &length).
+			Int64s("ids", &opts.IDs).
+			Bool("active", &opts.Active).
+			BindErrors()
+		if errs != nil {
+			for _, err := range errs {
+				bErr := err.(*echo.BindingError)
+				log.Printf("in case you want to access what field: %s values: %v failed", bErr.Field, bErr.Values)
+			}
+			return fmt.Errorf("%v fields failed to bind", len(errs))
+		}
+		fmt.Printf("active = %v, length = %v, ids = %v", opts.Active, length, opts.IDs)
+
+		return c.JSON(http.StatusOK, opts)
+	}
+
+	e := echo.New()
+	c := e.NewContext(
+		httptest.NewRequest(http.MethodGet, "/api/endpoint?active=true&length=25&ids=1&ids=2&ids=3", nil),
+		httptest.NewRecorder(),
+	)
+
+	_ = routeFunc(c)
+
+}
+
+

Output:

+
+
+ +
+
active = true, length = 25, ids = [1 2 3]
+
+
+
+
+

func BindUnmarshaler(sourceParam string, dest BindUnmarshaler) *ValueBinder

+

Source: binder.go:313

+

BindUnmarshaler binds parameter to destination implementing BindUnmarshaler interface

+
+
+

func BindWithDelimiter(sourceParam string, dest any, delimiter string) *ValueBinder

+

Source: binder.go:422

+

BindWithDelimiter binds parameter to destination by suitable conversion function. +Delimiter is used before conversion to split parameter value to separate values

+
+
+

func Bool(sourceParam string, dest *bool) *ValueBinder

+

Source: binder.go:917

+

Bool binds parameter to bool variable

+
+
+

func Bools(sourceParam string, dest *[]bool) *ValueBinder

+

Source: binder.go:982

+

Bools binds parameter values to slice of bool variables

+
+
+

func Byte(sourceParam string, dest *byte) *ValueBinder

+

Source: binder.go:729

+

Byte binds parameter to byte variable

+
+
+

func CustomFunc(sourceParam string, customFunc func(values []string) []error) *ValueBinder

+

Source: binder.go:227

+

CustomFunc binds parameter values with Func. Func is called only when parameter values exist.

+
Example +
+
+ +
+
{
+
+	routeFunc := func(c *echo.Context) error {
+		length := int64(50)
+		var binary []byte
+
+		b := echo.QueryParamsBinder(c)
+		errs := b.Int64("length", &length).
+			CustomFunc("base64", func(values []string) []error {
+				if len(values) == 0 {
+					return nil
+				}
+				decoded, err := base64.URLEncoding.DecodeString(values[0])
+				if err != nil {
+
+					return []error{echo.NewBindingError("base64", values[0:1], "failed to decode base64", err)}
+				}
+				binary = decoded
+				return nil
+			}).
+			BindErrors()
+
+		if errs != nil {
+			for _, err := range errs {
+				bErr := err.(*echo.BindingError)
+				log.Printf("in case you want to access what field: %s values: %v failed", bErr.Field, bErr.Values)
+			}
+			return fmt.Errorf("%v fields failed to bind", len(errs))
+		}
+		fmt.Printf("length = %v, base64 = %s", length, binary)
+
+		return c.JSON(http.StatusOK, "ok")
+	}
+
+	e := echo.New()
+	c := e.NewContext(
+		httptest.NewRequest(http.MethodGet, "/api/endpoint?length=25&base64=SGVsbG8gV29ybGQ%3D", nil),
+		httptest.NewRecorder(),
+	)
+	_ = routeFunc(c)
+
+}
+
+

Output:

+
+
+ +
+
length = 25, base64 = Hello World
+
+
+
+
+

func Duration(sourceParam string, dest *time.Duration) *ValueBinder

+

Source: binder.go:1179

+

Duration binds parameter to time.Duration variable

+
+
+

func Durations(sourceParam string, dest *[]time.Duration) *ValueBinder

+

Source: binder.go:1210

+

Durations binds parameter values to slice of time.Duration variables

+
+
+

func FailFast(value bool) *ValueBinder

+

Source: binder.go:193

+

FailFast set internal flag to indicate if binding methods will return early (without binding) when previous bind failed +NB: call this method before any other binding methods as it modifies binding methods behaviour

+
+
+

func Float32(sourceParam string, dest *float32) *ValueBinder

+

Source: binder.go:1002

+

Float32 binds parameter to float32 variable

+
+
+

func Float32s(sourceParam string, dest *[]float32) *ValueBinder

+

Source: binder.go:1097

+

Float32s binds parameter values to slice of float32 variables

+
+
+

func Float64(sourceParam string, dest *float64) *ValueBinder

+

Source: binder.go:992

+

Float64 binds parameter to float64 variable

+
+
+

func Float64s(sourceParam string, dest *[]float64) *ValueBinder

+

Source: binder.go:1087

+

Float64s binds parameter values to slice of float64 variables

+
+
+

func Int(sourceParam string, dest *int) *ValueBinder

+

Source: binder.go:511

+

Int binds parameter to int variable

+
+
+

func Int16(sourceParam string, dest *int16) *ValueBinder

+

Source: binder.go:491

+

Int16 binds parameter to int16 variable

+
+
+

func Int16s(sourceParam string, dest *[]int16) *ValueBinder

+

Source: binder.go:659

+

Int16s binds parameter to slice of int16

+
+
+

func Int32(sourceParam string, dest *int32) *ValueBinder

+

Source: binder.go:481

+

Int32 binds parameter to int32 variable

+
+
+

func Int32s(sourceParam string, dest *[]int32) *ValueBinder

+

Source: binder.go:649

+

Int32s binds parameter to slice of int32

+
+
+

func Int64(sourceParam string, dest *int64) *ValueBinder

+

Source: binder.go:471

+

Int64 binds parameter to int64 variable

+
+
+

func Int64s(sourceParam string, dest *[]int64) *ValueBinder

+

Source: binder.go:639

+

Int64s binds parameter to slice of int64

+
+
+

func Int8(sourceParam string, dest *int8) *ValueBinder

+

Source: binder.go:501

+

Int8 binds parameter to int8 variable

+
+
+

func Int8s(sourceParam string, dest *[]int8) *ValueBinder

+

Source: binder.go:669

+

Int8s binds parameter to slice of int8

+
+
+

func Ints(sourceParam string, dest *[]int) *ValueBinder

+

Source: binder.go:679

+

Ints binds parameter to slice of int

+
+
+

func JSONUnmarshaler(sourceParam string, dest json.Unmarshaler) *ValueBinder

+

Source: binder.go:349

+

JSONUnmarshaler binds parameter to destination implementing json.Unmarshaler interface

+
+
+

func MustBindUnmarshaler(sourceParam string, dest BindUnmarshaler) *ValueBinder

+

Source: binder.go:331

+

MustBindUnmarshaler requires parameter value to exist to bind to destination implementing BindUnmarshaler interface. +Returns error when value does not exist

+
+
+

func MustBindWithDelimiter(sourceParam string, dest any, delimiter string) *ValueBinder

+

Source: binder.go:428

+

MustBindWithDelimiter requires parameter value to exist to bind destination by suitable conversion function. +Delimiter is used before conversion to split parameter value to separate values

+
+
+

func MustBool(sourceParam string, dest *bool) *ValueBinder

+

Source: binder.go:922

+

MustBool requires parameter value to exist to bind to bool variable. Returns error when value does not exist

+
+
+

func MustBools(sourceParam string, dest *[]bool) *ValueBinder

+

Source: binder.go:987

+

MustBools requires parameter values to exist to bind to slice of bool variables. Returns error when values does not exist

+
+
+

func MustByte(sourceParam string, dest *byte) *ValueBinder

+

Source: binder.go:734

+

MustByte requires parameter value to exist to bind to byte variable. Returns error when value does not exist

+
+
+

func MustCustomFunc(sourceParam string, customFunc func(values []string) []error) *ValueBinder

+

Source: binder.go:232

+

MustCustomFunc requires parameter values to exist to bind with Func. Returns error when value does not exist.

+
+
+

func MustDuration(sourceParam string, dest *time.Duration) *ValueBinder

+

Source: binder.go:1184

+

MustDuration requires parameter value to exist to bind to time.Duration variable. Returns error when value does not exist

+
+
+

func MustDurations(sourceParam string, dest *[]time.Duration) *ValueBinder

+

Source: binder.go:1215

+

MustDurations requires parameter values to exist to bind to slice of time.Duration variables. Returns error when values does not exist

+
+
+

func MustFloat32(sourceParam string, dest *float32) *ValueBinder

+

Source: binder.go:1007

+

MustFloat32 requires parameter value to exist to bind to float32 variable. Returns error when value does not exist

+
+
+

func MustFloat32s(sourceParam string, dest *[]float32) *ValueBinder

+

Source: binder.go:1102

+

MustFloat32s requires parameter values to exist to bind to slice of float32 variables. Returns error when values does not exist

+
+
+

func MustFloat64(sourceParam string, dest *float64) *ValueBinder

+

Source: binder.go:997

+

MustFloat64 requires parameter value to exist to bind to float64 variable. Returns error when value does not exist

+
+
+

func MustFloat64s(sourceParam string, dest *[]float64) *ValueBinder

+

Source: binder.go:1092

+

MustFloat64s requires parameter values to exist to bind to slice of float64 variables. Returns error when values does not exist

+
+
+

func MustInt(sourceParam string, dest *int) *ValueBinder

+

Source: binder.go:516

+

MustInt requires parameter value to exist to bind to int variable. Returns error when value does not exist

+
+
+

func MustInt16(sourceParam string, dest *int16) *ValueBinder

+

Source: binder.go:496

+

MustInt16 requires parameter value to exist to bind to int16 variable. Returns error when value does not exist

+
+
+

func MustInt16s(sourceParam string, dest *[]int16) *ValueBinder

+

Source: binder.go:664

+

MustInt16s requires parameter value to exist to bind to int16 slice variable. Returns error when value does not exist

+
+
+

func MustInt32(sourceParam string, dest *int32) *ValueBinder

+

Source: binder.go:486

+

MustInt32 requires parameter value to exist to bind to int32 variable. Returns error when value does not exist

+
+
+

func MustInt32s(sourceParam string, dest *[]int32) *ValueBinder

+

Source: binder.go:654

+

MustInt32s requires parameter value to exist to bind to int32 slice variable. Returns error when value does not exist

+
+
+

func MustInt64(sourceParam string, dest *int64) *ValueBinder

+

Source: binder.go:476

+

MustInt64 requires parameter value to exist to bind to int64 variable. Returns error when value does not exist

+
+
+

func MustInt64s(sourceParam string, dest *[]int64) *ValueBinder

+

Source: binder.go:644

+

MustInt64s requires parameter value to exist to bind to int64 slice variable. Returns error when value does not exist

+
+
+

func MustInt8(sourceParam string, dest *int8) *ValueBinder

+

Source: binder.go:506

+

MustInt8 requires parameter value to exist to bind to int8 variable. Returns error when value does not exist

+
+
+

func MustInt8s(sourceParam string, dest *[]int8) *ValueBinder

+

Source: binder.go:674

+

MustInt8s requires parameter value to exist to bind to int8 slice variable. Returns error when value does not exist

+
+
+

func MustInts(sourceParam string, dest *[]int) *ValueBinder

+

Source: binder.go:684

+

MustInts requires parameter value to exist to bind to int slice variable. Returns error when value does not exist

+
+
+

func MustJSONUnmarshaler(sourceParam string, dest json.Unmarshaler) *ValueBinder

+

Source: binder.go:367

+

MustJSONUnmarshaler requires parameter value to exist to bind to destination implementing json.Unmarshaler interface. +Returns error when value does not exist

+
+
+

func MustString(sourceParam string, dest *string) *ValueBinder

+

Source: binder.go:269

+

MustString requires parameter value to exist to bind to string variable. Returns error when value does not exist

+
+
+

func MustStrings(sourceParam string, dest *[]string) *ValueBinder

+

Source: binder.go:298

+

MustStrings requires parameter values to exist to bind to slice of string variables. Returns error when value does not exist

+
+
+

func MustTextUnmarshaler(sourceParam string, dest encoding.TextUnmarshaler) *ValueBinder

+

Source: binder.go:403

+

MustTextUnmarshaler requires parameter value to exist to bind to destination implementing encoding.TextUnmarshaler interface. +Returns error when value does not exist

+
+
+

func MustTime(sourceParam string, dest *time.Time, layout string) *ValueBinder

+

Source: binder.go:1112

+

MustTime requires parameter value to exist to bind to time.Time variable. Returns error when value does not exist

+
+
+

func MustTimes(sourceParam string, dest *[]time.Time, layout string) *ValueBinder

+

Source: binder.go:1143

+

MustTimes requires parameter values to exist to bind to slice of time.Time variables. Returns error when values does not exist

+
+
+

func MustUint(sourceParam string, dest *uint) *ValueBinder

+

Source: binder.go:744

+

MustUint requires parameter value to exist to bind to uint variable. Returns error when value does not exist

+
+
+

func MustUint16(sourceParam string, dest *uint16) *ValueBinder

+

Source: binder.go:714

+

MustUint16 requires parameter value to exist to bind to uint16 variable. Returns error when value does not exist

+
+
+

func MustUint16s(sourceParam string, dest *[]uint16) *ValueBinder

+

Source: binder.go:892

+

MustUint16s requires parameter value to exist to bind to uint16 slice variable. Returns error when value does not exist

+
+
+

func MustUint32(sourceParam string, dest *uint32) *ValueBinder

+

Source: binder.go:704

+

MustUint32 requires parameter value to exist to bind to uint32 variable. Returns error when value does not exist

+
+
+

func MustUint32s(sourceParam string, dest *[]uint32) *ValueBinder

+

Source: binder.go:882

+

MustUint32s requires parameter value to exist to bind to uint32 slice variable. Returns error when value does not exist

+
+
+

func MustUint64(sourceParam string, dest *uint64) *ValueBinder

+

Source: binder.go:694

+

MustUint64 requires parameter value to exist to bind to uint64 variable. Returns error when value does not exist

+
+
+

func MustUint64s(sourceParam string, dest *[]uint64) *ValueBinder

+

Source: binder.go:872

+

MustUint64s requires parameter value to exist to bind to uint64 slice variable. Returns error when value does not exist

+
+
+

func MustUint8(sourceParam string, dest *uint8) *ValueBinder

+

Source: binder.go:724

+

MustUint8 requires parameter value to exist to bind to uint8 variable. Returns error when value does not exist

+
+
+

func MustUint8s(sourceParam string, dest *[]uint8) *ValueBinder

+

Source: binder.go:902

+

MustUint8s requires parameter value to exist to bind to uint8 slice variable. Returns error when value does not exist

+
+
+

func MustUints(sourceParam string, dest *[]uint) *ValueBinder

+

Source: binder.go:912

+

MustUints requires parameter value to exist to bind to uint slice variable. Returns error when value does not exist

+
+
+

func MustUnixTime(sourceParam string, dest *time.Time) *ValueBinder

+

Source: binder.go:1270

+

MustUnixTime requires parameter value to exist to bind to time.Time variable (in local time corresponding +to the given Unix time). Returns error when value does not exist.

+

Example: 1609180603 bind to 2020-12-28T18:36:43.000000000+00:00

+

Note:

+
    +
  • time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
  • +
+
+
+

func MustUnixTimeMilli(sourceParam string, dest *time.Time) *ValueBinder

+

Source: binder.go:1291

+

MustUnixTimeMilli requires parameter value to exist to bind to time.Time variable (in local time corresponding +to the given Unix time in millisecond precision). Returns error when value does not exist.

+

Example: 1647184410140 bind to 2022-03-13T15:13:30.140000000+00:00

+

Note:

+
    +
  • time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
  • +
+
+
+

func MustUnixTimeNano(sourceParam string, dest *time.Time) *ValueBinder

+

Source: binder.go:1318

+

MustUnixTimeNano requires parameter value to exist to bind to time.Time variable (in local time corresponding +to the given Unix time value in nanosecond precision). Returns error when value does not exist.

+

Example: 1609180603123456789 binds to 2020-12-28T18:36:43.123456789+00:00 +Example: 1000000000 binds to 1970-01-01T00:00:01.000000000+00:00 +Example: 999999999 binds to 1970-01-01T00:00:00.999999999+00:00

+

Note:

+
    +
  • time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
  • +
  • Javascript's Number type only has about 53 bits of precision (Number.MAX_SAFE_INTEGER = 9007199254740991). Compare it to 1609180603123456789 in example.
  • +
+
+
+

func String(sourceParam string, dest *string) *ValueBinder

+

Source: binder.go:255

+

String binds parameter to string variable

+
+
+

func Strings(sourceParam string, dest *[]string) *ValueBinder

+

Source: binder.go:284

+

Strings binds parameter values to slice of string

+
+
+

func TextUnmarshaler(sourceParam string, dest encoding.TextUnmarshaler) *ValueBinder

+

Source: binder.go:385

+

TextUnmarshaler binds parameter to destination implementing encoding.TextUnmarshaler interface

+
+
+

func Time(sourceParam string, dest *time.Time, layout string) *ValueBinder

+

Source: binder.go:1107

+

Time binds parameter to time.Time variable

+
+
+

func Times(sourceParam string, dest *[]time.Time, layout string) *ValueBinder

+

Source: binder.go:1138

+

Times binds parameter values to slice of time.Time variables

+
+
+

func Uint(sourceParam string, dest *uint) *ValueBinder

+

Source: binder.go:739

+

Uint binds parameter to uint variable

+
+
+

func Uint16(sourceParam string, dest *uint16) *ValueBinder

+

Source: binder.go:709

+

Uint16 binds parameter to uint16 variable

+
+
+

func Uint16s(sourceParam string, dest *[]uint16) *ValueBinder

+

Source: binder.go:887

+

Uint16s binds parameter to slice of uint16

+
+
+

func Uint32(sourceParam string, dest *uint32) *ValueBinder

+

Source: binder.go:699

+

Uint32 binds parameter to uint32 variable

+
+
+

func Uint32s(sourceParam string, dest *[]uint32) *ValueBinder

+

Source: binder.go:877

+

Uint32s binds parameter to slice of uint32

+
+
+

func Uint64(sourceParam string, dest *uint64) *ValueBinder

+

Source: binder.go:689

+

Uint64 binds parameter to uint64 variable

+
+
+

func Uint64s(sourceParam string, dest *[]uint64) *ValueBinder

+

Source: binder.go:867

+

Uint64s binds parameter to slice of uint64

+
+
+

func Uint8(sourceParam string, dest *uint8) *ValueBinder

+

Source: binder.go:719

+

Uint8 binds parameter to uint8 variable

+
+
+

func Uint8s(sourceParam string, dest *[]uint8) *ValueBinder

+

Source: binder.go:897

+

Uint8s binds parameter to slice of uint8

+
+
+

func Uints(sourceParam string, dest *[]uint) *ValueBinder

+

Source: binder.go:907

+

Uints binds parameter to slice of uint

+
+
+

func UnixTime(sourceParam string, dest *time.Time) *ValueBinder

+

Source: binder.go:1259

+

UnixTime binds parameter to time.Time variable (in local Time corresponding to the given Unix time).

+

Example: 1609180603 bind to 2020-12-28T18:36:43.000000000+00:00

+

Note:

+
    +
  • time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
  • +
+
+
+

func UnixTimeMilli(sourceParam string, dest *time.Time) *ValueBinder

+

Source: binder.go:1280

+

UnixTimeMilli binds parameter to time.Time variable (in local time corresponding to the given Unix time in millisecond precision).

+

Example: 1647184410140 bind to 2022-03-13T15:13:30.140000000+00:00

+

Note:

+
    +
  • time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
  • +
+
+
+

func UnixTimeNano(sourceParam string, dest *time.Time) *ValueBinder

+

Source: binder.go:1304

+

UnixTimeNano binds parameter to time.Time variable (in local time corresponding to the given Unix time in nanosecond precision).

+

Example: 1609180603123456789 binds to 2020-12-28T18:36:43.123456789+00:00 +Example: 1000000000 binds to 1970-01-01T00:00:01.000000000+00:00 +Example: 999999999 binds to 1970-01-01T00:00:00.999999999+00:00

+

Note:

+
    +
  • time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal
  • +
  • Javascript's Number type only has about 53 bits of precision (Number.MAX_SAFE_INTEGER = 9007199254740991). Compare it to 1609180603123456789 in example.
  • +
+
+
\ No newline at end of file diff --git a/docs/api-reference/llms-full.txt b/docs/api-reference/llms-full.txt new file mode 100644 index 000000000..a21a99de3 --- /dev/null +++ b/docs/api-reference/llms-full.txt @@ -0,0 +1,37 @@ +# Echo API Reference + +Package echo implements high performance, minimalist Go web framework. + +## API Reference + +### github.com/labstack/echo/v5 + +Path: `/api-reference/package-root.html` + +Package echo implements high performance, minimalist Go web framework. + +import "github.com/labstack/echo/v5" Package echo implements high performance, minimalist Go web framework. Example: Copy package main import ( "log/slog" "net/http" "github.com/labstack/echo/v5" "github.com/labstack/echo/v5/middleware" ) // Handler func hello(c *echo.Context) error { return c.String(http.StatusOK, "Hello, World!") } func main() { // Echo instance e := echo.New() // Middleware e.Use(middleware.RequestLogger()) e.Use(middleware.Recover()) // Routes e.GET("/", hello) // Start server if err := e.Start(":8080"); err != nil { slog.Error("failed to start server", "error", err) } } Learn more at https://echo.labstack.com Index Constants Variables Functions func BindBody(c *Context, target any) (err error) func BindHeaders(c *Context, target any) error func BindPathValues(c *Context, target any) error func BindQueryParams(c *Context, target any) error func ContextGet[T any](c *Context, key string) (T, error) func ContextGetOr[T any](c *Context, key string, defaultValue T) (T, error) func DefaultHTTPErrorHandler(exposeError bool) HTTPErrorHandler func ExtractIPDirect() IPExtractor func ExtractIPFromRealIPHeader(options ...TrustOption) IPExtractor func ExtractIPFromXFFHeader(options ...TrustOption) IPExtractor func FormFieldBinder(c *Context) *ValueBinder func FormValue[T any](c *Context, key string, opts ...any) (T, error) func FormValueOr[T any](c *Context, key string, defaultValue T, opts ...any) (T, error) func FormValues[T any](c *Context, key string, opts ...any) ([]T, error) func FormValuesOr[T any](c *Context, key string, defaultValue []T, opts ...any) ([]T, error) func HandlerName(h HandlerFunc) string func LegacyIPExtractor() IPExtractor func MustSubFS(currentFs fs.FS, fsRoot string) fs.FS func New() *Echo func NewBindingError(sourceParam string, values []string, message string, err error) error func NewConcurrentRouter(r Router) Router func NewContext(r *http.Request, w http.ResponseWriter, opts ...any) *Context func NewDefaultFS(dir string) fs.FS func NewHTTPError(code int, message string) *HTTPError func NewResponse(w http.ResponseWriter, logger *slog.Logger) (r *Response) func NewRouter(config RouterConfig) *DefaultRouter func NewVirtualHostHandler(vhosts map[string]*Echo) *Echo func NewWithConfig(config Config) *Echo func ParseValue[T any](value string, opts ...any) (T, error) func ParseValueOr[T any](value string, defaultValue T, opts ...any) (T, error) func ParseValues[T any](values []string, opts ...any) ([]T, error) func ParseValuesOr[T any](values []string, defaultValue []T, opts ...any) ([]T, error) func PathParam[T any](c *Context, paramName string, opts ...any) (T, error) func PathParamOr[T any](c *Context, paramName string, defaultValue T, opts ...any) (T, error) func PathValuesBinder(c *Context) *ValueBinder func QueryParam[T any](c *Context, key string, opts ...any) (T, error) func QueryParamOr[T any](c *Context, key string, defaultValue T, opts ...any) (T, error) func QueryParams[T any](c *Context, key string, opts ...any) ([]T, error) func QueryParamsBinder(c *Context) *ValueBinder func QueryParamsOr[T any](c *Context, key string, defaultValue []T, opts ...any) ([]T, error) func ResolveResponseStatus(rw http.ResponseWriter, err error) (resp *Response, status int) func StaticDirectoryHandler(fileSystem fs.FS, disablePathUnescaping bool) HandlerFunc func StaticFileHandler(file string, filesystem fs.FS) HandlerFunc func StatusCode(err error) int func TrustIPRange(ipRange *net.IPNet) TrustOption func TrustLinkLocal(v bool) TrustOption func TrustLoopback(v bool) TrustOption func TrustPrivateNet(v bool) TrustOption func UnwrapResponse(rw http.ResponseWriter) (*Response, error) func WrapHandler(h http.Handler) HandlerFunc func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc Types type AddRouteError type BindUnmarshaler type Binder type BindingError type Config type Context type DefaultBinder type DefaultJSONSerializer type DefaultRouter type Echo type Group type HTTPError type HTTPErrorHandler type HTTPStatusCoder type HandlerFunc type IPExtractor type JSONSerializer type MiddlewareConfigurator type MiddlewareFunc type PathValue type PathValues type Renderer type Response type Route type RouteInfo type Router type RouterConfig type Routes type StartConfig type TemplateRenderer type TimeLayout type TimeOpts type TrustOption type Validator type ValueBinder Constants TimeLayout constants for parsing Unix timestamps in different precisions. Source: binder_generic.go:43 Copy const ( TimeLayoutUnixTime = TimeLayout ( "UnixTime" ) // Unix timestamp in seconds TimeLayoutUnixTimeMilli = TimeLayout ( "UnixTimeMilli" ) // Unix timestamp in milliseconds TimeLayoutUnixTimeNano = TimeLayout ( "UnixTimeNano" ) // Unix timestamp in nanoseconds ) MIME types Source: echo.go:148 Copy const ( // MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259 MIMEApplicationJSON = "application/json" // Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default. // No "charset" parameter is defined for this registration. // Adding one really has no effect on compliant recipients. // See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n" MIMEApplicationJSONCharsetUTF8 = MIMEApplicationJSON + "; " + charsetUTF8 MIMEApplicationJavaScript = "application/javascript" MIMEApplicationJavaScriptCharsetUTF8 = MIMEApplicationJavaScript + "; " + charsetUTF8 MIMEApplicationXML = "application/xml" MIMEApplicationXMLCharsetUTF8 = MIMEApplicationXML + "; " + charsetUTF8 MIMETextXML = "text/xml" MIMETextXMLCharsetUTF8 = MIMETextXML + "; " + charsetUTF8 MIMEApplicationForm = "application/x-www-form-urlencoded" MIMEApplicationProtobuf = "application/protobuf" MIMEApplicationMsgpack = "application/msgpack" MIMETextHTML = "text/html" MIMETextHTMLCharsetUTF8 = MIMETextHTML + "; " + charsetUTF8 MIMETextPlain = "text/plain" MIMETextPlainCharsetUTF8 = MIMETextPlain + "; " + charsetUTF8 MIMEMultipartForm = "multipart/form-data" MIMEOctetStream = "application/octet-stream" ) Source: echo.go:174 Copy const ( // PROPFIND Method can be used on collection and property resources. PROPFIND = "PROPFIND" // REPORT Method can be used to get information about a resource, see rfc 3253 REPORT = "REPORT" // QUERY Method is a safe, idempotent request method carrying request content (a query) in its body, see rfc 10008. // It is not (yet) part of the `net/http` standard library, so Echo defines it here. QUERY = "QUERY" // RouteNotFound is special method type for routes handling "route not found" (404) cases RouteNotFound = "echo_route_not_found" // RouteAny is special method type that matches any HTTP method in request. Any has lower // priority that other methods that have been registered with Router to that path. RouteAny = "echo_route_any" ) Headers Source: echo.go:189 Copy const ( HeaderAccept = "Accept" HeaderAcceptEncoding = "Accept-Encoding" // HeaderAllow is the name of the "Allow" header field used to list the set of methods // advertised as supported by the target resource. Returning an Allow header is mandatory // for status 405 (method not found) and useful for the OPTIONS method in responses. // See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1 HeaderAllow = "Allow" HeaderAuthorization = "Authorization" HeaderContentDisposition = "Content-Disposition" HeaderContentEncoding = "Content-Encoding" HeaderContentLength = "Content-Length" HeaderContentType = "Content-Type" HeaderCookie = "Cookie" HeaderSetCookie = "Set-Cookie" HeaderIfModifiedSince = "If-Modified-Since" HeaderLastModified = "Last-Modified" HeaderLocation = "Location" HeaderRetryAfter = "Retry-After" HeaderUpgrade = "Upgrade" HeaderVary = "Vary" HeaderWWWAuthenticate = "WWW-Authenticate" HeaderXForwardedFor = "X-Forwarded-For" HeaderXForwardedProto = "X-Forwarded-Proto" HeaderXForwardedProtocol = "X-Forwarded-Protocol" HeaderXForwardedSsl = "X-Forwarded-Ssl" HeaderXUrlScheme = "X-Url-Scheme" HeaderXHTTPMethodOverride = "X-HTTP-Method-Override" HeaderXRealIP = "X-Real-Ip" HeaderXRequestID = "X-Request-Id" HeaderXCorrelationID = "X-Correlation-Id" HeaderXRequestedWith = "X-Requested-With" HeaderServer = "Server" // HeaderOrigin request header indicates the origin (scheme, hostname, and port) that caused the request. // See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin HeaderOrigin = "Origin" HeaderCacheControl = "Cache-Control" HeaderConnection = "Connection" // Access control HeaderAccessControlRequestMethod = "Access-Control-Request-Method" HeaderAccessControlRequestHeaders = "Access-Control-Request-Headers" HeaderAccessControlAllowOrigin = "Access-Control-Allow-Origin" HeaderAccessControlAllowMethods = "Access-Control-Allow-Methods" HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers" HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials" HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers" HeaderAccessControlMaxAge = "Access-Control-Max-Age" // Security HeaderStrictTransportSecurity = "Strict-Transport-Security" HeaderXContentTypeOptions = "X-Content-Type-Options" HeaderXXSSProtection = "X-XSS-Protection" HeaderXFrameOptions = "X-Frame-Options" HeaderContentSecurityPolicy = "Content-Security-Policy" HeaderContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only" HeaderXCSRFToken = "X-CSRF-Token" // #nosec G101 HeaderReferrerPolicy = "Referrer-Policy" // HeaderSecFetchSite fetch metadata request header indicates the relationship between a request initiator's // origin and the origin of the requested resource. // See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Fetch-Site HeaderSecFetchSite = "Sec-Fetch-Site" ) Source: router.go:49 Copy const ( // NotFoundRouteName is name of RouteInfo returned when router did not find matching route (404: not found). NotFoundRouteName = "echo_route_not_found_name" // MethodNotAllowedRouteName is name of RouteInfo returned when router did not find matching method for route (405: method not allowed). MethodNotAllowedRouteName = "echo_route_method_not_allowed_name" ) Source: context.go:52 Copy const ( // ContextKeyHeaderAllow is set by Router for getting value for `Allow` header in later stages of handler call chain. // Allow header is mandatory for status 405 (method not found) and useful for OPTIONS method requests. // It is added to context only when Router does not find matching method handler for request. ContextKeyHeaderAllow = "echo_header_allow" ) Source: version.go:8 Copy const ( // Version of Echo Version = "5.3.0" ) Variables The following errors can produce HTTP status code by implementing HTTPStatusCoder interface Source: httperror.go:14 Copy var ( ErrBadRequest = & httpError { http . StatusBadRequest } // 400 ErrUnauthorized = & httpError { http . StatusUnauthorized } // 401 ErrForbidden = & httpError { http . StatusForbidden } // 403 ErrNotFound = & httpError { http . StatusNotFound } // 404 ErrMethodNotAllowed = & httpError { http . StatusMethodNotAllowed } // 405 ErrRequestTimeout = & httpError { http . StatusRequestTimeout } // 408 ErrStatusRequestEntityTooLarge = & httpError { http . StatusRequestEntityTooLarge } // 413 ErrUnsupportedMediaType = & httpError { http . StatusUnsupportedMediaType } // 415 ErrTooManyRequests = & httpError { http . StatusTooManyRequests } // 429 ErrInternalServerError = & httpError { http . StatusInternalServerError } // 500 ErrBadGateway = & httpError { http . StatusBadGateway } // 502 ErrServiceUnavailable = & httpError { http . StatusServiceUnavailable } // 503 ) The following errors fall into 500 (InternalServerError) category Source: httperror.go:30 Copy var ( ErrValidatorNotRegistered = errors . New ( "validator not registered" ) ErrRendererNotRegistered = errors . New ( "renderer not registered" ) ErrInvalidRedirectCode = errors . New ( "invalid redirect status code" ) ErrCookieNotFound = errors . New ( "cookie not found" ) ErrInvalidCertOrKeyType = errors . New ( "invalid cert or key type, must be string or []byte" ) ErrInvalidListenerNetwork = errors . New ( "invalid listener network" ) ) ErrInvalidKeyType is error that is returned when the value is not castable to expected type. Source: context_generic.go:12 Copy var ErrInvalidKeyType = errors . New ( "invalid key type" ) ErrNonExistentKey is error that is returned when key does not exist Source: context_generic.go:9 Copy var ErrNonExistentKey = errors . New ( "non existent key" ) Functions func BindBody(c *Context, target any) (err error) Source: bind.go:68 BindBody binds request body contents to bindable object NB: then binding forms take note that this implementation uses standard library form parsing which parses form data from BOTH URL and BODY if content type is not MIMEMultipartForm See non-MIMEMultipartForm: https://golang.org/pkg/net/http/#Request.ParseForm See MIMEMultipartForm: https://golang.org/pkg/net/http/#Request.ParseMultipartForm func BindHeaders(c *Context, target any) error Source: bind.go:114 BindHeaders binds HTTP headers to a bindable object func BindPathValues(c *Context, target any) error Source: bind.go:44 BindPathValues binds path parameter values to bindable object func BindQueryParams(c *Context, target any) error Source: bind.go:56 BindQueryParams binds query params to bindable object func ContextGet[T any](c *Context, key string) (T, error) Source: context_generic.go:16 ContextGet retrieves a value from the context store or ErrNonExistentKey error the key is missing. Returns ErrInvalidKeyType error if the value is not castable to type T. func ContextGetOr[T any](c *Context, key string, defaultValue T) (T, error) Source: context_generic.go:37 ContextGetOr retrieves a value from the context store or returns a default value when the key is missing. Returns ErrInvalidKeyType error if the value is not castable to type T. func DefaultHTTPErrorHandler(exposeError bool) HTTPErrorHandler Source: echo.go:448 DefaultHTTPErrorHandler creates new default HTTP error handler implementation. It sends a JSON response with status code. exposeError parameter decides if returned message will contain also error message or not Note: DefaultHTTPErrorHandler does not log errors. Use middleware for it if errors need to be logged (separately) Note: In case errors happens in middleware call-chain that is returning from handler (which did not return an error). When handler has already sent response (ala c.JSON()) and there is error in middleware that is returning from handler. Then the error that global error handler received will be ignored because we have already "committed" the response and status code header has been sent to the client. Example Copy // SPDX-License-Identifier: MIT // SPDX-FileCopyrightText: © 2015 LabStack LLC and Echo contributors // run tests as external package to get real feel for API package echo_test import ( " encoding/json " " fmt " " github.com/labstack/echo/v5 " " net/http " " net/http/httptest " ) func ExampleDefaultHTTPErrorHandler () { e := echo . New () e . GET ( "/api/endpoint" , func ( c * echo . Context ) error { return & apiError { Code : http . StatusBadRequest , Body : map [ string ] any { "message" : "custom error" }, } }) req := httptest . NewRequest ( http . MethodGet , "/api/endpoint?err=1" , nil ) resp := httptest . NewRecorder () e . ServeHTTP ( resp , req ) fmt . Printf ( " %d %s " , resp . Code , resp . Body . String ()) // Output: 400 {"error":{"message":"custom error"}} } type apiError struct { Code int Body any } func ( e * apiError ) StatusCode () int { return e . Code } func ( e * apiError ) MarshalJSON () ([] byte , error ) { type body struct { Error any `json:"error"` } return json . Marshal ( body { Error : e . Body }) } func ( e * apiError ) Error () string { return http . StatusText ( e . Code ) } Output: Copy 400 {"error":{"message":"custom error"}} func ExtractIPDirect() IPExtractor Source: ip.go:207 ExtractIPDirect extracts an IP address using an actual IP address. Use this if your server faces to internet directly (i.e.: uses no proxy). func ExtractIPFromRealIPHeader(options ...TrustOption) IPExtractor Source: ip.go:224 ExtractIPFromRealIPHeader extracts IP address using x-real-ip header. Use this if you put proxy which uses this header. func ExtractIPFromXFFHeader(options ...TrustOption) IPExtractor Source: ip.go:242 ExtractIPFromXFFHeader extracts IP address using x-forwarded-for header. Use this if you put proxy which uses this header. This returns nearest untrustable IP. If all IPs are trustable, returns furthest one (i.e.: XFF[0]). func FormFieldBinder(c *Context) *ValueBinder Source: binder.go:168 FormFieldBinder creates form field value binder For all requests, FormFieldBinder parses the raw query from the URL and uses query params as form fields For POST, PUT, and PATCH requests, it also reads the request body, parses it as a form and uses query params as form fields. Request body parameters take precedence over URL query string values in r.Form. NB: when binding forms take note that this implementation uses standard library form parsing which parses form data from BOTH URL and BODY if content type is not MIMEMultipartForm See https://golang.org/pkg/net/http/#Request.ParseForm func FormValue[T any](c *Context, key string, opts ...any) (T, error) Source: binder_generic.go:213 FormValue extracts and parses a single form value from the request by key. It returns the typed value and an error if binding fails. Returns ErrNonExistentKey if parameter not found. Empty String Handling: Copy If the form field exists but has an empty value, the zero value of type T is returned with no error. For example, an empty form field returns (0, nil) for int types. This differs from standard library behavior where parsing empty strings returns errors. To treat empty values as errors, validate the result separately or check the raw value. See ParseValue for supported types and options func FormValueOr[T any](c *Context, key string, defaultValue T, opts ...any) (T, error) Source: binder_generic.go:248 FormValueOr extracts and parses a single form value from the request by key. Returns defaultValue if the parameter is not found or has an empty value. Returns an error only if parsing fails or form parsing errors occur. Example: Copy limit, err := echo.FormValueOr[int](c, "limit", 100) // If "limit" is missing: returns (100, nil) // If "limit" is "50": returns (50, nil) // If "limit" is "abc": returns (100, BindingError) See ParseValue for supported types and options func FormValues[T any](c *Context, key string, opts ...any) ([]T, error) Source: binder_generic.go:273 FormValues extracts and parses all values for a form values key as a slice. It returns the typed slice and an error if binding any value fails. Returns ErrNonExistentKey if parameter not found. See ParseValues for supported types and options func FormValuesOr[T any](c *Context, key string, defaultValue []T, opts ...any) ([]T, error) Source: binder_generic.go:300 FormValuesOr extracts and parses all values for a form values key as a slice. Returns defaultValue if the parameter is not found. Returns an error only if parsing any value fails or form parsing errors occur. Example: Copy tags, err := echo.FormValuesOr[string](c, "tags", []string{}) // If "tags" is missing: returns ([], nil) // If form parsing fails: returns (nil, error) See ParseValues for supported types and options func HandlerName(h HandlerFunc) string Source: route.go:102 HandlerName returns string name for given function. func LegacyIPExtractor() IPExtractor Source: ip.go:288 LegacyIPExtractor returns an IPExtractor that derives the client IP address from common proxy headers, falling back to the request's remote address. Resolution order: X-Forwarded-For: returns the first IP in the comma-separated list. If multiple values are present, only the left-most (original client) is used. Surrounding brackets (for IPv6) are stripped. X-Real-IP: used if X-Forwarded-For is absent. Surrounding brackets (for IPv6) are stripped. req.RemoteAddr: used as a fallback; the host portion is extracted via net.SplitHostPort. Notes: No validation is performed on header values. This function trusts headers as-is and is therefore not safe against spoofing unless the application is behind a trusted proxy that is configured to strip/replace/modify headers correctly. Use ExtractIPFromXFFHeader or ExtractIPFromRealIPHeader instead of LegacyIPExtractor. func MustSubFS(currentFs fs.FS, fsRoot string) fs.FS Source: echo.go:946 MustSubFS creates sub FS from current filesystem or panic on failure. Panic happens when fsRoot contains invalid path according to fs.ValidPath rules. MustSubFS is helpful when dealing with embed.FS because for example //go:embed assets/images embeds files with paths including assets/images as their prefix. In that case use `fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary prefix for directory path. func New() *Echo Source: echo.go:386 New creates an instance of Echo. func NewBindingError(sourceParam string, values []string, message string, err error) error Source: binder.go:81 NewBindingError creates new instance of binding error func NewConcurrentRouter(r Router) Router Source: router_concurrent.go:9 NewConcurrentRouter creates concurrency safe Router which routes can be added/removed safely even after http.Server has been started. func NewContext(r *http.Request, w http.ResponseWriter, opts ...any) *Context Source: context.go:98 NewContext returns a new Context instance. Note: request,response and e can be left to nil as Echo.ServeHTTP will call c.Reset(req,resp) anyway these arguments are useful when creating context for tests and cases like that. func NewDefaultFS(dir string) fs.FS Source: echo.go:900 NewDefaultFS returns a new defaultFS instance which allows fs.FS.Open to have absolute paths as input if it matches then given dir as prefix. func NewHTTPError(code int, message string) *HTTPError Source: httperror.go:99 NewHTTPError creates a new instance of HTTPError func NewResponse(w http.ResponseWriter, logger *slog.Logger) (r *Response) Source: response.go:32 NewResponse creates a new instance of Response. func NewRouter(config RouterConfig) *DefaultRouter Source: router.go:127 NewRouter returns a new Router instance. func NewVirtualHostHandler(vhosts map[string]*Echo) *Echo Source: vhost.go:10 NewVirtualHostHandler creates instance of Echo that routes requests to given virtual hosts when hosts in request does not exist in given map the request is served by returned Echo instance. func NewWithConfig(config Config) *Echo Source: echo.go:343 NewWithConfig creates an instance of Echo with given configuration. func ParseValue[T any](value string, opts ...any) (T, error) Source: binder_generic.go:366 ParseValue parses value to generic type Types that are supported: bool float32 float64 int int8 int16 int32 int64 uint uint8/byte uint16 uint32 uint64 string echo.BindUnmarshaler interface encoding.TextUnmarshaler interface json.Unmarshaler interface time.Duration time.Time use echo.TimeOpts or echo.TimeLayout to set time parsing configuration func ParseValueOr[T any](value string, defaultValue T, opts ...any) (T, error) Source: binder_generic.go:393 ParseValueOr parses value to generic type, when value is empty defaultValue is returned. Types that are supported: bool float32 float64 int int8 int16 int32 int64 uint uint8/byte uint16 uint32 uint64 string echo.BindUnmarshaler interface encoding.TextUnmarshaler interface json.Unmarshaler interface time.Duration time.Time use echo.TimeOpts or echo.TimeLayout to set time parsing configuration func ParseValues[T any](values []string, opts ...any) ([]T, error) Source: binder_generic.go:320 ParseValues parses value to generic type slice. Same types are supported as ParseValue function but the result type is slice instead of scalar value. See ParseValue for supported types and options func ParseValuesOr[T any](values []string, defaultValue []T, opts ...any) ([]T, error) Source: binder_generic.go:329 ParseValuesOr parses value to generic type slice, when value is empty defaultValue is returned. Same types are supported as ParseValue function but the result type is slice instead of scalar value. See ParseValue for supported types and options func PathParam[T any](c *Context, paramName string, opts ...any) (T, error) Source: binder_generic.go:59 PathParam extracts and parses a path parameter from the context by name. It returns the typed value and an error if binding fails. Returns ErrNonExistentKey if parameter not found. Empty String Handling: Copy If the parameter exists but has an empty value, the zero value of type T is returned with no error. For example, a path parameter with value "" returns (0, nil) for int types. This differs from standard library behavior where parsing empty strings returns errors. To treat empty values as errors, validate the result separately or check the raw value. See ParseValue for supported types and options func PathParamOr[T any](c *Context, paramName string, defaultValue T, opts ...any) (T, error) Source: binder_generic.go:85 PathParamOr extracts and parses a path parameter from the context by name. Returns defaultValue if the parameter is not found or has an empty value. Returns an error only if parsing fails (e.g., "abc" for int type). Example: Copy id, err := echo.PathParamOr[int](c, "id", 0) // If "id" is missing: returns (0, nil) // If "id" is "123": returns (123, nil) // If "id" is "abc": returns (0, BindingError) See ParseValue for supported types and options func PathValuesBinder(c *Context) *ValueBinder Source: binder.go:142 PathValuesBinder creates path parameter value binder func QueryParam[T any](c *Context, key string, opts ...any) (T, error) Source: binder_generic.go:114 QueryParam extracts and parses a single query parameter from the request by key. It returns the typed value and an error if binding fails. Returns ErrNonExistentKey if parameter not found. Empty String Handling: Copy If the parameter exists but has an empty value (?key=), the zero value of type T is returned with no error. For example, "?count=" returns (0, nil) for int types. This differs from standard library behavior where parsing empty strings returns errors. To treat empty values as errors, validate the result separately or check the raw value. Behavior Summary: Missing key (?other=value): returns (zero, ErrNonExistentKey) Empty value (?key=): returns (zero, nil) Invalid value (?key=abc for int): returns (zero, BindingError) See ParseValue for supported types and options func QueryParamOr[T any](c *Context, key string, defaultValue T, opts ...any) (T, error) Source: binder_generic.go:144 QueryParamOr extracts and parses a single query parameter from the request by key. Returns defaultValue if the parameter is not found or has an empty value. Returns an error only if parsing fails (e.g., "abc" for int type). Example: Copy page, err := echo.QueryParamOr[int](c, "page", 1) // If "page" is missing: returns (1, nil) // If "page" is "5": returns (5, nil) // If "page" is "abc": returns (1, BindingError) See ParseValue for supported types and options func QueryParams[T any](c *Context, key string, opts ...any) ([]T, error) Source: binder_generic.go:164 QueryParams extracts and parses all values for a query parameter key as a slice. It returns the typed slice and an error if binding any value fails. Returns ErrNonExistentKey if parameter not found. See ParseValues for supported types and options func QueryParamsBinder(c *Context) *ValueBinder Source: binder.go:126 QueryParamsBinder creates query parameter value binder func QueryParamsOr[T any](c *Context, key string, defaultValue []T, opts ...any) ([]T, error) Source: binder_generic.go:189 QueryParamsOr extracts and parses all values for a query parameter key as a slice. Returns defaultValue if the parameter is not found. Returns an error only if parsing any value fails. Example: Copy ids, err := echo.QueryParamsOr[int](c, "ids", []int{}) // If "ids" is missing: returns ([], nil) // If "ids" is "1&ids=2": returns ([1, 2], nil) // If "ids" contains "abc": returns ([], BindingError) See ParseValues for supported types and options func ResolveResponseStatus(rw http.ResponseWriter, err error) (resp *Response, status int) Source: httperror.go:66 ResolveResponseStatus returns the Response and HTTP status code that should be (or has been) sent for rw, given an optional error. This function is useful for middleware and handlers that need to figure out the HTTP status code to return based on the error that occurred or what was set in the response. Precedence rules: If the response has already been committed, the committed status wins (err is ignored). Otherwise, start with 200 OK (net/http default if WriteHeader is never called). If the response has a non-zero suggested status, use it. If err != nil, it overrides the suggested status: StatusCode(err) if non-zero otherwise 500 Internal Server Error. func StaticDirectoryHandler(fileSystem fs.FS, disablePathUnescaping bool) HandlerFunc Source: echo.go:650 StaticDirectoryHandler creates handler function to serve files from provided file system When disablePathUnescaping is set then file name from path is not unescaped and is served as is. Note: when disablePathUnescaping=false, the handler decodes the wildcard param before serving. If route guards (e.g. e.GET("/admin/*", forbidden)) are used to restrict parts of the filesystem, an encoded separator (%2F) or encoded dot-dot (%2E%2E) in the URL can resolve to a path that the router never matched against the guard route. Enabling RouterConfig.UseEscapedPathForMatching does NOT fix this — it changes which path the router uses for matching but still lets path.Clean resolve ".." segments into a guarded directory. Do not rely on route guards alone to restrict a filesystem served by this handler. See https://github.com/labstack/echo/security/advisories/GHSA-vfp3-v2gw-7wfq func StaticFileHandler(file string, filesystem fs.FS) HandlerFunc Source: echo.go:693 StaticFileHandler creates handler function to serve file from provided file system. Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for file operations. func StatusCode(err error) int Source: httperror.go:45 StatusCode returns status code from err if it implements HTTPStatusCoder interface. If err does not implement the interface, it returns 0. func TrustIPRange(ipRange *net.IPNet) TrustOption Source: ip.go:168 TrustIPRange add trustable IP ranges using CIDR notation. func TrustLinkLocal(v bool) TrustOption Source: ip.go:154 TrustLinkLocal configures if you trust link-local address (default: true). func TrustLoopback(v bool) TrustOption Source: ip.go:147 TrustLoopback configures if you trust loopback address (default: true). func TrustPrivateNet(v bool) TrustOption Source: ip.go:161 TrustPrivateNet configures if you trust private network address (default: true). func UnwrapResponse(rw http.ResponseWriter) (*Response, error) Source: response.go:121 UnwrapResponse unwraps given ResponseWriter to return contexts original Echo Response. rw has to implement following method Unwrap() http.ResponseWriter func WrapHandler(h http.Handler) HandlerFunc Source: echo.go:848 WrapHandler wraps http.Handler into echo.HandlerFunc . func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc Source: echo.go:862 WrapMiddleware wraps func(http.Handler) http.Handler into echo.MiddlewareFunc Types type AddRouteError Source: router.go:489 AddRouteError is error returned by Router.Add containing information what actual route adding failed. Useful for mass adding (i.e. Any() routes) Copy type AddRouteError struct { Err error Method string Path string } Fields Err error Method string Path string func Error) Error() string Source: router.go:495 func Unwrap() error Source: router.go:497 type BindUnmarshaler Source: bind.go:31 BindUnmarshaler is the interface used to wrap the UnmarshalParam method. Types that don't implement this, but do implement encoding.TextUnmarshaler will use that interface instead. Copy type BindUnmarshaler interface { // UnmarshalParam decodes and assigns a value from an form or query param. UnmarshalParam ( param string ) error } Methods UnmarshalParam func(param string) error UnmarshalParam decodes and assigns a value from an form or query param. type Binder Source: bind.go:21 Binder is the interface that wraps the Bind method. Copy type Binder interface { Bind ( c * Context , target any ) error } Methods Bind func(c *Context, target any) error type BindingError Source: binder.go:72 BindingError represents an error that occurred while binding request data. Note: JSON serialization is handled by the MarshalJSON method below, not by the struct tags (which are kept for documentation). MarshalJSON emits {"field","message"}. Copy type BindingError struct { // Field is the field name where value binding failed Field string `json:"field"` * HTTPError // Values of parameter that failed to bind. Values [] string `json:"-"` } Fields Field string `json:"field"` Field is the field name where value binding failed *HTTPError Values []string `json:"-"` Values of parameter that failed to bind. func Error) Error() string Source: binder.go:90 Error returns error message func MarshalJSON() ([]byte, error) Source: binder.go:98 MarshalJSON implements json.Marshaler so that binding errors are serialized into a structured response (e.g. {"field":"id","message":"..."}) rather than being flattened to a generic message. DefaultHTTPErrorHandler routes errors that implement json.Marshaler through their own encoding. type Config Source: echo.go:255 Config is configuration for NewWithConfig function Copy type Config struct { // Logger is the slog logger instance used for application-wide structured logging. // If not set, a default TextHandler writing to stdout is created. Logger * slog . Logger // HTTPErrorHandler is the centralized error handler that processes errors returned // by handlers and middleware, converting them to appropriate HTTP responses. // If not set, DefaultHTTPErrorHandler(false) is used. HTTPErrorHandler HTTPErrorHandler // Router is the HTTP request router responsible for matching URLs to handlers // using a radix tree-based algorithm. // If not set, NewRouter(RouterConfig{}) is used. Router Router // OnAddRoute is an optional callback hook executed when routes are registered. // Useful for route validation, logging, or custom route processing. // If not set, no callback is executed. OnAddRoute func ( route Route ) error // Filesystem is the fs.FS implementation used for serving static files. // Supports os.DirFS, embed.FS, and custom implementations. // If not set, defaults to current working directory. Filesystem fs . FS // Binder handles automatic data binding from HTTP requests to Go structs. // Supports JSON, XML, form data, query parameters, and path parameters. // If not set, DefaultBinder is used. Binder Binder // Validator provides optional struct validation after data binding. // Commonly used with third-party validation libraries. // If not set, Context.Validate() returns ErrValidatorNotRegistered. Validator Validator // Renderer provides template rendering for generating HTML responses. // Requires integration with a template engine like html/template. // If not set, Context.Render() returns ErrRendererNotRegistered. Renderer Renderer // JSONSerializer handles JSON encoding and decoding for HTTP requests/responses. // Can be replaced with faster alternatives like jsoniter or sonic. // If not set, DefaultJSONSerializer using encoding/json is used. JSONSerializer JSONSerializer // IPExtractor defines the strategy for extracting the real client IP address // from requests, particularly important when behind proxies or load balancers. // Used for rate limiting, access control, and logging. // If not set, falls back to checking X-Forwarded-For and X-Real-IP headers. IPExtractor IPExtractor // FormParseMaxMemory is default value for memory limit that is used // when parsing multipart forms (See (*http.Request).ParseMultipartForm) FormParseMaxMemory int64 // EnablePathUnescapingStaticFiles enables path parameter (param: *) unescaping for static file methods. // Default false (safe): encoded slashes (%2f) in the wildcard param are NOT decoded, // preventing ACL bypass where /admin%2fprivate.txt bypasses a /admin/* route guard by // not matching that route but having its wildcard param decoded to admin/private.txt. // Set to true only when serving files whose names contain URL-encoded characters // (e.g. "hello world.txt" via /hello%20world.txt) and you are not relying on // route-based ACL guards to restrict access. // If you are enabling this option, make sure you understand the security implications. // See: https://github.com/labstack/echo/security/advisories/GHSA-vfp3-v2gw-7wfq // // Enabling RouterConfig.UseEscapedPathForMatching makes this field irrelevant and can lead to security issues when // using different Routes to exclude some of the files from being served. // e.g. if you serve files from directory as such and use different route to exclude some of the files from being served. // 0. given folder structure: // public/ // public/index.html // public/admin/private.txt // 1. share `public/` folder contents from the server root with `e.Static("/", "public")` // 2. naively assume that everything under /admin folder is now forbidden // e.GET("/admin/*", func(c *Context) error { return echo.ErrForbidden }) // Then request to `/assets/../admin%2fprivate.txt` will be served as router does not match it to guarded route. // // Applies to methods: Echo.Static, Echo.StaticFS, Group.Static, Group.StaticFS. EnablePathUnescapingStaticFiles bool // NoGroupAutoRegister404Routes bool is a flag that indicates whether echo.Group should NOT register 404 routes automatically // when there are middlewares registered with the group. // Note: if you decide not to register 404 routes automatically, make sure to check if all your middlewares are executed // as expected. For example - CORS middleware. NoGroupAutoRegister404Routes bool } Fields Logger *slog.Logger Logger is the slog logger instance used for application-wide structured logging. If not set, a default TextHandler writing to stdout is created. HTTPErrorHandler HTTPErrorHandler HTTPErrorHandler is the centralized error handler that processes errors returned by handlers and middleware, converting them to appropriate HTTP responses. If not set, DefaultHTTPErrorHandler(false) is used. Router Router Router is the HTTP request router responsible for matching URLs to handlers using a radix tree-based algorithm. If not set, NewRouter(RouterConfig{}) is used. OnAddRoute func(route Route) error OnAddRoute is an optional callback hook executed when routes are registered. Useful for route validation, logging, or custom route processing. If not set, no callback is executed. Filesystem fs.FS Filesystem is the fs.FS implementation used for serving static files. Supports os.DirFS, embed.FS, and custom implementations. If not set, defaults to current working directory. Binder Binder Binder handles automatic data binding from HTTP requests to Go structs. Supports JSON, XML, form data, query parameters, and path parameters. If not set, DefaultBinder is used. Validator Validator Validator provides optional struct validation after data binding. Commonly used with third-party validation libraries. If not set, Context.Validate() returns ErrValidatorNotRegistered. Renderer Renderer Renderer provides template rendering for generating HTML responses. Requires integration with a template engine like html/template. If not set, Context.Render() returns ErrRendererNotRegistered. JSONSerializer JSONSerializer JSONSerializer handles JSON encoding and decoding for HTTP requests/responses. Can be replaced with faster alternatives like jsoniter or sonic. If not set, DefaultJSONSerializer using encoding/json is used. IPExtractor IPExtractor IPExtractor defines the strategy for extracting the real client IP address from requests, particularly important when behind proxies or load balancers. Used for rate limiting, access control, and logging. If not set, falls back to checking X-Forwarded-For and X-Real-IP headers. FormParseMaxMemory int64 FormParseMaxMemory is default value for memory limit that is used when parsing multipart forms (See (*http.Request).ParseMultipartForm) EnablePathUnescapingStaticFiles bool EnablePathUnescapingStaticFiles enables path parameter (param: ) unescaping for static file methods. Default false (safe): encoded slashes (%2f) in the wildcard param are NOT decoded, preventing ACL bypass where /admin%2fprivate.txt bypasses a /admin/ route guard by not matching that route but having its wildcard param decoded to admin/private.txt. Set to true only when serving files whose names contain URL-encoded characters (e.g. "hello world.txt" via /hello%20world.txt) and you are not relying on route-based ACL guards to restrict access. If you are enabling this option, make sure you understand the security implications. See: https://github.com/labstack/echo/security/advisories/GHSA-vfp3-v2gw-7wfq Enabling RouterConfig.UseEscapedPathForMatching makes this field irrelevant and can lead to security issues when using different Routes to exclude some of the files from being served. e.g. if you serve files from directory as such and use different route to exclude some of the files from being served. 0. given folder structure: public/ public/index.html public/admin/private.txt share public/ folder contents from the server root with e.Static("/", "public") naively assume that everything under /admin folder is now forbidden e.GET("/admin/*", func(c *Context) error { return echo.ErrForbidden }) Then request to /assets/../admin%2fprivate.txt will be served as router does not match it to guarded route. Applies to methods: Echo.Static, Echo.StaticFS, Group.Static, Group.StaticFS. NoGroupAutoRegister404Routes bool NoGroupAutoRegister404Routes bool is a flag that indicates whether echo.Group should NOT register 404 routes automatically when there are middlewares registered with the group. Note: if you decide not to register 404 routes automatically, make sure to check if all your middlewares are executed as expected. For example - CORS middleware. type Context Source: context.go:64 Context represents the context of the current HTTP request. It holds request and response objects, path, path parameters, data and registered handler. Copy type Context struct { // contains filtered or unexported fields } func Attachment(file, name string) error Source: context.go:706 Attachment sends a response as attachment, prompting client to save the file. Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for file operations. func Bind(i any) error Source: context.go:478 Bind binds path params, query params and the request body into provided type i . The default binder binds body based on Content-Type header. func Blob(code int, contentType string, b []byte) (err error) Source: context.go:642 Blob sends a blob response with status code and content type. func Cookie(name string) (*http.Cookie, error) Source: context.go:442 Cookie returns the named cookie provided in the request. func Cookies() []*http.Cookie Source: context.go:452 Cookies returns the HTTP cookies sent with the request. func Echo() *Echo Source: context.go:755 Echo returns the Echo instance. func File(file string) error Source: context.go:661 File sends a response with the content of the file. Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for file operations. func FileFS(file string, filesystem fs.FS) error Source: context.go:670 FileFS serves file from given file system. When dealing with embed.FS use fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary prefix for directory path. This is necessary as //go:embed assets/images embeds files with paths including assets/images` as their prefix. func FormFile(name string) (*multipart.FileHeader, error) Source: context.go:426 FormFile returns the multipart form file for the provided name. func FormValue(name string) string Source: context.go:397 FormValue returns the form field value for the provided name. func FormValueOr(name, defaultValue string) string Source: context.go:403 FormValueOr returns the form field value or default value for the provided name. Note: FormValueOr does not distinguish if form had no value by that name or value was empty string func FormValues() (url.Values, error) Source: context.go:412 FormValues returns the form field values as url.Values . func Get(key string) any Source: context.go:458 Get retrieves data from the context. Method returns any(nil) when key does not exist which is different from typed nil (eg. []byte(nil)). func HTML(code int, html string) (err error) Source: context.go:514 HTML sends an HTTP response with status code. func HTMLBlob(code int, b []byte) (err error) Source: context.go:519 HTMLBlob sends an HTTP blob response with status code. func InitializeRoute(ri *RouteInfo, pathValues *PathValues) Source: context.go:313 InitializeRoute sets the route related variables of this request to the context. func Inline(file, name string) error Source: context.go:714 Inline sends a response as inline, opening the file in the browser. Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for file operations. func IsTLS() bool Source: context.go:188 IsTLS returns true if HTTP connection is TLS otherwise false. func IsWebSocket() bool Source: context.go:193 IsWebSocket returns true if HTTP connection is WebSocket otherwise false. func JSON(code int, i any) (err error) Source: context.go:569 JSON sends a JSON response with status code. func JSONBlob(code int, b []byte) (err error) Source: context.go:579 JSONBlob sends a JSON blob response with status code. func JSONP(code int, callback string, i any) (err error) Source: context.go:585 JSONP sends a JSONP response with status code. It uses callback to construct the JSONP payload. func JSONPBlob(code int, callback string, b []byte) (err error) Source: context.go:591 JSONPBlob sends a JSONP blob response with status code. It uses callback to construct the JSONP payload. func JSONPretty(code int, i any, indent string) (err error) Source: context.go:574 JSONPretty sends a pretty-print JSON with status code. func Logger() *slog.Logger Source: context.go:742 Logger returns logger in Context func MultipartForm() (*multipart.Form, error) Source: context.go:436 MultipartForm returns the multipart form. func NoContent(code int) error Source: context.go:726 NoContent sends a response with no body and a status code. func Param(name string) string Source: context.go:283 Param returns path parameter by name. func ParamOr(name, defaultValue string) string Source: context.go:295 ParamOr returns the path parameter or default value for the provided name. Notes for DefaultRouter implementation: Path parameter could be empty for cases like that: route /release-:version/bin and request URL is /release-/bin route /api/:version/image.jpg and request URL is /api//image.jpg but not when path parameter is last part of route path route /download/file.:ext will not match request /download/file. func Path() string Source: context.go:260 Path returns the registered path for the handler. func PathValues() PathValues Source: context.go:300 PathValues returns path parameter values. func QueryParam(name string) string Source: context.go:337 QueryParam returns the query param for the provided name. func QueryParamOr(name, defaultValue string) string Source: context.go:375 QueryParamOr returns the query param or default value for the provided name. Note: QueryParamOr does not distinguish if query had no value by that name or value was empty string This means URLs /test?search= and /test would both return 1 for c.QueryParamOr("search", "1") func QueryParams() url.Values Source: context.go:384 QueryParams returns the query parameters as url.Values . func QueryString() string Source: context.go:392 QueryString returns the URL query string. func RealIP() string Source: context.go:249 RealIP returns the client IP address using the configured extraction strategy. If Echo#IPExtractor is set, it is used to resolve the client IP from the incoming request (typically via proxy headers such as X-Forwarded-For or X-Real-IP). Look into the ip.go file for comments and examples. See: Echo#ExtractIPFromXFFHeader for X-Forwarded-For handling with trust checks Echo#ExtractIPFromRealIPHeader for X-Real-IP handling with trust checks Echo#LegacyIPExtractor for v4 compatibility (spoofable, no trust checks built in) If no extractor is configured, RealIP falls back to the request RemoteAddr, returning only the host portion. Notes: No validation or trust enforcement is performed unless implemented by the configured IPExtractor. When relying on proxy headers, ensure the application is deployed behind trusted intermediaries to avoid spoofing. func Redirect(code int, url string) error Source: context.go:732 Redirect redirects the request to a provided URL with status code. func Render(code int, name string, data any) (err error) Source: context.go:493 Render renders a template with data and sends a text/html response with status code. Renderer must be registered using Echo.Renderer . func Request() *http.Request Source: context.go:167 Request returns *http.Request . func Reset(r *http.Request, w http.ResponseWriter) Source: context.go:141 Reset resets the context after request completes. It must be called along with Echo#AcquireContext() and Echo#ReleaseContext() . See Echo#ServeHTTP() func Response() http.ResponseWriter Source: context.go:177 Response returns *Response . func RouteInfo() RouteInfo Source: context.go:275 RouteInfo returns current request route information. Method, Path, Name and params if they exist for matched route. RouteInfo returns generic "empty" struct for these cases: Context is accessed before Routing is done. For example inside Pre middlewares ( e.Pre() ) Router did not find matching route - 404 (route not found) Router did not find matching route with same method - 405 (method not allowed) func Scheme() string Source: context.go:212 Scheme returns the HTTP protocol scheme, http or https . func Set(key string, val any) Source: context.go:467 Set saves data in the context. func SetCookie(cookie *http.Cookie) Source: context.go:447 SetCookie adds a Set-Cookie header in HTTP response. func SetLogger(logger *slog.Logger) Source: context.go:750 SetLogger sets logger in Context func SetPath(p string) Source: context.go:265 SetPath sets the registered path for the handler. func SetPathValues(pathValues PathValues) Source: context.go:305 SetPathValues sets path parameters for current request. func SetRequest(r *http.Request) Source: context.go:172 SetRequest sets *http.Request . func SetResponse(r http.ResponseWriter) Source: context.go:183 SetResponse sets *http.ResponseWriter . Some context methods and/or middleware require that given ResponseWriter implements following method Unwrap() http.ResponseWriter which eventually should return *echo.Response instance. func Stream(code int, contentType string, r io.Reader) (err error) Source: context.go:650 Stream sends a streaming response with status code and content type. func String(code int, s string) (err error) Source: context.go:524 String sends a string response with status code. func Validate(i any) error Source: context.go:484 Validate validates provided i . It is usually called after Context#Bind() . Validator must be registered using Echo#Validator . func XML(code int, i any) (err error) Source: context.go:621 XML sends an XML response with status code. func XMLBlob(code int, b []byte) (err error) Source: context.go:631 XMLBlob sends an XML blob response with status code. func XMLPretty(code int, i any, indent string) (err error) Source: context.go:626 XMLPretty sends a pretty-print XML with status code. type DefaultBinder Source: bind.go:26 DefaultBinder is the default implementation of the Binder interface. Copy type DefaultBinder struct {} func Binder) Bind(c *Context, target any) error Source: bind.go:124 Bind implements the Binder#Bind function. Binding is done in following order: 1) path params; 2) query params; 3) request body. Each step COULD override previous step bound values. For single source binding use their own methods BindBody, BindQueryParams, BindPathValues. type DefaultJSONSerializer Source: json.go:13 DefaultJSONSerializer implements JSON encoding using encoding/json. Copy type DefaultJSONSerializer struct {} func Deserialize(c *Context, target any) error Source: json.go:47 Deserialize reads a JSON from a request body and converts it into an interface. The body is read into a pooled buffer and decoded with json.Unmarshal rather than streaming through json.NewDecoder. This avoids allocating a decoder and its internal read buffer on every request. json.Unmarshal does not retain a reference to the input slice, so the buffer is safe to reuse afterwards. Note: the full request body is read into memory before decoding. As with any JSON parser, decoding untrusted input can allocate large amounts of memory; guard such endpoints with middleware.BodyLimit (or http.MaxBytesReader), which makes the body read here fail fast once the limit is exceeded. func Serializer) Serialize(c *Context, target any, indent string) error Source: json.go:28 Serialize converts an interface into a json and writes it to the response. You can optionally use the indent parameter to produce pretty JSONs. type DefaultRouter Source: router.go:60 DefaultRouter is the registry of all registered routes for an Echo instance for request matching and URL path parameter parsing. Note: DefaultRouter is not coroutine-safe. Do not Add/Remove routes after HTTP server has been started with Echo. Copy type DefaultRouter struct { // contains filtered or unexported fields } func Add(route Route) (RouteInfo, error) Source: router.go:508 Add registers a new route for method and path with matching handler. func Remove(method string, path string) error Source: router.go:384 Remove unregisters registered route func Router) Route(c *Context) HandlerFunc Source: router.go:884 Route looks up a handler registered for method and path. It also parses URL for path parameters and loads them into context. For performance: Get context from Echo#AcquireContext() Reset it Context#Reset() Return it Echo#ReleaseContext() . func Routes() Routes Source: router.go:379 Routes returns all registered routes type Echo Source: echo.go:69 Echo is the top-level framework instance. Goroutine safety: Do not mutate Echo instance fields after server has started. Accessing these fields from handlers/middlewares and changing field values at the same time leads to data-races. Same rule applies to adding new routes after server has been started - Adding a route is not Goroutine safe action. Copy type Echo struct { Binder Binder // Filesystem is the file system used for serving static files. Defaults to the current working directory (os.Getwd()). // // Note: fs.FS.Open() already assumes that file names are relative to FS root path and considers name with prefix `/` as invalid // so if you have `fs := os.DirFS("/tmp")` and you try to `fs.Open("/tmp/file.txt")` it will fail, but "file.txt" // would succeed. `echo.NewDefaultFS("/tmp")` overwrites this behavior and allows you to use Open with a matching // absolute path prefix. Filesystem fs . FS Renderer Renderer Validator Validator JSONSerializer JSONSerializer IPExtractor IPExtractor OnAddRoute func ( route Route ) error HTTPErrorHandler HTTPErrorHandler Logger * slog . Logger // contains filtered or unexported fields } Fields Binder Binder Filesystem fs.FS Filesystem is the file system used for serving static files. Defaults to the current working directory (os.Getwd()). Note: fs.FS.Open() already assumes that file names are relative to FS root path and considers name with prefix / as invalid so if you have fs := os.DirFS("/tmp") and you try to fs.Open("/tmp/file.txt") it will fail, but "file.txt" would succeed. echo.NewDefaultFS("/tmp") overwrites this behavior and allows you to use Open with a matching absolute path prefix. Renderer Renderer Validator Validator JSONSerializer JSONSerializer IPExtractor IPExtractor OnAddRoute func(route Route) error HTTPErrorHandler HTTPErrorHandler Logger *slog.Logger func AcquireContext() *Context Source: echo.go:782 AcquireContext returns an empty Context instance from the pool. You must return the context by calling ReleaseContext() . func Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo Source: echo.go:736 Add registers a new route for an HTTP method and path with matching handler in the router with optional route-level middleware. func AddRoute(route Route) (RouteInfo, error) Source: echo.go:711 AddRoute registers a new Route with default host Router func Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo Source: echo.go:586 Any registers a new route for all HTTP methods (supported by Echo) and path with matching handler in the router with optional route-level middleware. Note: this method only adds specific set of supported HTTP methods as handler and is not true "catch-any-arbitrary-method" way of matching requests. func CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: echo.go:513 CONNECT registers a new CONNECT route for a path with matching handler in the router with optional route-level middleware. Panics on error. func DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: echo.go:519 DELETE registers a new DELETE route for a path with matching handler in the router with optional route-level middleware. Panics on error. func File(path, file string, middleware ...MiddlewareFunc) RouteInfo Source: echo.go:703 File registers a new route with path to serve a static file with optional route-level middleware. Panics on error. Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for file operations. func FileFS(path, file string, filesystem fs.FS, m ...MiddlewareFunc) RouteInfo Source: echo.go:685 FileFS registers a new route with path to serve file from the provided file system. Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for file operations. func GET(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: echo.go:525 GET registers a new GET route for a path with matching handler in the router with optional route-level middleware. Panics on error. func Group(prefix string, m ...MiddlewareFunc) (g *Group) Source: echo.go:753 Group creates a new router group with prefix and optional group-level middleware. func HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: echo.go:531 HEAD registers a new HEAD route for a path with matching handler in the router with optional route-level middleware. Panics on error. func Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) Routes Source: echo.go:592 Match registers a new route for multiple HTTP methods and path with matching handler in the router with optional route-level middleware. Panics on error. func Middlewares() []MiddlewareFunc Source: echo.go:776 Middlewares returns registered route level middlewares. Does not contain any group level middlewares. Use this method to build your own ServeHTTP method. NOTE: returned slice is not a copy. Do not mutate. func NewContext(r *http.Request, w http.ResponseWriter) *Context Source: echo.go:431 NewContext returns a new Context instance. Note: both request and response can be left to nil as Echo.ServeHTTP will call c.Reset(req,resp) anyway these arguments are useful when creating context for tests and cases like that. func OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: echo.go:537 OPTIONS registers a new OPTIONS route for a path with matching handler in the router with optional route-level middleware. Panics on error. func PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: echo.go:543 PATCH registers a new PATCH route for a path with matching handler in the router with optional route-level middleware. Panics on error. func POST(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: echo.go:549 POST registers a new POST route for a path with matching handler in the router with optional route-level middleware. Panics on error. func PUT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: echo.go:555 PUT registers a new PUT route for a path with matching handler in the router with optional route-level middleware. Panics on error. func Pre(middleware ...MiddlewareFunc) Source: echo.go:500 Pre adds middleware to the chain which is run before router tries to find matching route. Meaning middleware is executed even for 404 (not found) cases. func PreMiddlewares() []MiddlewareFunc Source: echo.go:768 PreMiddlewares returns registered pre middlewares. These are middleware to the chain which are run before router tries to find matching route. Use this method to build your own ServeHTTP method. NOTE: returned slice is not a copy. Do not mutate. func QUERY(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: echo.go:561 QUERY registers a new QUERY route for a path with matching handler in the router with optional route-level middleware. Panics on error. func ReleaseContext(c *Context) Source: echo.go:788 ReleaseContext returns the Context instance back to the pool. You must call it after AcquireContext() . func RouteNotFound(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: echo.go:577 RouteNotFound registers a special-case route which is executed when no other route is found (i.e. HTTP 404 cases) for current request URL. Path supports static and named/any parameters just like other http method is defined. Generally path is ended with wildcard/match-any character ( /* , /download/* etc). Example: e.RouteNotFound("/*", func(c *echo.Context) error { return c.NoContent(http.StatusNotFound) }) func Router() Router Source: echo.go:436 Router returns the default router. func ServeHTTP(w http.ResponseWriter, r *http.Request) Source: echo.go:793 ServeHTTP implements http.Handler interface, which serves HTTP requests. func Start(address string) error Source: echo.go:840 Start stars HTTP server on given address with Echo as a handler serving requests. The server can be shutdown by sending os.Interrupt signal with ctrl+c . Method returns only errors that are not http.ErrServerClosed. Note: this method is created for use in examples/demos and is deliberately simple without providing configuration options. In need of customization use: Copy ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) defer cancel() sc := echo.StartConfig{Address: ":8080"} if err := sc.Start(ctx, e); err != nil && !errors.Is(err, http.ErrServerClosed) { slog.Error(err.Error()) } // or standard library http.Server Copy s := http.Server{Addr: ":8080", Handler: e} if err := s.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) { slog.Error(err.Error()) } func Static(pathPrefix, fsRoot string, middleware ...MiddlewareFunc) RouteInfo Source: echo.go:615 Static registers a new route with path prefix to serve static files from the provided root directory. func StaticFS(pathPrefix string, filesystem fs.FS, middleware ...MiddlewareFunc) RouteInfo Source: echo.go:630 StaticFS registers a new route with path prefix to serve static files from the provided file system. When dealing with embed.FS use fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary prefix for directory path. This is necessary as //go:embed assets/images embeds files with paths including assets/images` as their prefix. func TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: echo.go:567 TRACE registers a new TRACE route for a path with matching handler in the router with optional route-level middleware. Panics on error. func Use(middleware ...MiddlewareFunc) Source: echo.go:506 Use adds middleware to the chain which is run after router has found matching route and before route/request handler method is executed. type Group Source: group.go:14 Group is a set of sub-routes for a specified route. It can be used for inner routes that share a common middleware or functionality that should be separate from the parent echo instance while still inheriting from it. Copy type Group struct { // contains filtered or unexported fields } func Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo Source: group.go:186 Add implements Echo#Add() for sub-routes within the Group. Panics on error. func AddRoute(route Route) (RouteInfo, error) Source: group.go:200 AddRoute registers a new Routable with Router func Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo Source: group.go:99 Any implements Echo#Any() for sub-routes within the Group. Panics on error. func CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: group.go:49 CONNECT implements Echo#CONNECT() for sub-routes within the Group. Panics on error. func DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: group.go:54 DELETE implements Echo#DELETE() for sub-routes within the Group. Panics on error. func File(path, file string, middleware ...MiddlewareFunc) RouteInfo Source: group.go:171 File implements Echo#File() for sub-routes within the Group. Panics on error. Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for file operations. func FileFS(path, file string, filesystem fs.FS, m ...MiddlewareFunc) RouteInfo Source: group.go:163 FileFS implements Echo#FileFS() for sub-routes within the Group. Avoid using the leading / slash as most of the Go standard library fs.FS implementations require relative paths for file operations. func GET(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: group.go:59 GET implements Echo#GET() for sub-routes within the Group. Panics on error. func Group) Group(prefix string, middleware ...MiddlewareFunc) (sg *Group) Source: group.go:131 Group creates a new sub-group with prefix and optional sub-group-level middleware. Important! Group middlewares are executed in case there was no exact route match as by default Group registers /* NotFound routes for itself. If this kind of behavior is not needed, then create an Echo instance with the noAutoRegisterRoutes flag set to true. Example echo.NewWithConfig(echo.Config{NoGroupAutoRegister404Routes: true}) . func HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: group.go:64 HEAD implements Echo#HEAD() for sub-routes within the Group. Panics on error. func Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) Routes Source: group.go:104 Match implements Echo#Match() for sub-routes within the Group. Panics on error. func OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: group.go:69 OPTIONS implements Echo#OPTIONS() for sub-routes within the Group. Panics on error. func PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: group.go:74 PATCH implements Echo#PATCH() for sub-routes within the Group. Panics on error. func POST(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: group.go:79 POST implements Echo#POST() for sub-routes within the Group. Panics on error. func PUT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: group.go:84 PUT implements Echo#PUT() for sub-routes within the Group. Panics on error. func QUERY(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: group.go:89 QUERY implements Echo#QUERY() for sub-routes within the Group. Panics on error. func RouteNotFound(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: group.go:181 RouteNotFound implements Echo#RouteNotFound() for sub-routes within the Group. Example: g.RouteNotFound("/*", func(c *echo.Context) error { return c.NoContent(http.StatusNotFound) }) func Static(pathPrefix, fsRoot string, middleware ...MiddlewareFunc) RouteInfo Source: group.go:140 Static implements Echo#Static() for sub-routes within the Group. func StaticFS(pathPrefix string, filesystem fs.FS, middleware ...MiddlewareFunc) RouteInfo Source: group.go:150 StaticFS implements Echo#StaticFS() for sub-routes within the Group. When dealing with embed.FS use fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary prefix for directory path. This is necessary as //go:embed assets/images embeds files with paths including assets/images` as their prefix. func TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo Source: group.go:94 TRACE implements Echo#TRACE() for sub-routes within the Group. Panics on error. func Use(middleware ...MiddlewareFunc) Source: group.go:31 Use implements Echo#Use() for sub-routes within the Group. Important! Group middlewares are executed in case there was no exact route match as by default Group registers /* NotFound routes for itself. If this kind of behavior is not needed, then create an Echo instance with the noAutoRegisterRoutes flag set to true. Example echo.NewWithConfig(echo.Config{NoGroupAutoRegister404Routes: true}) . type HTTPError Source: httperror.go:107 HTTPError represents an error that occurred while handling a request. Copy type HTTPError struct { // Code is status code for HTTP response Code int `json:"-"` Message string `json:"message"` // contains filtered or unexported fields } Fields Code int `json:"-"` Code is status code for HTTP response Message string `json:"message"` func Error) Error() string Source: httperror.go:120 Error makes it compatible with the error interface. func StatusCode() int Source: httperror.go:115 StatusCode returns status code for HTTP response func Unwrap() error Source: httperror.go:140 func Wrap(err error) error Source: httperror.go:132 Wrap returns a new HTTPError with given errors wrapped inside type HTTPErrorHandler Source: echo.go:127 HTTPErrorHandler is a centralized HTTP error handler. Copy type HTTPErrorHandler func ( c * Context , err error ) type HTTPStatusCoder Source: httperror.go:39 HTTPStatusCoder is an interface that errors can implement to produce status code for HTTP response Copy type HTTPStatusCoder interface { StatusCode () int } Methods StatusCode func() int type HandlerFunc Source: echo.go:130 HandlerFunc defines a function to serve HTTP requests. Copy type HandlerFunc func ( c * Context ) error type IPExtractor Source: ip.go:203 IPExtractor is a function to extract IP addr from http.Request. Set appropriate one to Echo#IPExtractor. See https://echo.labstack.com/guide/ip-address for more details. Copy type IPExtractor func ( * http . Request ) string type JSONSerializer Source: echo.go:121 JSONSerializer is the interface that encodes and decodes JSON to and from interfaces. Copy type JSONSerializer interface { Serialize ( c * Context , target any , indent string ) error Deserialize ( c * Context , target any ) error } Methods Serialize func(c *Context, target any, indent string) error Deserialize func(c *Context, target any) error type MiddlewareConfigurator Source: echo.go:136 MiddlewareConfigurator defines interface for creating middleware handlers with possibility to return configuration errors instead of panicking. Copy type MiddlewareConfigurator interface { ToMiddleware () ( MiddlewareFunc , error ) } Methods ToMiddleware func() (MiddlewareFunc, error) type MiddlewareFunc Source: echo.go:133 MiddlewareFunc defines a function to process middleware. Copy type MiddlewareFunc func ( next HandlerFunc ) HandlerFunc type PathValue Source: router.go:1146 PathValue is tuple pf path parameter name and its value in request path Copy type PathValue struct { Name string Value string } Fields Name string Value string type PathValues Source: router.go:1143 PathValues is collections of PathValue instances with various helper methods Copy type PathValues [] PathValue func Get(name string) (string, bool) Source: router.go:1152 Get returns path parameter value for given name or false. func GetOr(name string, defaultValue string) string Source: router.go:1162 GetOr returns path parameter value for given name or default value if the name does not exist. type Renderer Source: renderer.go:9 Renderer is the interface that wraps the Render function. Copy type Renderer interface { Render ( c * Context , w io . Writer , templateName string , data any ) error } Methods Render func(c *Context, w io.Writer, templateName string, data any) error type Response Source: response.go:19 Response wraps an http.ResponseWriter and implements its interface to be used by an HTTP handler to construct an HTTP response. See: https://golang.org/pkg/net/http/#ResponseWriter Copy type Response struct { http . ResponseWriter Status int Size int64 Committed bool // contains filtered or unexported fields } Fields http.ResponseWriter Status int Size int64 Committed bool func After(fn func()) Source: response.go:42 After registers a function which is called just after the response is written. func Before(fn func()) Source: response.go:37 Before registers a function which is called just before the response (status) is written. func Flush() Source: response.go:82 Flush implements the http.Flusher interface to allow an HTTP handler to flush buffered data to the client. See http.Flusher func Hijack() (net.Conn, *bufio.ReadWriter, error) Source: response.go:93 Hijack implements the http.Hijacker interface to allow an HTTP handler to take over the connection. This method is relevant to Websocket connection upgrades, proxis, and other advanced use cases. See http.Hijacker func Unwrap() http.ResponseWriter Source: response.go:106 Unwrap returns the original http.ResponseWriter. ResponseController can be used to access the original http.ResponseWriter. See [ https://go.dev/blog/go1.20] func Write(b []byte) (n int, err error) Source: response.go:64 Write writes the data to the connection as part of an HTTP reply. func WriteHeader(code int) Source: response.go:50 WriteHeader sends an HTTP response header with status code. If WriteHeader is not called explicitly, the first call to Write will trigger an implicit WriteHeader(http.StatusOK). Thus explicit calls to WriteHeader are mainly used to send error codes. type Route Source: route.go:16 Route contains information to adding/registering new route with the router. Method+Path pair uniquely identifies the Route. It is mandatory to provide Method+Path fields. Copy type Route struct { Method string Path string Name string // HandlerFunc is a function that handles HTTP requests. This could be left nil when the Router implementation allows // fallback to default/global handlers in certain situations. Handler HandlerFunc Middlewares [] MiddlewareFunc } Fields Method string Path string Name string Handler HandlerFunc HandlerFunc is a function that handles HTTP requests. This could be left nil when the Router implementation allows fallback to default/global handlers in certain situations. Middlewares []MiddlewareFunc func ToRouteInfo(params []string) RouteInfo Source: route.go:28 ToRouteInfo converts Route to RouteInfo func WithPrefix(pathPrefix string, middlewares []MiddlewareFunc) Route Source: route.go:43 WithPrefix recreates Route with added group prefix and group middlewares it is grouped to. type RouteInfo Source: route.go:56 RouteInfo contains information about registered Route. Copy type RouteInfo struct { Name string Method string Path string Parameters [] string } Fields Name string Method string Path string Parameters []string func Clone() RouteInfo Source: route.go:68 Clone creates copy of RouteInfo func Reverse(pathValues ...any) string Source: route.go:78 Reverse reverses route to URL string by replacing path parameters with given params values. type Router Source: router.go:21 Router is interface for routing request contexts to registered routes. Contract between Echo/Context instance and the router: all routes must be added through methods on echo.Echo instance. Reason: Echo instance uses RouteInfo.Params() length to allocate slice for paths parameters (see Echo.contextPathParamAllocSize ). Router must populate Context during Router.Route call with: Context.InitializeRoute (IMPORTANT! to reduce allocations use same slice that c.PathValues() returns) Optionally can set additional information to Context with Context.Set Copy type Router interface { // Add registers Routable with the Router and returns registered RouteInfo. // // Router may change Route.Path value in returned RouteInfo.Path. // Router generates RouteInfo.Parameters values from Route.Path. // Router generates RouteInfo.Name value if it is not provided. Add ( routable Route ) ( RouteInfo , error ) // Remove removes route from the Router. // // Router may choose not to implement this method. Remove ( method string , path string ) error // Routes returns information about all registered routes Routes () Routes // Route searches Router for matching route and applies it to the given context. In case when no matching method // was not found (405) or no matching route exists for path (404), router will return its implementation of 405/404 // handler function. // // Router must populate Context during Router.Route call with: // - Context.InitializeRoute() (IMPORTANT! to reduce allocations use same slice that c.PathValues() returns) // - optionally can set additional information to Context with Context.Set() Route ( c * Context ) HandlerFunc } Methods Add func(routable Route) (RouteInfo, error) Add registers Routable with the Router and returns registered RouteInfo. Router may change Route.Path value in returned RouteInfo.Path. Router generates RouteInfo.Parameters values from Route.Path. Router generates RouteInfo.Name value if it is not provided. Remove func(method string, path string) error Remove removes route from the Router. Router may choose not to implement this method. Routes func() Routes Routes returns information about all registered routes Route func(c *Context) HandlerFunc Route searches Router for matching route and applies it to the given context. In case when no matching method was not found (405) or no matching route exists for path (404), router will return its implementation of 405/404 handler function. Router must populate Context during Router.Route call with: Context.InitializeRoute() (IMPORTANT! to reduce allocations use same slice that c.PathValues() returns) optionally can set additional information to Context with Context.Set() type RouterConfig Source: router.go:76 RouterConfig is configuration options for (default) router Copy type RouterConfig struct { // NotFoundHandler is a handler that is executed when no route matches the request. NotFoundHandler HandlerFunc // MethodNotAllowedHandler is a handler that is executed when no route with exact METHOD matches the request but // there is a route with same path but different method. MethodNotAllowedHandler HandlerFunc // OptionsMethodHandler is a handler that is executed when an OPTIONS request is made. OptionsMethodHandler HandlerFunc // AllowOverwritingRoute allows overwriting existing routes. If false, then adding a route with the same method // and path will return an error. AllowOverwritingRoute bool // UnescapePathParamValues forces router to unescape path parameter values before setting them in context. UnescapePathParamValues bool // UseEscapedPathForMatching forces router to use an escaped path (req.URL.RawPath instead of req.URL.Path) for matching. // Difference between URL.RawPath and URL.Path is: // * URL.Path is where request path is stored. Value is stored in decoded form: /%47%6f%2f becomes /Go/. // * URL.RawPath is an optional field which only gets set if the default encoding is different from Path. UseEscapedPathForMatching bool // AutoHandleHEAD enables automatic handling of HTTP HEAD requests by // falling back to the corresponding GET route. // // When enabled, a HEAD request will match the same handler as GET for // the route, but the response body is suppressed in accordance with // HTTP semantics. Headers (e.g., Content-Length, Content-Type) are // preserved as if a GET request was made. // // Security considerations: the GET handler is fully executed for every // HEAD request, including all side effects: // - State-mutating operations (DB writes, audit logs, counters) run. // - Rate-limiting middleware consumes quota, enabling low-cost exhaustion. // - Expensive computations run with no response body returned to the // caller, making HEAD cheaper to abuse for DoS than GET. // - All GET routes become enumerable via HEAD probing (200 = route // exists, 405 = route absent). // // If route confidentiality/state-mutation is a concern, leave AutoHandleHEAD disabled // and register explicit HEAD handlers only for routes that are safe to // expose (e.g. e.HEAD("/public", handler)). // You can leverage Echo.OnAddRoute callback to add HEAD routes explicitly from a single place. // // Disabled by default. AutoHandleHEAD bool } Fields NotFoundHandler HandlerFunc NotFoundHandler is a handler that is executed when no route matches the request. MethodNotAllowedHandler HandlerFunc MethodNotAllowedHandler is a handler that is executed when no route with exact METHOD matches the request but there is a route with same path but different method. OptionsMethodHandler HandlerFunc OptionsMethodHandler is a handler that is executed when an OPTIONS request is made. AllowOverwritingRoute bool AllowOverwritingRoute allows overwriting existing routes. If false, then adding a route with the same method and path will return an error. UnescapePathParamValues bool UnescapePathParamValues forces router to unescape path parameter values before setting them in context. UseEscapedPathForMatching bool UseEscapedPathForMatching forces router to use an escaped path (req.URL.RawPath instead of req.URL.Path) for matching. Difference between URL.RawPath and URL.Path is: URL.Path is where request path is stored. Value is stored in decoded form: /%47%6f%2f becomes /Go/. URL.RawPath is an optional field which only gets set if the default encoding is different from Path. AutoHandleHEAD bool AutoHandleHEAD enables automatic handling of HTTP HEAD requests by falling back to the corresponding GET route. When enabled, a HEAD request will match the same handler as GET for the route, but the response body is suppressed in accordance with HTTP semantics. Headers (e.g., Content-Length, Content-Type) are preserved as if a GET request was made. Security considerations: the GET handler is fully executed for every HEAD request, including all side effects: State-mutating operations (DB writes, audit logs, counters) run. Rate-limiting middleware consumes quota, enabling low-cost exhaustion. Expensive computations run with no response body returned to the caller, making HEAD cheaper to abuse for DoS than GET. All GET routes become enumerable via HEAD probing (200 = route exists, 405 = route absent). If route confidentiality/state-mutation is a concern, leave AutoHandleHEAD disabled and register explicit HEAD handlers only for routes that are safe to expose (e.g. e.HEAD("/public", handler)). You can leverage Echo.OnAddRoute callback to add HEAD routes explicitly from a single place. Disabled by default. type Routes Source: router.go:55 Routes is collection of RouteInfo instances with various helper methods. Copy type Routes [] RouteInfo func Clone() Routes Source: route.go:111 Clone creates copy of Routes func FilterByMethod(method string) (Routes, error) Source: route.go:144 FilterByMethod searched for matching route info by method func FilterByName(name string) (Routes, error) Source: route.go:180 FilterByName searched for matching route info by name func FilterByPath(path string) (Routes, error) Source: route.go:162 FilterByPath searched for matching route info by path func FindByMethodPath(method string, path string) (RouteInfo, error) Source: route.go:130 FindByMethodPath searched for matching route info by method and path func Reverse(routeName string, pathValues ...any) (string, error) Source: route.go:120 Reverse reverses route to URL string by replacing path parameters with given params values. type StartConfig Source: server.go:26 StartConfig is for creating configured http.Server instance to start serve http(s) requests with given Echo instance Copy type StartConfig struct { // Address specifies the address where listener will start listening on to serve HTTP(s) requests Address string // HideBanner instructs Start* method not to print banner when starting the Server. HideBanner bool // HidePort instructs Start* method not to print port when starting the Server. HidePort bool // CertFilesystem is filesystem is used to read `certFile` and `keyFile` when StartTLS method is called. CertFilesystem fs . FS // TLSConfig is used to configure TLS. If Listener is set, TLSConfig is not used to create the listener. TLSConfig * tls . Config // Listener is used to start server with the custom listener. Listener net . Listener // ListenerNetwork is used configure on which Network listener will use. // If Listener is set, ListenerNetwork is not used. ListenerNetwork string // ListenerAddrFunc will be called after listener is created and started to listen for connections. This is useful in // testing situations when server is started on random port `address = ":0"` in that case you can get actual port where // listener is listening on. ListenerAddrFunc func ( addr net . Addr ) // GracefulTimeout is timeout value (defaults to 10sec) graceful shutdown will wait for server to handle ongoing requests // before shutting down the server. GracefulTimeout time . Duration // OnShutdownError is called when graceful shutdown results an error. for example when listeners are not shut down within // given timeout OnShutdownError func ( err error ) // BeforeServeFunc is callback that is called just before server starts to serve HTTP request. // Use this callback when you want to configure http.Server different timeouts/limits/etc BeforeServeFunc func ( s * http . Server ) error } Fields Address string Address specifies the address where listener will start listening on to serve HTTP(s) requests HideBanner bool HideBanner instructs Start* method not to print banner when starting the Server. HidePort bool HidePort instructs Start* method not to print port when starting the Server. CertFilesystem fs.FS CertFilesystem is filesystem is used to read certFile and keyFile when StartTLS method is called. TLSConfig *tls.Config TLSConfig is used to configure TLS. If Listener is set, TLSConfig is not used to create the listener. Listener net.Listener Listener is used to start server with the custom listener. ListenerNetwork string ListenerNetwork is used configure on which Network listener will use. If Listener is set, ListenerNetwork is not used. ListenerAddrFunc func(addr net.Addr) ListenerAddrFunc will be called after listener is created and started to listen for connections. This is useful in testing situations when server is started on random port address = ":0" in that case you can get actual port where listener is listening on. GracefulTimeout time.Duration GracefulTimeout is timeout value (defaults to 10sec) graceful shutdown will wait for server to handle ongoing requests before shutting down the server. OnShutdownError func(err error) OnShutdownError is called when graceful shutdown results an error. for example when listeners are not shut down within given timeout BeforeServeFunc func(s *http.Server) error BeforeServeFunc is callback that is called just before server starts to serve HTTP request. Use this callback when you want to configure http.Server different timeouts/limits/etc func StartConfig) Start(ctx stdContext.Context, h http.Handler) error Source: server.go:64 Start starts given Handler with HTTP(s) server. func StartTLS(ctx stdContext.Context, h http.Handler, certFile, keyFile any) error Source: server.go:71 StartTLS starts given Handler with HTTPS server. If certFile or keyFile is string the values are treated as file paths. If certFile or keyFile is []byte the values are treated as the certificate or key as-is. type TemplateRenderer Source: renderer.go:23 TemplateRenderer is helper to ease creating renderers for html/template and text/template packages. Example usage: Copy e.Renderer = &echo.TemplateRenderer{ Template: template.Must(template.ParseGlob("templates/*.html")), } e.Renderer = &echo.TemplateRenderer{ Template: template.Must(template.New("hello").Parse("Hello, {{.}}!")), } Copy type TemplateRenderer struct { Template interface { ExecuteTemplate ( wr io . Writer , name string , data any ) error } } Fields Template interface { ExecuteTemplate(wr io.Writer, name string, data any) error } func Renderer) Render(c *Context, w io.Writer, name string, data any) error Source: renderer.go:30 Render renders the template with given data. type TimeLayout Source: binder_generic.go:16 TimeLayout specifies the format for parsing time values in request parameters. It can be a standard Go time layout string or one of the special Unix time layouts. Copy type TimeLayout string type TimeOpts Source: binder_generic.go:19 TimeOpts is options for parsing time.Time values Copy type TimeOpts struct { // Layout specifies the format for parsing time values in request parameters. // It can be a standard Go time layout string or one of the special Unix time layouts. // // Parsing layout defaults to: echo.TimeLayout(time.RFC3339Nano) // - To convert to custom layout use `echo.TimeLayout("2006-01-02")` // - To convert unix timestamp (integer) to time.Time use `echo.TimeLayoutUnixTime` // - To convert unix timestamp in milliseconds to time.Time use `echo.TimeLayoutUnixTimeMilli` // - To convert unix timestamp in nanoseconds to time.Time use `echo.TimeLayoutUnixTimeNano` Layout TimeLayout // ParseInLocation is location used with time.ParseInLocation for layout that do not contain // timezone information to set output time in given location. // Defaults to time.UTC ParseInLocation * time . Location // ToInLocation is location to which parsed time is converted to after parsing. // The parsed time will be converted using time.In(ToInLocation). // Defaults to time.UTC ToInLocation * time . Location } Fields Layout TimeLayout Layout specifies the format for parsing time values in request parameters. It can be a standard Go time layout string or one of the special Unix time layouts. Parsing layout defaults to: echo.TimeLayout(time.RFC3339Nano) To convert to custom layout use echo.TimeLayout("2006-01-02") To convert unix timestamp (integer) to time.Time use echo.TimeLayoutUnixTime To convert unix timestamp in milliseconds to time.Time use echo.TimeLayoutUnixTimeMilli To convert unix timestamp in nanoseconds to time.Time use echo.TimeLayoutUnixTimeNano ParseInLocation *time.Location ParseInLocation is location used with time.ParseInLocation for layout that do not contain timezone information to set output time in given location. Defaults to time.UTC ToInLocation *time.Location ToInLocation is location to which parsed time is converted to after parsing. The parsed time will be converted using time.In(ToInLocation). Defaults to time.UTC type TrustOption Source: ip.go:144 TrustOption is config for which IP address to trust Copy type TrustOption func ( * ipChecker ) type Validator Source: echo.go:141 Validator is the interface that wraps the Validate function. Copy type Validator interface { Validate ( i any ) error } Methods Validate func(i any) error type ValueBinder Source: binder.go:113 ValueBinder provides utility methods for binding query or path parameter to various Go built-in types Copy type ValueBinder struct { // ValueFunc is used to get single parameter (first) value from request ValueFunc func ( sourceParam string ) string // ValuesFunc is used to get all values for parameter from request. i.e. `/api/search?ids=1&ids=2` ValuesFunc func ( sourceParam string ) [] string // ErrorFunc is used to create errors. Allows you to use your own error type, that for example marshals to your specific json response ErrorFunc func ( sourceParam string , values [] string , message string , internalError error ) error // contains filtered or unexported fields } Fields ValueFunc func(sourceParam string) string ValueFunc is used to get single parameter (first) value from request ValuesFunc func(sourceParam string) []string ValuesFunc is used to get all values for parameter from request. i.e. /api/search?ids=1&ids=2 ErrorFunc func(sourceParam string, values []string, message string, internalError error) error ErrorFunc is used to create errors. Allows you to use your own error type, that for example marshals to your specific json response func BindError() error Source: binder.go:207 BindError returns first seen bind error and resets/empties binder errors for further calls Example Copy { failFastRouteFunc := func ( c * echo . Context ) error { var opts struct { IDs [] int64 Active bool } length := int64 ( 50 ) b := echo . QueryParamsBinder ( c ) err := b . Int64 ( "length" , & length ). Int64s ( "ids" , & opts . IDs ). Bool ( "active" , & opts . Active ). BindError () if err != nil { bErr := err .( * echo . BindingError ) return fmt . Errorf ( "my own custom error for field: %s values: %v " , bErr . Field , bErr . Values ) } fmt . Printf ( "active = %v , length = %v , ids = %v \n " , opts . Active , length , opts . IDs ) return c . JSON ( http . StatusOK , opts ) } e := echo . New () c := e . NewContext ( httptest . NewRequest ( http . MethodGet , "/api/endpoint?active=true&length=25&ids=1&ids=2&ids=3" , nil ), httptest . NewRecorder (), ) _ = failFastRouteFunc ( c ) } Output: Copy active = true, length = 25, ids = [1 2 3] func BindErrors() []error Source: binder.go:217 BindErrors returns all bind errors and resets/empties binder errors for further calls Example Copy { routeFunc := func ( c * echo . Context ) error { var opts struct { IDs [] int64 Active bool } length := int64 ( 50 ) b := echo . QueryParamsBinder ( c ) errs := b . Int64 ( "length" , & length ). Int64s ( "ids" , & opts . IDs ). Bool ( "active" , & opts . Active ). BindErrors () if errs != nil { for _ , err := range errs { bErr := err .( * echo . BindingError ) log . Printf ( "in case you want to access what field: %s values: %v failed" , bErr . Field , bErr . Values ) } return fmt . Errorf ( " %v fields failed to bind" , len ( errs )) } fmt . Printf ( "active = %v , length = %v , ids = %v " , opts . Active , length , opts . IDs ) return c . JSON ( http . StatusOK , opts ) } e := echo . New () c := e . NewContext ( httptest . NewRequest ( http . MethodGet , "/api/endpoint?active=true&length=25&ids=1&ids=2&ids=3" , nil ), httptest . NewRecorder (), ) _ = routeFunc ( c ) } Output: Copy active = true, length = 25, ids = [1 2 3] func BindUnmarshaler(sourceParam string, dest BindUnmarshaler) *ValueBinder Source: binder.go:313 BindUnmarshaler binds parameter to destination implementing BindUnmarshaler interface func BindWithDelimiter(sourceParam string, dest any, delimiter string) *ValueBinder Source: binder.go:422 BindWithDelimiter binds parameter to destination by suitable conversion function. Delimiter is used before conversion to split parameter value to separate values func Bool(sourceParam string, dest *bool) *ValueBinder Source: binder.go:917 Bool binds parameter to bool variable func Bools(sourceParam string, dest *[]bool) *ValueBinder Source: binder.go:982 Bools binds parameter values to slice of bool variables func Byte(sourceParam string, dest *byte) *ValueBinder Source: binder.go:729 Byte binds parameter to byte variable func CustomFunc(sourceParam string, customFunc func(values []string) []error) *ValueBinder Source: binder.go:227 CustomFunc binds parameter values with Func. Func is called only when parameter values exist. Example Copy { routeFunc := func ( c * echo . Context ) error { length := int64 ( 50 ) var binary [] byte b := echo . QueryParamsBinder ( c ) errs := b . Int64 ( "length" , & length ). CustomFunc ( "base64" , func ( values [] string ) [] error { if len ( values ) == 0 { return nil } decoded , err := base64 . URLEncoding . DecodeString ( values [ 0 ]) if err != nil { return [] error { echo . NewBindingError ( "base64" , values [ 0 : 1 ], "failed to decode base64" , err )} } binary = decoded return nil }). BindErrors () if errs != nil { for _ , err := range errs { bErr := err .( * echo . BindingError ) log . Printf ( "in case you want to access what field: %s values: %v failed" , bErr . Field , bErr . Values ) } return fmt . Errorf ( " %v fields failed to bind" , len ( errs )) } fmt . Printf ( "length = %v , base64 = %s " , length , binary ) return c . JSON ( http . StatusOK , "ok" ) } e := echo . New () c := e . NewContext ( httptest . NewRequest ( http . MethodGet , "/api/endpoint?length=25&base64=SGVsbG8gV29ybGQ%3D" , nil ), httptest . NewRecorder (), ) _ = routeFunc ( c ) } Output: Copy length = 25, base64 = Hello World func Duration(sourceParam string, dest *time.Duration) *ValueBinder Source: binder.go:1179 Duration binds parameter to time.Duration variable func Durations(sourceParam string, dest *[]time.Duration) *ValueBinder Source: binder.go:1210 Durations binds parameter values to slice of time.Duration variables func FailFast(value bool) *ValueBinder Source: binder.go:193 FailFast set internal flag to indicate if binding methods will return early (without binding) when previous bind failed NB: call this method before any other binding methods as it modifies binding methods behaviour func Float32(sourceParam string, dest *float32) *ValueBinder Source: binder.go:1002 Float32 binds parameter to float32 variable func Float32s(sourceParam string, dest *[]float32) *ValueBinder Source: binder.go:1097 Float32s binds parameter values to slice of float32 variables func Float64(sourceParam string, dest *float64) *ValueBinder Source: binder.go:992 Float64 binds parameter to float64 variable func Float64s(sourceParam string, dest *[]float64) *ValueBinder Source: binder.go:1087 Float64s binds parameter values to slice of float64 variables func Int(sourceParam string, dest *int) *ValueBinder Source: binder.go:511 Int binds parameter to int variable func Int16(sourceParam string, dest *int16) *ValueBinder Source: binder.go:491 Int16 binds parameter to int16 variable func Int16s(sourceParam string, dest *[]int16) *ValueBinder Source: binder.go:659 Int16s binds parameter to slice of int16 func Int32(sourceParam string, dest *int32) *ValueBinder Source: binder.go:481 Int32 binds parameter to int32 variable func Int32s(sourceParam string, dest *[]int32) *ValueBinder Source: binder.go:649 Int32s binds parameter to slice of int32 func Int64(sourceParam string, dest *int64) *ValueBinder Source: binder.go:471 Int64 binds parameter to int64 variable func Int64s(sourceParam string, dest *[]int64) *ValueBinder Source: binder.go:639 Int64s binds parameter to slice of int64 func Int8(sourceParam string, dest *int8) *ValueBinder Source: binder.go:501 Int8 binds parameter to int8 variable func Int8s(sourceParam string, dest *[]int8) *ValueBinder Source: binder.go:669 Int8s binds parameter to slice of int8 func Ints(sourceParam string, dest *[]int) *ValueBinder Source: binder.go:679 Ints binds parameter to slice of int func JSONUnmarshaler(sourceParam string, dest json.Unmarshaler) *ValueBinder Source: binder.go:349 JSONUnmarshaler binds parameter to destination implementing json.Unmarshaler interface func MustBindUnmarshaler(sourceParam string, dest BindUnmarshaler) *ValueBinder Source: binder.go:331 MustBindUnmarshaler requires parameter value to exist to bind to destination implementing BindUnmarshaler interface. Returns error when value does not exist func MustBindWithDelimiter(sourceParam string, dest any, delimiter string) *ValueBinder Source: binder.go:428 MustBindWithDelimiter requires parameter value to exist to bind destination by suitable conversion function. Delimiter is used before conversion to split parameter value to separate values func MustBool(sourceParam string, dest *bool) *ValueBinder Source: binder.go:922 MustBool requires parameter value to exist to bind to bool variable. Returns error when value does not exist func MustBools(sourceParam string, dest *[]bool) *ValueBinder Source: binder.go:987 MustBools requires parameter values to exist to bind to slice of bool variables. Returns error when values does not exist func MustByte(sourceParam string, dest *byte) *ValueBinder Source: binder.go:734 MustByte requires parameter value to exist to bind to byte variable. Returns error when value does not exist func MustCustomFunc(sourceParam string, customFunc func(values []string) []error) *ValueBinder Source: binder.go:232 MustCustomFunc requires parameter values to exist to bind with Func. Returns error when value does not exist. func MustDuration(sourceParam string, dest *time.Duration) *ValueBinder Source: binder.go:1184 MustDuration requires parameter value to exist to bind to time.Duration variable. Returns error when value does not exist func MustDurations(sourceParam string, dest *[]time.Duration) *ValueBinder Source: binder.go:1215 MustDurations requires parameter values to exist to bind to slice of time.Duration variables. Returns error when values does not exist func MustFloat32(sourceParam string, dest *float32) *ValueBinder Source: binder.go:1007 MustFloat32 requires parameter value to exist to bind to float32 variable. Returns error when value does not exist func MustFloat32s(sourceParam string, dest *[]float32) *ValueBinder Source: binder.go:1102 MustFloat32s requires parameter values to exist to bind to slice of float32 variables. Returns error when values does not exist func MustFloat64(sourceParam string, dest *float64) *ValueBinder Source: binder.go:997 MustFloat64 requires parameter value to exist to bind to float64 variable. Returns error when value does not exist func MustFloat64s(sourceParam string, dest *[]float64) *ValueBinder Source: binder.go:1092 MustFloat64s requires parameter values to exist to bind to slice of float64 variables. Returns error when values does not exist func MustInt(sourceParam string, dest *int) *ValueBinder Source: binder.go:516 MustInt requires parameter value to exist to bind to int variable. Returns error when value does not exist func MustInt16(sourceParam string, dest *int16) *ValueBinder Source: binder.go:496 MustInt16 requires parameter value to exist to bind to int16 variable. Returns error when value does not exist func MustInt16s(sourceParam string, dest *[]int16) *ValueBinder Source: binder.go:664 MustInt16s requires parameter value to exist to bind to int16 slice variable. Returns error when value does not exist func MustInt32(sourceParam string, dest *int32) *ValueBinder Source: binder.go:486 MustInt32 requires parameter value to exist to bind to int32 variable. Returns error when value does not exist func MustInt32s(sourceParam string, dest *[]int32) *ValueBinder Source: binder.go:654 MustInt32s requires parameter value to exist to bind to int32 slice variable. Returns error when value does not exist func MustInt64(sourceParam string, dest *int64) *ValueBinder Source: binder.go:476 MustInt64 requires parameter value to exist to bind to int64 variable. Returns error when value does not exist func MustInt64s(sourceParam string, dest *[]int64) *ValueBinder Source: binder.go:644 MustInt64s requires parameter value to exist to bind to int64 slice variable. Returns error when value does not exist func MustInt8(sourceParam string, dest *int8) *ValueBinder Source: binder.go:506 MustInt8 requires parameter value to exist to bind to int8 variable. Returns error when value does not exist func MustInt8s(sourceParam string, dest *[]int8) *ValueBinder Source: binder.go:674 MustInt8s requires parameter value to exist to bind to int8 slice variable. Returns error when value does not exist func MustInts(sourceParam string, dest *[]int) *ValueBinder Source: binder.go:684 MustInts requires parameter value to exist to bind to int slice variable. Returns error when value does not exist func MustJSONUnmarshaler(sourceParam string, dest json.Unmarshaler) *ValueBinder Source: binder.go:367 MustJSONUnmarshaler requires parameter value to exist to bind to destination implementing json.Unmarshaler interface. Returns error when value does not exist func MustString(sourceParam string, dest *string) *ValueBinder Source: binder.go:269 MustString requires parameter value to exist to bind to string variable. Returns error when value does not exist func MustStrings(sourceParam string, dest *[]string) *ValueBinder Source: binder.go:298 MustStrings requires parameter values to exist to bind to slice of string variables. Returns error when value does not exist func MustTextUnmarshaler(sourceParam string, dest encoding.TextUnmarshaler) *ValueBinder Source: binder.go:403 MustTextUnmarshaler requires parameter value to exist to bind to destination implementing encoding.TextUnmarshaler interface. Returns error when value does not exist func MustTime(sourceParam string, dest *time.Time, layout string) *ValueBinder Source: binder.go:1112 MustTime requires parameter value to exist to bind to time.Time variable. Returns error when value does not exist func MustTimes(sourceParam string, dest *[]time.Time, layout string) *ValueBinder Source: binder.go:1143 MustTimes requires parameter values to exist to bind to slice of time.Time variables. Returns error when values does not exist func MustUint(sourceParam string, dest *uint) *ValueBinder Source: binder.go:744 MustUint requires parameter value to exist to bind to uint variable. Returns error when value does not exist func MustUint16(sourceParam string, dest *uint16) *ValueBinder Source: binder.go:714 MustUint16 requires parameter value to exist to bind to uint16 variable. Returns error when value does not exist func MustUint16s(sourceParam string, dest *[]uint16) *ValueBinder Source: binder.go:892 MustUint16s requires parameter value to exist to bind to uint16 slice variable. Returns error when value does not exist func MustUint32(sourceParam string, dest *uint32) *ValueBinder Source: binder.go:704 MustUint32 requires parameter value to exist to bind to uint32 variable. Returns error when value does not exist func MustUint32s(sourceParam string, dest *[]uint32) *ValueBinder Source: binder.go:882 MustUint32s requires parameter value to exist to bind to uint32 slice variable. Returns error when value does not exist func MustUint64(sourceParam string, dest *uint64) *ValueBinder Source: binder.go:694 MustUint64 requires parameter value to exist to bind to uint64 variable. Returns error when value does not exist func MustUint64s(sourceParam string, dest *[]uint64) *ValueBinder Source: binder.go:872 MustUint64s requires parameter value to exist to bind to uint64 slice variable. Returns error when value does not exist func MustUint8(sourceParam string, dest *uint8) *ValueBinder Source: binder.go:724 MustUint8 requires parameter value to exist to bind to uint8 variable. Returns error when value does not exist func MustUint8s(sourceParam string, dest *[]uint8) *ValueBinder Source: binder.go:902 MustUint8s requires parameter value to exist to bind to uint8 slice variable. Returns error when value does not exist func MustUints(sourceParam string, dest *[]uint) *ValueBinder Source: binder.go:912 MustUints requires parameter value to exist to bind to uint slice variable. Returns error when value does not exist func MustUnixTime(sourceParam string, dest *time.Time) *ValueBinder Source: binder.go:1270 MustUnixTime requires parameter value to exist to bind to time.Time variable (in local time corresponding to the given Unix time). Returns error when value does not exist. Example: 1609180603 bind to 2020-12-28T18:36:43.000000000+00:00 Note: time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal func MustUnixTimeMilli(sourceParam string, dest *time.Time) *ValueBinder Source: binder.go:1291 MustUnixTimeMilli requires parameter value to exist to bind to time.Time variable (in local time corresponding to the given Unix time in millisecond precision). Returns error when value does not exist. Example: 1647184410140 bind to 2022-03-13T15:13:30.140000000+00:00 Note: time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal func MustUnixTimeNano(sourceParam string, dest *time.Time) *ValueBinder Source: binder.go:1318 MustUnixTimeNano requires parameter value to exist to bind to time.Time variable (in local time corresponding to the given Unix time value in nanosecond precision). Returns error when value does not exist. Example: 1609180603123456789 binds to 2020-12-28T18:36:43.123456789+00:00 Example: 1000000000 binds to 1970-01-01T00:00:01.000000000+00:00 Example: 999999999 binds to 1970-01-01T00:00:00.999999999+00:00 Note: time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal Javascript's Number type only has about 53 bits of precision (Number.MAX_SAFE_INTEGER = 9007199254740991). Compare it to 1609180603123456789 in example. func String(sourceParam string, dest *string) *ValueBinder Source: binder.go:255 String binds parameter to string variable func Strings(sourceParam string, dest *[]string) *ValueBinder Source: binder.go:284 Strings binds parameter values to slice of string func TextUnmarshaler(sourceParam string, dest encoding.TextUnmarshaler) *ValueBinder Source: binder.go:385 TextUnmarshaler binds parameter to destination implementing encoding.TextUnmarshaler interface func Time(sourceParam string, dest *time.Time, layout string) *ValueBinder Source: binder.go:1107 Time binds parameter to time.Time variable func Times(sourceParam string, dest *[]time.Time, layout string) *ValueBinder Source: binder.go:1138 Times binds parameter values to slice of time.Time variables func Uint(sourceParam string, dest *uint) *ValueBinder Source: binder.go:739 Uint binds parameter to uint variable func Uint16(sourceParam string, dest *uint16) *ValueBinder Source: binder.go:709 Uint16 binds parameter to uint16 variable func Uint16s(sourceParam string, dest *[]uint16) *ValueBinder Source: binder.go:887 Uint16s binds parameter to slice of uint16 func Uint32(sourceParam string, dest *uint32) *ValueBinder Source: binder.go:699 Uint32 binds parameter to uint32 variable func Uint32s(sourceParam string, dest *[]uint32) *ValueBinder Source: binder.go:877 Uint32s binds parameter to slice of uint32 func Uint64(sourceParam string, dest *uint64) *ValueBinder Source: binder.go:689 Uint64 binds parameter to uint64 variable func Uint64s(sourceParam string, dest *[]uint64) *ValueBinder Source: binder.go:867 Uint64s binds parameter to slice of uint64 func Uint8(sourceParam string, dest *uint8) *ValueBinder Source: binder.go:719 Uint8 binds parameter to uint8 variable func Uint8s(sourceParam string, dest *[]uint8) *ValueBinder Source: binder.go:897 Uint8s binds parameter to slice of uint8 func Uints(sourceParam string, dest *[]uint) *ValueBinder Source: binder.go:907 Uints binds parameter to slice of uint func UnixTime(sourceParam string, dest *time.Time) *ValueBinder Source: binder.go:1259 UnixTime binds parameter to time.Time variable (in local Time corresponding to the given Unix time). Example: 1609180603 bind to 2020-12-28T18:36:43.000000000+00:00 Note: time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal func UnixTimeMilli(sourceParam string, dest *time.Time) *ValueBinder Source: binder.go:1280 UnixTimeMilli binds parameter to time.Time variable (in local time corresponding to the given Unix time in millisecond precision). Example: 1647184410140 bind to 2022-03-13T15:13:30.140000000+00:00 Note: time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal func UnixTimeNano(sourceParam string, dest *time.Time) *ValueBinder Source: binder.go:1304 UnixTimeNano binds parameter to time.Time variable (in local time corresponding to the given Unix time in nanosecond precision). Example: 1609180603123456789 binds to 2020-12-28T18:36:43.123456789+00:00 Example: 1000000000 binds to 1970-01-01T00:00:01.000000000+00:00 Example: 999999999 binds to 1970-01-01T00:00:00.999999999+00:00 Note: time.Time{} (param is empty) and time.Unix(0,0) (param = "0") are not equal Javascript's Number type only has about 53 bits of precision (Number.MAX_SAFE_INTEGER = 9007199254740991). Compare it to 1609180603123456789 in example. + +### echotest + +Path: `/api-reference/pkg-echotest.html` + +github.com/labstack/echo/v5/echotest + +import "github.com/labstack/echo/v5/echotest" Index Functions func LoadBytes(t *testing.T, name string, opts ...loadBytesOpts) []byte func TrimNewlineEnd(bytes []byte) []byte Types type ContextConfig type MultipartForm type MultipartFormFile Functions func LoadBytes(t *testing.T, name string, opts ...loadBytesOpts) []byte Source: echotest/reader.go:26 LoadBytes is helper to load file contents relative to current (where test file is) package directory. func TrimNewlineEnd(bytes []byte) []byte Source: echotest/reader.go:16 TrimNewlineEnd instructs LoadBytes to remove \n from the end of loaded file. Types type ContextConfig Source: echotest/context.go:20 ContextConfig is configuration for creating echo.Context for testing purposes. Copy type ContextConfig struct { // Request will be used instead of default `httptest.NewRequest(http.MethodGet, "/", nil)` Request * http . Request // Response will be used instead of default `httptest.NewRecorder()` Response * httptest . ResponseRecorder // QueryValues will be set as Request.URL.RawQuery value QueryValues url . Values // Headers will be set as Request.Header value Headers http . Header // PathValues initializes context.PathValues with given value. PathValues echo . PathValues // RouteInfo initializes context.RouteInfo() with given value RouteInfo * echo . RouteInfo // FormValues creates form-urlencoded form out of given values. If there is no // `content-type` header it will be set to `application/x-www-form-urlencoded` // In case Request was not set the Request.Method is set to `POST` // // FormValues, MultipartForm and JSONBody are mutually exclusive. FormValues url . Values // MultipartForm creates multipart form out of given value. If there is no // `content-type` header it will be set to `multipart/form-data` // In case Request was not set the Request.Method is set to `POST` // // FormValues, MultipartForm and JSONBody are mutually exclusive. MultipartForm * MultipartForm // JSONBody creates JSON body out of given bytes. If there is no // `content-type` header it will be set to `application/json` // In case Request was not set the Request.Method is set to `POST` // // FormValues, MultipartForm and JSONBody are mutually exclusive. JSONBody [] byte } Fields Request *http.Request Request will be used instead of default httptest.NewRequest(http.MethodGet, "/", nil) Response *httptest.ResponseRecorder Response will be used instead of default httptest.NewRecorder() QueryValues url.Values QueryValues will be set as Request.URL.RawQuery value Headers http.Header Headers will be set as Request.Header value PathValues echo.PathValues PathValues initializes context.PathValues with given value. RouteInfo *echo.RouteInfo RouteInfo initializes context.RouteInfo() with given value FormValues url.Values FormValues creates form-urlencoded form out of given values. If there is no content-type header it will be set to application/x-www-form-urlencoded In case Request was not set the Request.Method is set to POST FormValues, MultipartForm and JSONBody are mutually exclusive. MultipartForm *MultipartForm MultipartForm creates multipart form out of given value. If there is no content-type header it will be set to multipart/form-data In case Request was not set the Request.Method is set to POST FormValues, MultipartForm and JSONBody are mutually exclusive. JSONBody []byte JSONBody creates JSON body out of given bytes. If there is no content-type header it will be set to application/json In case Request was not set the Request.Method is set to POST FormValues, MultipartForm and JSONBody are mutually exclusive. func ServeWithHandler(t *testing.T, handler echo.HandlerFunc, opts ...any) *httptest.ResponseRecorder Source: echotest/context.go:167 ServeWithHandler serves ContextConfig with given handler and returns httptest.ResponseRecorder for response checking func ToContext(t *testing.T) *echo.Context Source: echotest/context.go:75 ToContext converts ContextConfig to echo.Context func ToContextRecorder(t *testing.T) (*echo.Context, *httptest.ResponseRecorder) Source: echotest/context.go:81 ToContextRecorder converts ContextConfig to echo.Context and httptest.ResponseRecorder type MultipartForm Source: echotest/context.go:62 MultipartForm is used to create multipart form out of given value Copy type MultipartForm struct { Fields map [ string ] string Files [] MultipartFormFile } Fields Fields map[string]string Files []MultipartFormFile type MultipartFormFile Source: echotest/context.go:68 MultipartFormFile is used to create file in multipart form out of given value Copy type MultipartFormFile struct { Fieldname string Filename string Content [] byte } Fields Fieldname string Filename string Content []byte + +### middleware + +Path: `/api-reference/pkg-middleware.html` + +github.com/labstack/echo/v5/middleware + +import "github.com/labstack/echo/v5/middleware" Index Constants Variables Functions func AddTrailingSlash() echo.MiddlewareFunc func AddTrailingSlashWithConfig(config AddTrailingSlashConfig) echo.MiddlewareFunc func BasicAuth(fn BasicAuthValidator) echo.MiddlewareFunc func BasicAuthWithConfig(config BasicAuthConfig) echo.MiddlewareFunc func BodyDump(handler BodyDumpHandler) echo.MiddlewareFunc func BodyDumpWithConfig(config BodyDumpConfig) echo.MiddlewareFunc func BodyLimit(limitBytes int64) echo.MiddlewareFunc func BodyLimitWithConfig(config BodyLimitConfig) echo.MiddlewareFunc func CORS(allowOrigins ...string) echo.MiddlewareFunc func CORSWithConfig(config CORSConfig) echo.MiddlewareFunc func CSRF() echo.MiddlewareFunc func CSRFWithConfig(config CSRFConfig) echo.MiddlewareFunc func ContextTimeout(timeout time.Duration) echo.MiddlewareFunc func ContextTimeoutWithConfig(config ContextTimeoutConfig) echo.MiddlewareFunc func CreateExtractors(lookups string, limit uint) ([]ValuesExtractor, error) func Decompress() echo.MiddlewareFunc func DecompressWithConfig(config DecompressConfig) echo.MiddlewareFunc func DefaultSkipper(c *echo.Context) bool func Gzip() echo.MiddlewareFunc func GzipWithConfig(config GzipConfig) echo.MiddlewareFunc func HTTPSNonWWWRedirect() echo.MiddlewareFunc func HTTPSNonWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc func HTTPSRedirect() echo.MiddlewareFunc func HTTPSRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc func HTTPSWWWRedirect() echo.MiddlewareFunc func HTTPSWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc func KeyAuth(fn KeyAuthValidator) echo.MiddlewareFunc func KeyAuthWithConfig(config KeyAuthConfig) echo.MiddlewareFunc func MethodFromForm(param string) MethodOverrideGetter func MethodFromHeader(header string) MethodOverrideGetter func MethodFromQuery(param string) MethodOverrideGetter func MethodOverride() echo.MiddlewareFunc func MethodOverrideWithConfig(config MethodOverrideConfig) echo.MiddlewareFunc func NewRandomBalancer(targets []*ProxyTarget) ProxyBalancer func NewRateLimiterMemoryStore(rateLimit float64) (store *RateLimiterMemoryStore) func NewRateLimiterMemoryStoreWithConfig(config RateLimiterMemoryStoreConfig) (store *RateLimiterMemoryStore) func NewRoundRobinBalancer(targets []*ProxyTarget) ProxyBalancer func NonWWWRedirect() echo.MiddlewareFunc func NonWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc func Proxy(balancer ProxyBalancer) echo.MiddlewareFunc func ProxyWithConfig(config ProxyConfig) echo.MiddlewareFunc func RateLimiter(store RateLimiterStore) echo.MiddlewareFunc func RateLimiterWithConfig(config RateLimiterConfig) echo.MiddlewareFunc func Recover() echo.MiddlewareFunc func RecoverWithConfig(config RecoverConfig) echo.MiddlewareFunc func RemoveTrailingSlash() echo.MiddlewareFunc func RemoveTrailingSlashWithConfig(config RemoveTrailingSlashConfig) echo.MiddlewareFunc func RequestID() echo.MiddlewareFunc func RequestIDWithConfig(config RequestIDConfig) echo.MiddlewareFunc func RequestLogger() echo.MiddlewareFunc func RequestLoggerWithConfig(config RequestLoggerConfig) echo.MiddlewareFunc func Rewrite(rules map[string]string) echo.MiddlewareFunc func RewriteWithConfig(config RewriteConfig) echo.MiddlewareFunc func Secure() echo.MiddlewareFunc func SecureWithConfig(config SecureConfig) echo.MiddlewareFunc func Static(root string) echo.MiddlewareFunc func StaticWithConfig(config StaticConfig) echo.MiddlewareFunc func WWWRedirect() echo.MiddlewareFunc func WWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc Types type AddTrailingSlashConfig type BasicAuthConfig type BasicAuthValidator type BeforeFunc type BodyDumpConfig type BodyDumpHandler type BodyLimitConfig type CORSConfig type CSRFConfig type ContextTimeoutConfig type DecompressConfig type Decompressor type DefaultGzipDecompressPool type Extractor type ExtractorSource type GzipConfig type KeyAuthConfig type KeyAuthErrorHandler type KeyAuthValidator type MethodOverrideConfig type MethodOverrideGetter type PanicStackError type ProxyBalancer type ProxyConfig type ProxyTarget type RateLimiterConfig type RateLimiterMemoryStore type RateLimiterMemoryStoreConfig type RateLimiterStore type RateLimiterStoreContext type RecoverConfig type RedirectConfig type RemoveTrailingSlashConfig type RequestIDConfig type RequestLoggerConfig type RequestLoggerValues type RewriteConfig type SecureConfig type Skipper type StaticConfig type ValueExtractorError type ValuesExtractor type Visitor Constants Rate limit response headers set by stores that implement RateLimiterStoreContext. Source: middleware/rate_limiter.go:20 Copy const ( HeaderXRateLimitLimit = "X-RateLimit-Limit" HeaderXRateLimitRemaining = "X-RateLimit-Remaining" ) Source: middleware/util.go:19 Copy const ( // KB is 1 KiloByte = 1024 bytes KB // MB is 1 Megabyte = 1_048_576 bytes MB // GB is 1 Gigabyte = 1_073_741_824 bytes GB // TB is 1 Terabyte = 1_099_511_627_776 bytes TB // PB is 1 Petabyte = 1_125_899_906_842_624 bytes PB // EB is 1 Exabyte = 1_152_921_504_606_847_000 bytes EB ) CSRFUsingSecFetchSite is a context key for CSRF middleware what is set when the client browser is using Sec-Fetch-Site header and the request is deemed safe. It is a dummy token value that can be used to render CSRF token for form by handlers. We know that the client is using a browser that supports Sec-Fetch-Site header, so when the form is submitted in the future with this dummy token value it is OK. Although the request is safe, the template rendered by the handler may need this value to render CSRF token for form. Source: middleware/csrf.go:23 Copy const CSRFUsingSecFetchSite = "_echo_csrf_using_sec_fetch_site_" GZIPEncoding content-encoding header if set to "gzip", decompress body contents. Source: middleware/decompress.go:32 Copy const GZIPEncoding string = "gzip" StatusCodeContextCanceled is a custom HTTP status code for situations where a client unexpectedly closed the connection to the server. As there is no standard error code for "client closed connection", but various well-known HTTP clients and server implement this HTTP code we use 499 too instead of the more problematic 5xx, which does not allow to detect this situation Source: middleware/proxy.go:420 Copy const StatusCodeContextCanceled = 499 Source: middleware/extractor.go:25 Copy const ( // ExtractorSourceHeader means value was extracted from request header ExtractorSourceHeader ExtractorSource = "header" // ExtractorSourceQuery means value was extracted from request query parameters ExtractorSourceQuery ExtractorSource = "query" // ExtractorSourcePathParam means value was extracted from route path parameters ExtractorSourcePathParam ExtractorSource = "param" // ExtractorSourceCookie means value was extracted from request cookies ExtractorSourceCookie ExtractorSource = "cookie" // ExtractorSourceForm means value was extracted from request form values ExtractorSourceForm ExtractorSource = "form" ) Variables DefaultCSRFConfig is the default CSRF middleware config. Source: middleware/csrf.go:104 Copy var DefaultCSRFConfig = CSRFConfig { Skipper : DefaultSkipper , TokenLength : 32 , TokenLookup : "header:" + echo . HeaderXCSRFToken , ContextKey : "csrf" , CookieName : "_csrf" , CookieMaxAge : 86400 , CookieSameSite : http . SameSiteDefaultMode , } DefaultKeyAuthConfig is the default KeyAuth middleware config. Source: middleware/key_auth.go:112 Copy var DefaultKeyAuthConfig = KeyAuthConfig { Skipper : DefaultSkipper , KeyLookup : "header:" + echo . HeaderAuthorization + ":Bearer " , } DefaultMethodOverrideConfig is the default MethodOverride middleware config. Source: middleware/method_override.go:26 Copy var DefaultMethodOverrideConfig = MethodOverrideConfig { Skipper : DefaultSkipper , Getter : MethodFromHeader ( echo . HeaderXHTTPMethodOverride ), } DefaultProxyConfig is the default Proxy middleware config. Source: middleware/proxy.go:125 Copy var DefaultProxyConfig = ProxyConfig { Skipper : DefaultSkipper , ContextKey : "target" , } DefaultRateLimiterConfig defines default values for RateLimiterConfig Source: middleware/rate_limiter.go:61 Copy var DefaultRateLimiterConfig = RateLimiterConfig { Skipper : DefaultSkipper , IdentifierExtractor : func ( ctx * echo . Context ) ( string , error ) { id := ctx . RealIP () return id , nil }, ErrorHandler : func ( c * echo . Context , err error ) error { return ErrExtractorError . Wrap ( err ) }, DenyHandler : func ( c * echo . Context , identifier string , err error ) error { return ErrRateLimitExceeded . Wrap ( err ) }, } DefaultRateLimiterMemoryStoreConfig provides default configuration values for RateLimiterMemoryStore Source: middleware/rate_limiter.go:251 Copy var DefaultRateLimiterMemoryStoreConfig = RateLimiterMemoryStoreConfig { ExpiresIn : 3 * time . Minute , } DefaultRecoverConfig is the default Recover middleware config. Source: middleware/recover.go:34 Copy var DefaultRecoverConfig = RecoverConfig { Skipper : DefaultSkipper , StackSize : 4 << 10 , DisableStackAll : false , DisablePrintStack : false , } DefaultSecureConfig is the default Secure middleware config. Source: middleware/secure.go:79 Copy var DefaultSecureConfig = SecureConfig { Skipper : DefaultSkipper , XSSProtection : "1; mode=block" , ContentTypeNosniff : "nosniff" , XFrameOptions : "SAMEORIGIN" , HSTSPreloadEnabled : false , } DefaultStaticConfig is the default Static middleware config. Source: middleware/static.go:159 Copy var DefaultStaticConfig = StaticConfig { Skipper : DefaultSkipper , Index : "index.html" , } ErrCSRFInvalid is returned when CSRF check fails Source: middleware/csrf.go:101 Copy var ErrCSRFInvalid = & echo . HTTPError { Code : http . StatusForbidden , Message : "invalid csrf token" } ErrExtractorError denotes an error raised when extractor function is unsuccessful Source: middleware/rate_limiter.go:58 Copy var ErrExtractorError = echo . NewHTTPError ( http . StatusForbidden , "error while extracting identifier" ) ErrInvalidKey denotes an error raised when key value is invalid by validator Source: middleware/key_auth.go:109 Copy var ErrInvalidKey = echo . NewHTTPError ( http . StatusUnauthorized , "invalid key" ) ErrKeyMissing denotes an error raised when key value could not be extracted from request Source: middleware/key_auth.go:106 Copy var ErrKeyMissing = echo . NewHTTPError ( http . StatusUnauthorized , "missing key" ) ErrRateLimitExceeded denotes an error raised when rate limit is exceeded Source: middleware/rate_limiter.go:55 Copy var ErrRateLimitExceeded = echo . NewHTTPError ( http . StatusTooManyRequests , "rate limit exceeded" ) RedirectHTTPSConfig is the HTTPS Redirect middleware config. Source: middleware/redirect.go:34 Copy var RedirectHTTPSConfig = RedirectConfig { /* contains filtered or unexported fields */ } RedirectHTTPSWWWConfig is the HTTPS WWW Redirect middleware config. Source: middleware/redirect.go:37 Copy var RedirectHTTPSWWWConfig = RedirectConfig { /* contains filtered or unexported fields */ } RedirectNonHTTPSWWWConfig is the non HTTPS WWW Redirect middleware config. Source: middleware/redirect.go:40 Copy var RedirectNonHTTPSWWWConfig = RedirectConfig { /* contains filtered or unexported fields */ } RedirectNonWWWConfig is the non WWW Redirect middleware config. Source: middleware/redirect.go:46 Copy var RedirectNonWWWConfig = RedirectConfig { /* contains filtered or unexported fields */ } RedirectWWWConfig is the WWW Redirect middleware config. Source: middleware/redirect.go:43 Copy var RedirectWWWConfig = RedirectConfig { /* contains filtered or unexported fields */ } Functions func AddTrailingSlash() echo.MiddlewareFunc Source: middleware/slash.go:29 AddTrailingSlash returns a root level (before router) middleware which adds a trailing slash to the request URL#Path . Usage Echo#Pre(AddTrailingSlash()) func AddTrailingSlashWithConfig(config AddTrailingSlashConfig) echo.MiddlewareFunc Source: middleware/slash.go:34 AddTrailingSlashWithConfig returns an AddTrailingSlash middleware with config or panics on invalid configuration. func BasicAuth(fn BasicAuthValidator) echo.MiddlewareFunc Source: middleware/basic_auth.go:87 BasicAuth returns an BasicAuth middleware. For valid credentials it calls the next handler. For missing or invalid credentials, it sends "401 - Unauthorized" response. func BasicAuthWithConfig(config BasicAuthConfig) echo.MiddlewareFunc Source: middleware/basic_auth.go:92 BasicAuthWithConfig returns an BasicAuthWithConfig middleware with config. func BodyDump(handler BodyDumpHandler) echo.MiddlewareFunc Source: middleware/body_dump.go:58 BodyDump returns a BodyDump middleware. BodyDump middleware captures the request and response payload and calls the registered handler. SECURITY: By default, this limits dumped bodies to 5MB to prevent memory exhaustion attacks. To customize limits, use BodyDumpWithConfig. To disable limits (not recommended in production), explicitly set MaxRequestBytes and MaxResponseBytes to -1. func BodyDumpWithConfig(config BodyDumpConfig) echo.MiddlewareFunc Source: middleware/body_dump.go:68 BodyDumpWithConfig returns a BodyDump middleware with config. See: BodyDump() . SECURITY: If MaxRequestBytes and MaxResponseBytes are not set (zero values), they default to 5MB each to prevent DoS attacks via large payloads. Set them explicitly to -1 to disable limits if needed for your use case. func BodyLimit(limitBytes int64) echo.MiddlewareFunc Source: middleware/body_limit.go:34 BodyLimit returns a BodyLimit middleware. BodyLimit middleware sets the maximum allowed size for a request body, if the size exceeds the configured limit, it sends "413 - Request Entity Too Large" response. The BodyLimit is determined based on both Content-Length request header and actual content read, which makes it super secure. func BodyLimitWithConfig(config BodyLimitConfig) echo.MiddlewareFunc Source: middleware/body_limit.go:42 BodyLimitWithConfig returns a BodyLimitWithConfig middleware. Middleware sets the maximum allowed size in bytes for a request body, if the size exceeds the configured limit, it sends "413 - Request Entity Too Large" response. The BodyLimitWithConfig is determined based on both Content-Length request header and actual content read, which makes it super secure. func CORS(allowOrigins ...string) echo.MiddlewareFunc Source: middleware/cors.go:137 CORS returns a Cross-Origin Resource Sharing (CORS) middleware. See also MDN: Cross-Origin Resource Sharing (CORS) . Origin consist of following parts: scheme + "://" + host + optional ":" + port Wildcard * can be used, but has to be set explicitly. Example: https://example.com , http://example.com:8080 , * Security: Poorly configured CORS can compromise security because it allows relaxation of the browser's Same-Origin policy. See Exploiting CORS misconfigurations for Bitcoins and bounties and Portswigger: Cross-origin resource sharing (CORS) for more details. Duplicate CORS headers can appear in a chained-proxy setup where this middleware runs on more than one layer and a reverse proxy copies an upstream's CORS headers on top of the ones set here. Prefer enabling CORS only at the edge; if a proxied upstream sets its own CORS headers, strip them before they are copied (e.g. httputil.ReverseProxy.ModifyResponse). func CORSWithConfig(config CORSConfig) echo.MiddlewareFunc Source: middleware/cors.go:146 CORSWithConfig returns a CORS middleware with config or panics on invalid configuration. See: [CORS]. func CSRF() echo.MiddlewareFunc Source: middleware/csrf.go:116 CSRF returns a Cross-Site Request Forgery (CSRF) middleware. See: https://en.wikipedia.org/wiki/Cross-site_request_forgery func CSRFWithConfig(config CSRFConfig) echo.MiddlewareFunc Source: middleware/csrf.go:121 CSRFWithConfig returns a CSRF middleware with config or panics on invalid configuration. func ContextTimeout(timeout time.Duration) echo.MiddlewareFunc Source: middleware/context_timeout.go:28 ContextTimeout returns a middleware which returns error (503 Service Unavailable error) to client when underlying method returns context.DeadlineExceeded error. func ContextTimeoutWithConfig(config ContextTimeoutConfig) echo.MiddlewareFunc Source: middleware/context_timeout.go:33 ContextTimeoutWithConfig returns a Timeout middleware with config. func CreateExtractors(lookups string, limit uint) ([]ValuesExtractor, error) Source: middleware/extractor.go:74 CreateExtractors creates ValuesExtractors from given lookups. lookups is a string in the form of " :" or " :, :" that is used to extract key from the request. Possible values: "header:" or "header::" is argument value to cut/trim prefix of the extracted value. This is useful if header value has static prefix like Authorization: where part that we want to cut is note the space at the end. In case of basic authentication Authorization: Basic prefix we want to remove is Basic . "query:" "param:" "form:" "cookie:" Multiple sources example: "header:Authorization,header:X-Api-Key" limit sets the maximum amount how many lookups can be returned. func Decompress() echo.MiddlewareFunc Source: middleware/decompress.go:52 Decompress decompresses request body based if content encoding type is set to "gzip" with default config SECURITY: By default, this limits decompressed data to 100MB to prevent zip bomb attacks. To customize the limit, use DecompressWithConfig. To disable limits (not recommended in production), set MaxDecompressedSize to -1. func DecompressWithConfig(config DecompressConfig) echo.MiddlewareFunc Source: middleware/decompress.go:60 DecompressWithConfig returns a decompress middleware with config or panics on invalid configuration. SECURITY: If MaxDecompressedSize is not set (zero value), it defaults to 100MB to prevent DoS attacks via zip bombs. Set to -1 to explicitly disable limits if needed for your use case. func DefaultSkipper(c *echo.Context) bool Source: middleware/middleware.go:87 DefaultSkipper returns false which processes the middleware. func Gzip() echo.MiddlewareFunc Source: middleware/compress.go:59 Gzip returns a middleware which compresses HTTP response using gzip compression scheme. func GzipWithConfig(config GzipConfig) echo.MiddlewareFunc Source: middleware/compress.go:64 GzipWithConfig returns a middleware which compresses HTTP response using gzip compression scheme. func HTTPSNonWWWRedirect() echo.MiddlewareFunc Source: middleware/redirect.go:80 HTTPSNonWWWRedirect redirects http requests to https non www. For example, http://www.labstack.com will be redirect to https://labstack.com . Usage Echo#Pre(HTTPSNonWWWRedirect()) func HTTPSNonWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc Source: middleware/redirect.go:85 HTTPSNonWWWRedirectWithConfig returns a HTTPS Non-WWW redirect middleware with config or panics on invalid configuration. func HTTPSRedirect() echo.MiddlewareFunc Source: middleware/redirect.go:52 HTTPSRedirect redirects http requests to https. For example, http://labstack.com will be redirect to https://labstack.com . Usage Echo#Pre(HTTPSRedirect()) func HTTPSRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc Source: middleware/redirect.go:57 HTTPSRedirectWithConfig returns a HTTPS redirect middleware with config or panics on invalid configuration. func HTTPSWWWRedirect() echo.MiddlewareFunc Source: middleware/redirect.go:66 HTTPSWWWRedirect redirects http requests to https www. For example, http://labstack.com will be redirect to https://www.labstack.com . Usage Echo#Pre(HTTPSWWWRedirect()) func HTTPSWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc Source: middleware/redirect.go:71 HTTPSWWWRedirectWithConfig returns a HTTPS WWW redirect middleware with config or panics on invalid configuration. func KeyAuth(fn KeyAuthValidator) echo.MiddlewareFunc Source: middleware/key_auth.go:122 KeyAuth returns an KeyAuth middleware. For valid key it calls the next handler. For invalid key, it sends "401 - Unauthorized" response. For missing key, it sends "400 - Bad Request" response. func KeyAuthWithConfig(config KeyAuthConfig) echo.MiddlewareFunc Source: middleware/key_auth.go:133 KeyAuthWithConfig returns an KeyAuth middleware or panics if configuration is invalid. For first valid key it calls the next handler. For invalid key, it sends "401 - Unauthorized" response. For missing key, it sends "400 - Bad Request" response. func MethodFromForm(param string) MethodOverrideGetter Source: middleware/method_override.go:83 MethodFromForm is a MethodOverrideGetter that gets overridden method from the form parameter. func MethodFromHeader(header string) MethodOverrideGetter Source: middleware/method_override.go:75 MethodFromHeader is a MethodOverrideGetter that gets overridden method from the request header. func MethodFromQuery(param string) MethodOverrideGetter Source: middleware/method_override.go:91 MethodFromQuery is a MethodOverrideGetter that gets overridden method from the query parameter. func MethodOverride() echo.MiddlewareFunc Source: middleware/method_override.go:36 MethodOverride returns a MethodOverride middleware. MethodOverride middleware checks for the overridden method from the request and uses it instead of the original method. For security reasons, only POST method can be overridden. func MethodOverrideWithConfig(config MethodOverrideConfig) echo.MiddlewareFunc Source: middleware/method_override.go:41 MethodOverrideWithConfig returns a Method Override middleware with config or panics on invalid configuration. func NewRandomBalancer(targets []*ProxyTarget) ProxyBalancer Source: middleware/proxy.go:189 NewRandomBalancer returns a random proxy balancer. func NewRateLimiterMemoryStore(rateLimit float64) (store *RateLimiterMemoryStore) Source: middleware/rate_limiter.go:200 NewRateLimiterMemoryStore returns an instance of RateLimiterMemoryStore with the provided rate (as req/s). for more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit . Burst and ExpiresIn will be set to default values. Note that if the provided rate is a float number and Burst is zero, Burst will be treated as the rounded up value of the rate. Example (with 20 requests/sec): Copy limiterStore := middleware.NewRateLimiterMemoryStore(20) func NewRateLimiterMemoryStoreWithConfig(config RateLimiterMemoryStoreConfig) (store *RateLimiterMemoryStore) Source: middleware/rate_limiter.go:225 NewRateLimiterMemoryStoreWithConfig returns an instance of RateLimiterMemoryStore with the provided configuration. Rate must be provided. Burst will be set to the rounded up value of the configured rate if not provided or set to 0. The built-in memory store is usually capable for modest loads. For higher loads other store implementations should be considered. Characteristics: Concurrency above 100 parallel requests may causes measurable lock contention A high number of different IP addresses (above 16000) may be impacted by the internally used Go map A high number of requests from a single IP address may cause lock contention Example: Copy limiterStore := middleware.NewRateLimiterMemoryStoreWithConfig( middleware.RateLimiterMemoryStoreConfig{Rate: 50, Burst: 200, ExpiresIn: 5 * time.Minute}, ) func NewRoundRobinBalancer(targets []*ProxyTarget) ProxyBalancer Source: middleware/proxy.go:199 NewRoundRobinBalancer returns a round-robin proxy balancer. func NonWWWRedirect() echo.MiddlewareFunc Source: middleware/redirect.go:108 NonWWWRedirect redirects www requests to non www. For example, http://www.labstack.com will be redirect to http://labstack.com . Usage Echo#Pre(NonWWWRedirect()) func NonWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc Source: middleware/redirect.go:113 NonWWWRedirectWithConfig returns a Non-WWW redirect middleware with config or panics on invalid configuration. func Proxy(balancer ProxyBalancer) echo.MiddlewareFunc Source: middleware/proxy.go:292 Proxy returns a Proxy middleware. Proxy middleware forwards the request to upstream server using a configured load balancing technique. func ProxyWithConfig(config ProxyConfig) echo.MiddlewareFunc Source: middleware/proxy.go:301 ProxyWithConfig returns a Proxy middleware or panics if configuration is invalid. Proxy middleware forwards the request to upstream server using a configured load balancing technique. func RateLimiter(store RateLimiterStore) echo.MiddlewareFunc Source: middleware/rate_limiter.go:86 RateLimiter returns a rate limiting middleware Copy e := echo.New() limiterStore := middleware.NewRateLimiterMemoryStore(20) e.GET("/rate-limited", func(c *echo.Context) error { return c.String(http.StatusOK, "test") }, RateLimiter(limiterStore)) func RateLimiterWithConfig(config RateLimiterConfig) echo.MiddlewareFunc Source: middleware/rate_limiter.go:119 RateLimiterWithConfig returns a rate limiting middleware Copy e := echo.New() config := middleware.RateLimiterConfig{ Skipper: DefaultSkipper, Store: middleware.NewRateLimiterMemoryStore( middleware.RateLimiterMemoryStoreConfig{Rate: 10, Burst: 30, ExpiresIn: 3 * time.Minute} ) IdentifierExtractor: func(ctx *echo.Context) (string, error) { id := ctx.RealIP() return id, nil }, ErrorHandler: func(ctx *echo.Context, err error) error { return context.JSON(http.StatusTooManyRequests, nil) }, DenyHandler: func(ctx *echo.Context, identifier string, err error) error { return context.JSON(http.StatusForbidden, nil) }, } e.GET("/rate-limited", func(c *echo.Context) error { return c.String(http.StatusOK, "test") }, middleware.RateLimiterWithConfig(config)) func Recover() echo.MiddlewareFunc Source: middleware/recover.go:43 Recover returns a middleware which recovers from panics anywhere in the chain and handles the control to the centralized HTTPErrorHandler. func RecoverWithConfig(config RecoverConfig) echo.MiddlewareFunc Source: middleware/recover.go:48 RecoverWithConfig returns a Recovery middleware with config or panics on invalid configuration. func RemoveTrailingSlash() echo.MiddlewareFunc Source: middleware/slash.go:93 RemoveTrailingSlash returns a root level (before router) middleware which removes a trailing slash from the request URI. Usage Echo#Pre(RemoveTrailingSlash()) func RemoveTrailingSlashWithConfig(config RemoveTrailingSlashConfig) echo.MiddlewareFunc Source: middleware/slash.go:98 RemoveTrailingSlashWithConfig returns a RemoveTrailingSlash middleware with config or panics on invalid configuration. func RequestID() echo.MiddlewareFunc Source: middleware/request_id.go:30 RequestID returns a middleware that reads RequestIDConfig.TargetHeader ( X-Request-ID ) header value or when the header value is empty, generates that value and sets request ID to response as RequestIDConfig.TargetHeader ( X-Request-Id ) value. func RequestIDWithConfig(config RequestIDConfig) echo.MiddlewareFunc Source: middleware/request_id.go:37 RequestIDWithConfig returns a middleware with given valid config or panics on invalid configuration. The middleware reads RequestIDConfig.TargetHeader ( X-Request-ID ) header value or when the header value is empty, generates that value and sets request ID to response as RequestIDConfig.TargetHeader ( X-Request-Id ) value. func RequestLogger() echo.MiddlewareFunc Source: middleware/request_logger.go:395 RequestLogger creates Request Logger middleware with Echo default settings that uses Context.Logger() as logger. func RequestLoggerWithConfig(config RequestLoggerConfig) echo.MiddlewareFunc Source: middleware/request_logger.go:237 RequestLoggerWithConfig returns a RequestLogger middleware with config. func Rewrite(rules map[string]string) echo.MiddlewareFunc Source: middleware/rewrite.go:40 Rewrite returns a Rewrite middleware. Rewrite middleware rewrites the URL path based on the provided rules. func RewriteWithConfig(config RewriteConfig) echo.MiddlewareFunc Source: middleware/rewrite.go:49 RewriteWithConfig returns a Rewrite middleware or panics on invalid configuration. Rewrite middleware rewrites the URL path based on the provided rules. func Secure() echo.MiddlewareFunc Source: middleware/secure.go:91 Secure returns a Secure middleware. Secure middleware provides protection against cross-site scripting (XSS) attack, content type sniffing, clickjacking, insecure connection and other code injection attacks. func SecureWithConfig(config SecureConfig) echo.MiddlewareFunc Source: middleware/secure.go:96 SecureWithConfig returns a Secure middleware with config or panics on invalid configuration. func Static(root string) echo.MiddlewareFunc Source: middleware/static.go:165 Static returns a Static middleware to serves static content from the provided root directory. func StaticWithConfig(config StaticConfig) echo.MiddlewareFunc Source: middleware/static.go:172 StaticWithConfig returns a Static middleware to serves static content or panics on invalid configuration. func WWWRedirect() echo.MiddlewareFunc Source: middleware/redirect.go:94 WWWRedirect redirects non www requests to www. For example, http://labstack.com will be redirect to http://www.labstack.com . Usage Echo#Pre(WWWRedirect()) func WWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc Source: middleware/redirect.go:99 WWWRedirectWithConfig returns a WWW redirect middleware with config or panics on invalid configuration. Types type AddTrailingSlashConfig Source: middleware/slash.go:15 AddTrailingSlashConfig is the middleware config for adding trailing slash to the request. Copy type AddTrailingSlashConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // Status code to be used when redirecting the request. // Optional, but when provided the request is redirected using this code. // Valid status codes: [300...308] RedirectCode int } Fields Skipper Skipper Skipper defines a function to skip middleware. RedirectCode int Status code to be used when redirecting the request. Optional, but when provided the request is redirected using this code. Valid status codes: [300...308] func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/slash.go:39 ToMiddleware converts AddTrailingSlashConfig to middleware or returns an error for invalid configuration type BasicAuthConfig Source: middleware/basic_auth.go:21 BasicAuthConfig defines the config for BasicAuthWithConfig middleware. SECURITY: The Validator function is responsible for securely comparing credentials. See BasicAuthValidator documentation for guidance on preventing timing attacks. Copy type BasicAuthConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // Validator is a function to validate BasicAuthWithConfig credentials. Note: if request contains multiple basic auth headers // this function would be called once for each header until first valid result is returned // Required. Validator BasicAuthValidator // Realm is a string to define realm attribute of BasicAuthWithConfig. // Default value "Restricted". Realm string // AllowedCheckLimit set how many headers are allowed to be checked. This is useful // environments like corporate test environments with application proxies restricting // access to environment with their own auth scheme. // Defaults to 1. AllowedCheckLimit uint } Fields Skipper Skipper Skipper defines a function to skip middleware. Validator BasicAuthValidator Validator is a function to validate BasicAuthWithConfig credentials. Note: if request contains multiple basic auth headers this function would be called once for each header until first valid result is returned Required. Realm string Realm is a string to define realm attribute of BasicAuthWithConfig. Default value "Restricted". AllowedCheckLimit uint AllowedCheckLimit set how many headers are allowed to be checked. This is useful environments like corporate test environments with application proxies restricting access to environment with their own auth scheme. Defaults to 1. func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/basic_auth.go:97 ToMiddleware converts BasicAuthConfig to middleware or returns an error for invalid configuration type BasicAuthValidator Source: middleware/basic_auth.go:76 BasicAuthValidator defines a function to validate BasicAuthWithConfig credentials. SECURITY WARNING: To prevent timing attacks that could allow attackers to enumerate valid usernames or passwords, validator implementations MUST use constant-time comparison for credential checking. Use crypto/subtle.ConstantTimeCompare instead of standard string equality (==) or switch statements. Example of SECURE implementation: Copy import "crypto/subtle" validator := func(c *echo.Context, username, password string) (bool, error) { // Fetch expected credentials from database/config expectedUser := "admin" expectedPass := "secretpassword" // Use constant-time comparison to prevent timing attacks userMatch := subtle.ConstantTimeCompare([]byte(username), []byte(expectedUser)) == 1 passMatch := subtle.ConstantTimeCompare([]byte(password), []byte(expectedPass)) == 1 if userMatch && passMatch { return true, nil } return false, nil } Example of INSECURE implementation (DO NOT USE): Copy // VULNERABLE TO TIMING ATTACKS - DO NOT USE validator := func(c *echo.Context, username, password string) (bool, error) { if username == "admin" && password == "secret" { // Timing leak! return true, nil } return false, nil } Copy type BasicAuthValidator func ( c * echo . Context , user string , password string ) ( bool , error ) type BeforeFunc Source: middleware/middleware.go:19 BeforeFunc defines a function which is executed just before the middleware. Copy type BeforeFunc func ( c * echo . Context ) type BodyDumpConfig Source: middleware/body_dump.go:19 BodyDumpConfig defines the config for BodyDump middleware. Copy type BodyDumpConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // Handler receives request, response payloads and handler error if there are any. // Required. Handler BodyDumpHandler // MaxRequestBytes limits how much of the request body to dump. // If the request body exceeds this limit, only the first MaxRequestBytes // are dumped. The handler callback receives truncated data. // Default: 5 * MB (5,242,880 bytes) // Set to -1 to disable limits (not recommended in production). MaxRequestBytes int64 // MaxResponseBytes limits how much of the response body to dump. // If the response body exceeds this limit, only the first MaxResponseBytes // are dumped. The handler callback receives truncated data. // Default: 5 * MB (5,242,880 bytes) // Set to -1 to disable limits (not recommended in production). MaxResponseBytes int64 } Fields Skipper Skipper Skipper defines a function to skip middleware. Handler BodyDumpHandler Handler receives request, response payloads and handler error if there are any. Required. MaxRequestBytes int64 MaxRequestBytes limits how much of the request body to dump. If the request body exceeds this limit, only the first MaxRequestBytes are dumped. The handler callback receives truncated data. Default: 5 * MB (5,242,880 bytes) Set to -1 to disable limits (not recommended in production). MaxResponseBytes int64 MaxResponseBytes limits how much of the response body to dump. If the response body exceeds this limit, only the first MaxResponseBytes are dumped. The handler callback receives truncated data. Default: 5 * MB (5,242,880 bytes) Set to -1 to disable limits (not recommended in production). func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/body_dump.go:73 ToMiddleware converts BodyDumpConfig to middleware or returns an error for invalid configuration type BodyDumpHandler Source: middleware/body_dump.go:43 BodyDumpHandler receives the request and response payload. Copy type BodyDumpHandler func ( c * echo . Context , reqBody [] byte , resBody [] byte , err error ) type BodyLimitConfig Source: middleware/body_limit.go:15 BodyLimitConfig defines the config for BodyLimitWithConfig middleware. Copy type BodyLimitConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // LimitBytes is maximum allowed size in bytes for a request body LimitBytes int64 } Fields Skipper Skipper Skipper defines a function to skip middleware. LimitBytes int64 LimitBytes is maximum allowed size in bytes for a request body func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/body_limit.go:47 ToMiddleware converts BodyLimitConfig to middleware or returns an error for invalid configuration type CORSConfig Source: middleware/cors.go:17 CORSConfig defines the config for CORS middleware. Copy type CORSConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // AllowOrigins determines the value of the Access-Control-Allow-Origin // response header. This header defines a list of origins that may access the // resource. // // Origin consist of following parts: `scheme + "://" + host + optional ":" + port` // Wildcard can be used, but has to be set explicitly []string{"*"} // Example: `https://example.com`, `http://example.com:8080`, `*` // // Security: use extreme caution when handling the origin, and carefully // validate any logic. Remember that attackers may register hostile domain names. // See https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html // See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin // // Mandatory. AllowOrigins [] string // UnsafeAllowOriginFunc is an optional custom function to validate the origin. It takes the // origin as an argument and returns // - string, allowed origin // - bool, true if allowed or false otherwise. // - error, if an error is returned, it is returned immediately by the handler. // If this option is set, AllowOrigins is ignored. // // Security: use extreme caution when handling the origin, and carefully // validate any logic. Remember that attackers may register hostile (sub)domain names. // See https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html // // Sub-domain checks example: // UnsafeAllowOriginFunc: func(c *echo.Context, origin string) (string, bool, error) { // if strings.HasSuffix(origin, ".example.com") { // return origin, true, nil // } // return "", false, nil // }, // // Optional. UnsafeAllowOriginFunc func ( c * echo . Context , origin string ) ( allowedOrigin string , allowed bool , err error ) // AllowMethods determines the value of the Access-Control-Allow-Methods // response header. This header specified the list of methods allowed when // accessing the resource. This is used in response to a preflight request. // // Optional. Default value DefaultCORSConfig.AllowMethods. // If `allowMethods` is left empty, this middleware will fill for preflight // request `Access-Control-Allow-Methods` header value // from `Allow` header that echo.Router set into context. // // See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods AllowMethods [] string // AllowHeaders determines the value of the Access-Control-Allow-Headers // response header. This header is used in response to a preflight request to // indicate which HTTP headers can be used when making the actual request. // // Optional. Defaults to empty list. No domains allowed for CORS. // // See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers AllowHeaders [] string // AllowCredentials determines the value of the // Access-Control-Allow-Credentials response header. This header indicates // whether or not the response to the request can be exposed when the // credentials mode (Request.credentials) is true. When used as part of a // response to a preflight request, this indicates whether or not the actual // request can be made using credentials. See also // [MDN: Access-Control-Allow-Credentials]. // // Optional. Default value false, in which case the header is not set. // // Security: avoid using `AllowCredentials = true` with `AllowOrigins = *`. // See "Exploiting CORS misconfigurations for Bitcoins and bounties", // https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html // // See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials AllowCredentials bool // ExposeHeaders determines the value of Access-Control-Expose-Headers, which // defines a list of headers that clients are allowed to access. // // Optional. Default value []string{}, in which case the header is not set. // // See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Header ExposeHeaders [] string // MaxAge determines the value of the Access-Control-Max-Age response header. // This header indicates how long (in seconds) the results of a preflight // request can be cached. // The header is set only if MaxAge != 0, negative value sends "0" which instructs browsers not to cache that response. // // Optional. Default value 0 - meaning header is not sent. // // See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age MaxAge int } Fields Skipper Skipper Skipper defines a function to skip middleware. AllowOrigins []string AllowOrigins determines the value of the Access-Control-Allow-Origin response header. This header defines a list of origins that may access the resource. Origin consist of following parts: scheme + "://" + host + optional ":" + port Wildcard can be used, but has to be set explicitly []string{"*"} Example: https://example.com , http://example.com:8080 , * Security: use extreme caution when handling the origin, and carefully validate any logic. Remember that attackers may register hostile domain names. See https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin Mandatory. UnsafeAllowOriginFunc func(c *echo.Context, origin string) (allowedOrigin string, allowed bool, err error) UnsafeAllowOriginFunc is an optional custom function to validate the origin. It takes the origin as an argument and returns string, allowed origin bool, true if allowed or false otherwise. error, if an error is returned, it is returned immediately by the handler. If this option is set, AllowOrigins is ignored. Security: use extreme caution when handling the origin, and carefully validate any logic. Remember that attackers may register hostile (sub)domain names. See https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html Sub-domain checks example: UnsafeAllowOriginFunc: func(c *echo.Context, origin string) (string, bool, error) { if strings.HasSuffix(origin, ".example.com") { return origin, true, nil } return "", false, nil }, Optional. AllowMethods []string AllowMethods determines the value of the Access-Control-Allow-Methods response header. This header specified the list of methods allowed when accessing the resource. This is used in response to a preflight request. Optional. Default value DefaultCORSConfig.AllowMethods. If allowMethods is left empty, this middleware will fill for preflight request Access-Control-Allow-Methods header value from Allow header that echo.Router set into context. See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods AllowHeaders []string AllowHeaders determines the value of the Access-Control-Allow-Headers response header. This header is used in response to a preflight request to indicate which HTTP headers can be used when making the actual request. Optional. Defaults to empty list. No domains allowed for CORS. See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers AllowCredentials bool AllowCredentials determines the value of the Access-Control-Allow-Credentials response header. This header indicates whether or not the response to the request can be exposed when the credentials mode (Request.credentials) is true. When used as part of a response to a preflight request, this indicates whether or not the actual request can be made using credentials. See also [MDN: Access-Control-Allow-Credentials]. Optional. Default value false, in which case the header is not set. Security: avoid using AllowCredentials = true with AllowOrigins = * . See "Exploiting CORS misconfigurations for Bitcoins and bounties", https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials ExposeHeaders []string ExposeHeaders determines the value of Access-Control-Expose-Headers, which defines a list of headers that clients are allowed to access. Optional. Default value []string{}, in which case the header is not set. See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Header MaxAge int MaxAge determines the value of the Access-Control-Max-Age response header. This header indicates how long (in seconds) the results of a preflight request can be cached. The header is set only if MaxAge != 0, negative value sends "0" which instructs browsers not to cache that response. Optional. Default value 0 - meaning header is not sent. See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/cors.go:151 ToMiddleware converts CORSConfig to middleware or returns an error for invalid configuration type CSRFConfig Source: middleware/csrf.go:26 CSRFConfig defines the config for CSRF middleware. Copy type CSRFConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // TrustedOrigins permits any request with `Sec-Fetch-Site` header whose `Origin` header // exactly matches a configured origin. // Values should be formatted as Origin header "scheme://host[:port]". // // See [Origin]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin // See [Sec-Fetch-Site]: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#fetch-metadata-headers TrustedOrigins [] string // AllowSecFetchSiteFunc allows custom behaviour for `Sec-Fetch-Site` requests that are about to // fail with CSRF error, to be allowed or replaced with custom error. // This function applies to `Sec-Fetch-Site` values: // - `same-site` same registrable domain (subdomain and/or different port) // - `cross-site` request originates from different site // See [Sec-Fetch-Site]: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#fetch-metadata-headers AllowSecFetchSiteFunc func ( c * echo . Context ) ( bool , error ) // TokenLength is the length of the generated token. TokenLength uint8 // TokenLookup is a string in the form of "<source>:<name>" or "<source>:<name>,<source>:<name>" that is used // to extract token from the request. // Optional. Default value "header:X-CSRF-Token". // Possible values: // - "header:<name>" or "header:<name>:<cut-prefix>" // - "query:<name>" // - "form:<name>" // Multiple sources example: // - "header:X-CSRF-Token,query:csrf" TokenLookup string `yaml:"token_lookup"` // Generator defines a function to generate token. // Optional. Defaults to randomString(TokenLength). Generator func () string // Context key to store generated CSRF token into context. // Optional. Default value "csrf". ContextKey string // Name of the CSRF cookie. This cookie will store CSRF token. // Optional. Default value "csrf". CookieName string // Domain of the CSRF cookie. // Optional. Default value none. CookieDomain string // Path of the CSRF cookie. // Optional. Default value none. CookiePath string // Max age (in seconds) of the CSRF cookie. // Optional. Default value 86400 (24hr). CookieMaxAge int // Indicates if CSRF cookie is secure. // Optional. Default value false. CookieSecure bool // Indicates if CSRF cookie is HTTP only. // Optional. Default value false. CookieHTTPOnly bool // Indicates SameSite mode of the CSRF cookie. // Optional. Default value SameSiteDefaultMode. CookieSameSite http . SameSite // ErrorHandler defines a function which is executed for returning custom errors. ErrorHandler func ( c * echo . Context , err error ) error } Fields Skipper Skipper Skipper defines a function to skip middleware. TrustedOrigins []string TrustedOrigins permits any request with Sec-Fetch-Site header whose Origin header exactly matches a configured origin. Values should be formatted as Origin header "scheme://host[:port]". See [Origin]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin See [Sec-Fetch-Site]: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#fetch-metadata-headers AllowSecFetchSiteFunc func(c *echo.Context) (bool, error) AllowSecFetchSiteFunc allows custom behaviour for Sec-Fetch-Site requests that are about to fail with CSRF error, to be allowed or replaced with custom error. This function applies to Sec-Fetch-Site values: same-site same registrable domain (subdomain and/or different port) cross-site request originates from different site See [Sec-Fetch-Site]: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#fetch-metadata-headers TokenLength uint8 TokenLength is the length of the generated token. TokenLookup string `yaml:"token_lookup"` TokenLookup is a string in the form of " :" or " :, :" that is used to extract token from the request. Optional. Default value "header:X-CSRF-Token". Possible values: "header:" or "header::" "query:" "form:" Multiple sources example: "header:X-CSRF-Token,query:csrf" Generator func() string Generator defines a function to generate token. Optional. Defaults to randomString(TokenLength). ContextKey string Context key to store generated CSRF token into context. Optional. Default value "csrf". CookieName string Name of the CSRF cookie. This cookie will store CSRF token. Optional. Default value "csrf". CookieDomain string Domain of the CSRF cookie. Optional. Default value none. CookiePath string Path of the CSRF cookie. Optional. Default value none. CookieMaxAge int Max age (in seconds) of the CSRF cookie. Optional. Default value 86400 (24hr). CookieSecure bool Indicates if CSRF cookie is secure. Optional. Default value false. CookieHTTPOnly bool Indicates if CSRF cookie is HTTP only. Optional. Default value false. CookieSameSite http.SameSite Indicates SameSite mode of the CSRF cookie. Optional. Default value SameSiteDefaultMode. ErrorHandler func(c *echo.Context, err error) error ErrorHandler defines a function which is executed for returning custom errors. func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/csrf.go:126 ToMiddleware converts CSRFConfig to middleware or returns an error for invalid configuration type ContextTimeoutConfig Source: middleware/context_timeout.go:15 ContextTimeoutConfig defines the config for ContextTimeout middleware. Copy type ContextTimeoutConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // ErrorHandler is a function when error arises in middeware execution. ErrorHandler func ( c * echo . Context , err error ) error // Timeout configures a timeout for the middleware Timeout time . Duration } Fields Skipper Skipper Skipper defines a function to skip middleware. ErrorHandler func(c *echo.Context, err error) error ErrorHandler is a function when error arises in middeware execution. Timeout time.Duration Timeout configures a timeout for the middleware func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/context_timeout.go:38 ToMiddleware converts Config to middleware. type DecompressConfig Source: middleware/decompress.go:16 DecompressConfig defines the config for Decompress middleware. Copy type DecompressConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // GzipDecompressPool defines an interface to provide the sync.Pool used to create/store Gzip readers GzipDecompressPool Decompressor // MaxDecompressedSize limits the maximum size of decompressed request body in bytes. // If the decompressed body exceeds this limit, the middleware returns HTTP 413 error. // This prevents zip bomb attacks where small compressed payloads decompress to huge sizes. // Default: 100 * MB (104,857,600 bytes) // Set to -1 to disable limits (not recommended in production). MaxDecompressedSize int64 } Fields Skipper Skipper Skipper defines a function to skip middleware. GzipDecompressPool Decompressor GzipDecompressPool defines an interface to provide the sync.Pool used to create/store Gzip readers MaxDecompressedSize int64 MaxDecompressedSize limits the maximum size of decompressed request body in bytes. If the decompressed body exceeds this limit, the middleware returns HTTP 413 error. This prevents zip bomb attacks where small compressed payloads decompress to huge sizes. Default: 100 * MB (104,857,600 bytes) Set to -1 to disable limits (not recommended in production). func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/decompress.go:65 ToMiddleware converts DecompressConfig to middleware or returns an error for invalid configuration type Decompressor Source: middleware/decompress.go:35 Decompressor is used to get the sync.Pool used by the middleware to get Gzip readers Copy type Decompressor interface { // contains filtered or unexported methods } type DefaultGzipDecompressPool Source: middleware/decompress.go:40 DefaultGzipDecompressPool is the default implementation of Decompressor interface Copy type DefaultGzipDecompressPool struct { } type Extractor Source: middleware/rate_limiter.go:52 Extractor is used to extract data from *echo.Context Copy type Extractor func ( c * echo . Context ) ( string , error ) type ExtractorSource Source: middleware/extractor.go:21 ExtractorSource is type to indicate source for extracted value Copy type ExtractorSource string type GzipConfig Source: middleware/compress.go:25 GzipConfig defines the config for Gzip middleware. Copy type GzipConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // Gzip compression level. // Optional. Default value -1. Level int // Length threshold before gzip compression is applied. // Optional. Default value 0. // // Most of the time you will not need to change the default. Compressing // a short response might increase the transmitted data because of the // gzip format overhead. Compressing the response will also consume CPU // and time on the server and the client (for decompressing). Depending on // your use case such a threshold might be useful. // // See also: // https://webmasters.stackexchange.com/questions/31750/what-is-recommended-minimum-object-size-for-gzip-performance-benefits MinLength int } Fields Skipper Skipper Skipper defines a function to skip middleware. Level int Gzip compression level. Optional. Default value -1. MinLength int Length threshold before gzip compression is applied. Optional. Default value 0. Most of the time you will not need to change the default. Compressing a short response might increase the transmitted data because of the gzip format overhead. Compressing the response will also consume CPU and time on the server and the client (for decompressing). Depending on your use case such a threshold might be useful. See also: https://webmasters.stackexchange.com/questions/31750/what-is-recommended-minimum-object-size-for-gzip-performance-benefits func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/compress.go:69 ToMiddleware converts GzipConfig to middleware or returns an error for invalid configuration type KeyAuthConfig Source: middleware/key_auth.go:19 KeyAuthConfig defines the config for KeyAuth middleware. SECURITY: The Validator function is responsible for securely comparing API keys. See KeyAuthValidator documentation for guidance on preventing timing attacks. Copy type KeyAuthConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // KeyLookup is a string in the form of "<source>:<name>" or "<source>:<name>,<source>:<name>" that is used // to extract key from the request. // Optional. Default value "header:Authorization:Bearer ". // Possible values: // - "header:<name>" or "header:<name>:<cut-prefix>" // `<cut-prefix>` is argument value to cut/trim prefix of the extracted value. This is useful if header // value has static prefix like `Authorization: <auth-scheme> <authorisation-parameters>` where part that we // want to cut is `<auth-scheme> ` note the space at the end. // In case of basic authentication `Authorization: Basic <credentials>` prefix we want to remove is `Basic `. // - "query:<name>" // - "form:<name>" // - "cookie:<name>" // Multiple sources example: // - "header:Authorization,header:X-Api-Key" KeyLookup string // AllowedCheckLimit set how many KeyLookup values are allowed to be checked. This is // useful environments like corporate test environments with application proxies restricting // access to environment with their own auth scheme. AllowedCheckLimit uint // Validator is a function to validate key. // Required. Validator KeyAuthValidator // ErrorHandler defines a function which is executed when all lookups have been done and none of them passed Validator // function. ErrorHandler is executed with last missing (ErrExtractionValueMissing) or an invalid key. // It may be used to define a custom error. // // Note: when error handler swallows the error (returns nil) middleware continues handler chain execution towards handler. // This is useful in cases when portion of your site/api is publicly accessible and has extra features for authorized users // In that case you can use ErrorHandler to set default public auth value to request and continue with handler chain. ErrorHandler KeyAuthErrorHandler // ContinueOnIgnoredError allows the next middleware/handler to be called when ErrorHandler decides to // ignore the error (by returning `nil`). // This is useful when parts of your site/api allow public access and some authorized routes provide extra functionality. // In that case you can use ErrorHandler to set a default public key auth value in the request context // and continue. Some logic down the remaining execution chain needs to check that (public) key auth value then. ContinueOnIgnoredError bool } Fields Skipper Skipper Skipper defines a function to skip middleware. KeyLookup string KeyLookup is a string in the form of " :" or " :, :" that is used to extract key from the request. Optional. Default value "header:Authorization:Bearer ". Possible values: "header:" or "header::" is argument value to cut/trim prefix of the extracted value. This is useful if header value has static prefix like Authorization: where part that we want to cut is note the space at the end. In case of basic authentication Authorization: Basic prefix we want to remove is Basic . "query:" "form:" "cookie:" Multiple sources example: "header:Authorization,header:X-Api-Key" AllowedCheckLimit uint AllowedCheckLimit set how many KeyLookup values are allowed to be checked. This is useful environments like corporate test environments with application proxies restricting access to environment with their own auth scheme. Validator KeyAuthValidator Validator is a function to validate key. Required. ErrorHandler KeyAuthErrorHandler ErrorHandler defines a function which is executed when all lookups have been done and none of them passed Validator function. ErrorHandler is executed with last missing (ErrExtractionValueMissing) or an invalid key. It may be used to define a custom error. Note: when error handler swallows the error (returns nil) middleware continues handler chain execution towards handler. This is useful in cases when portion of your site/api is publicly accessible and has extra features for authorized users In that case you can use ErrorHandler to set default public auth value to request and continue with handler chain. ContinueOnIgnoredError bool ContinueOnIgnoredError allows the next middleware/handler to be called when ErrorHandler decides to ignore the error (by returning nil ). This is useful when parts of your site/api allow public access and some authorized routes provide extra functionality. In that case you can use ErrorHandler to set a default public key auth value in the request context and continue. Some logic down the remaining execution chain needs to check that (public) key auth value then. func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/key_auth.go:138 ToMiddleware converts KeyAuthConfig to middleware or returns an error for invalid configuration type KeyAuthErrorHandler Source: middleware/key_auth.go:103 KeyAuthErrorHandler defines a function which is executed for an invalid key. Copy type KeyAuthErrorHandler func ( c * echo . Context , err error ) error type KeyAuthValidator Source: middleware/key_auth.go:100 KeyAuthValidator defines a function to validate KeyAuth credentials. SECURITY WARNING: To prevent timing attacks that could allow attackers to enumerate valid API keys, validator implementations MUST use constant-time comparison. Use crypto/subtle.ConstantTimeCompare instead of standard string equality (==) or switch statements. Example of SECURE implementation: Copy import "crypto/subtle" validator := func(c *echo.Context, key string, source ExtractorSource) (bool, error) { // Fetch valid keys from database/config validKeys := []string{"key1", "key2", "key3"} for _, validKey := range validKeys { // Use constant-time comparison to prevent timing attacks if subtle.ConstantTimeCompare([]byte(key), []byte(validKey)) == 1 { return true, nil } } return false, nil } Example of INSECURE implementation (DO NOT USE): Copy // VULNERABLE TO TIMING ATTACKS - DO NOT USE validator := func(c *echo.Context, key string, source ExtractorSource) (bool, error) { switch key { // Timing leak! case "valid-key": return true, nil default: return false, nil } } Copy type KeyAuthValidator func ( c * echo . Context , key string , source ExtractorSource ) ( bool , error ) type MethodOverrideConfig Source: middleware/method_override.go:13 MethodOverrideConfig defines the config for MethodOverride middleware. Copy type MethodOverrideConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // Getter is a function that gets overridden method from the request. // Optional. Default values MethodFromHeader(echo.HeaderXHTTPMethodOverride). Getter MethodOverrideGetter } Fields Skipper Skipper Skipper defines a function to skip middleware. Getter MethodOverrideGetter Getter is a function that gets overridden method from the request. Optional. Default values MethodFromHeader(echo.HeaderXHTTPMethodOverride). func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/method_override.go:46 ToMiddleware converts MethodOverrideConfig to middleware or returns an error for invalid configuration type MethodOverrideGetter Source: middleware/method_override.go:23 MethodOverrideGetter is a function that gets overridden method from the request Copy type MethodOverrideGetter func ( c * echo . Context ) string type PanicStackError Source: middleware/recover.go:92 PanicStackError is an error type that wraps an error along with its stack trace. It is returned when config.DisablePrintStack is set to false. Copy type PanicStackError struct { Stack [] byte Err error } Fields Stack []byte Err error func Error) Error() string Source: middleware/recover.go:97 func Unwrap() error Source: middleware/recover.go:101 type ProxyBalancer Source: middleware/proxy.go:100 ProxyBalancer defines an interface to implement a load balancing technique. Copy type ProxyBalancer interface { AddTarget ( target * ProxyTarget ) bool RemoveTarget ( targetName string ) bool Next ( c * echo . Context ) ( * ProxyTarget , error ) } Methods AddTarget func(target *ProxyTarget) bool RemoveTarget func(targetName string) bool Next func(c *echo.Context) (*ProxyTarget, error) type ProxyConfig Source: middleware/proxy.go:29 ProxyConfig defines the config for Proxy middleware. Copy type ProxyConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // Balancer defines a load balancing technique. // Required. Balancer ProxyBalancer // RetryCount defines the number of times a failed proxied request should be retried // using the next available ProxyTarget. Defaults to 0, meaning requests are never retried. RetryCount int // RetryFilter defines a function used to determine if a failed request to a // ProxyTarget should be retried. The RetryFilter will only be called when the number // of previous retries is less than RetryCount. If the function returns true, the // request will be retried. The provided error indicates the reason for the request // failure. When the ProxyTarget is unavailable, the error will be an instance of // echo.HTTPError with a code of http.StatusBadGateway. In all other cases, the error // will indicate an internal error in the Proxy middleware. When a RetryFilter is not // specified, all requests that fail with http.StatusBadGateway will be retried. A custom // RetryFilter can be provided to only retry specific requests. Note that RetryFilter is // only called when the request to the target fails, or an internal error in the Proxy // middleware has occurred. Successful requests that return a non-200 response code cannot // be retried. RetryFilter func ( c * echo . Context , e error ) bool // ErrorHandler defines a function which can be used to return custom errors from // the Proxy middleware. ErrorHandler is only invoked when there has been // either an internal error in the Proxy middleware or the ProxyTarget is // unavailable. Due to the way requests are proxied, ErrorHandler is not invoked // when a ProxyTarget returns a non-200 response. In these cases, the response // is already written so errors cannot be modified. ErrorHandler is only // invoked after all retry attempts have been exhausted. ErrorHandler func ( c * echo . Context , err error ) error // Rewrite defines URL path rewrite rules. The values captured in asterisk can be // retrieved by index e.g. $1, $2 and so on. // Examples: // "/old": "/new", // "/api/*": "/$1", // "/js/*": "/public/javascripts/$1", // "/users/*/orders/*": "/user/$1/order/$2", Rewrite map [ string ] string // RegexRewrite defines rewrite rules using regexp.Rexexp with captures // Every capture group in the values can be retrieved by index e.g. $1, $2 and so on. // Example: // "^/old/[0.9]+/": "/new", // "^/api/.+?/(.*)": "/v2/$1", RegexRewrite map [ * regexp . Regexp ] string // Context key to store selected ProxyTarget into context. // Optional. Default value "target". ContextKey string // To customize the transport to remote. // Examples: If custom TLS certificates are required. Transport http . RoundTripper // ModifyResponse defines function to modify response from ProxyTarget. ModifyResponse func ( * http . Response ) error } Fields Skipper Skipper Skipper defines a function to skip middleware. Balancer ProxyBalancer Balancer defines a load balancing technique. Required. RetryCount int RetryCount defines the number of times a failed proxied request should be retried using the next available ProxyTarget. Defaults to 0, meaning requests are never retried. RetryFilter func(c *echo.Context, e error) bool RetryFilter defines a function used to determine if a failed request to a ProxyTarget should be retried. The RetryFilter will only be called when the number of previous retries is less than RetryCount. If the function returns true, the request will be retried. The provided error indicates the reason for the request failure. When the ProxyTarget is unavailable, the error will be an instance of echo.HTTPError with a code of http.StatusBadGateway. In all other cases, the error will indicate an internal error in the Proxy middleware. When a RetryFilter is not specified, all requests that fail with http.StatusBadGateway will be retried. A custom RetryFilter can be provided to only retry specific requests. Note that RetryFilter is only called when the request to the target fails, or an internal error in the Proxy middleware has occurred. Successful requests that return a non-200 response code cannot be retried. ErrorHandler func(c *echo.Context, err error) error ErrorHandler defines a function which can be used to return custom errors from the Proxy middleware. ErrorHandler is only invoked when there has been either an internal error in the Proxy middleware or the ProxyTarget is unavailable. Due to the way requests are proxied, ErrorHandler is not invoked when a ProxyTarget returns a non-200 response. In these cases, the response is already written so errors cannot be modified. ErrorHandler is only invoked after all retry attempts have been exhausted. Rewrite map[string]string Rewrite defines URL path rewrite rules. The values captured in asterisk can be retrieved by index e.g. $1, $2 and so on. Examples: "/old": "/new", "/api/ ": "/$1", "/js/ ": "/public/javascripts/$1", "/users/ /orders/ ": "/user/$1/order/$2", RegexRewrite map[*regexp.Regexp]string RegexRewrite defines rewrite rules using regexp.Rexexp with captures Every capture group in the values can be retrieved by index e.g. $1, $2 and so on. Example: "^/old/[0.9]+/": "/new", "^/api/.+?/(.*)": "/v2/$1", ContextKey string Context key to store selected ProxyTarget into context. Optional. Default value "target". Transport http.RoundTripper To customize the transport to remote. Examples: If custom TLS certificates are required. ModifyResponse func(*http.Response) error ModifyResponse defines function to modify response from ProxyTarget. func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/proxy.go:306 ToMiddleware converts ProxyConfig to middleware or returns an error for invalid configuration type ProxyTarget Source: middleware/proxy.go:93 ProxyTarget defines the upstream target. Copy type ProxyTarget struct { Name string URL * url . URL Meta map [ string ] any } Fields Name string URL *url.URL Meta map[string]any type RateLimiterConfig Source: middleware/rate_limiter.go:38 RateLimiterConfig defines the configuration for the rate limiter Copy type RateLimiterConfig struct { Skipper Skipper BeforeFunc BeforeFunc // IdentifierExtractor uses *echo.Context to extract the identifier for a visitor IdentifierExtractor Extractor // Store defines a store for the rate limiter Store RateLimiterStore // ErrorHandler provides a handler to be called when IdentifierExtractor returns an error ErrorHandler func ( c * echo . Context , err error ) error // DenyHandler provides a handler to be called when RateLimiter denies access DenyHandler func ( c * echo . Context , identifier string , err error ) error } Fields Skipper Skipper BeforeFunc BeforeFunc IdentifierExtractor Extractor IdentifierExtractor uses *echo.Context to extract the identifier for a visitor Store RateLimiterStore Store defines a store for the rate limiter ErrorHandler func(c *echo.Context, err error) error ErrorHandler provides a handler to be called when IdentifierExtractor returns an error DenyHandler func(c *echo.Context, identifier string, err error) error DenyHandler provides a handler to be called when RateLimiter denies access func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/rate_limiter.go:124 ToMiddleware converts RateLimiterConfig to middleware or returns an error for invalid configuration type RateLimiterMemoryStore Source: middleware/rate_limiter.go:170 RateLimiterMemoryStore is the built-in store implementation for RateLimiter Copy type RateLimiterMemoryStore struct { // contains filtered or unexported fields } func Allow(identifier string) (bool, error) Source: middleware/rate_limiter.go:256 Allow implements RateLimiterStore.Allow func AllowContext(c *echo.Context, identifier string) (bool, error) Source: middleware/rate_limiter.go:263 AllowContext implements RateLimiterStoreContext: it makes the allow/deny decision and sets the X-RateLimit-* (and Retry-After when denied) response headers. type RateLimiterMemoryStoreConfig Source: middleware/rate_limiter.go:244 RateLimiterMemoryStoreConfig represents configuration for RateLimiterMemoryStore Copy type RateLimiterMemoryStoreConfig struct { Rate float64 // Rate of requests allowed to pass as req/s. For more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit. Burst int // Burst is maximum number of requests to pass at the same moment. It additionally allows a number of requests to pass when rate limit is reached. ExpiresIn time . Duration // ExpiresIn is the duration after that a rate limiter is cleaned up } Fields Rate float64 Rate of requests allowed to pass as req/s. For more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit . Burst int Burst is maximum number of requests to pass at the same moment. It additionally allows a number of requests to pass when rate limit is reached. ExpiresIn time.Duration ExpiresIn is the duration after that a rate limiter is cleaned up type RateLimiterStore Source: middleware/rate_limiter.go:25 RateLimiterStore is the interface to be implemented by custom stores. Copy type RateLimiterStore interface { Allow ( identifier string ) ( bool , error ) } Methods Allow func(identifier string) (bool, error) type RateLimiterStoreContext Source: middleware/rate_limiter.go:33 RateLimiterStoreContext is an optional interface a RateLimiterStore may implement. When the configured store implements it, the rate limiter calls AllowContext (with the request context) instead of Allow, allowing the store to set response headers such as Retry-After or X-RateLimit-* on the allow/deny decision. Copy type RateLimiterStoreContext interface { AllowContext ( c * echo . Context , identifier string ) ( bool , error ) } Methods AllowContext func(c *echo.Context, identifier string) (bool, error) type RecoverConfig Source: middleware/recover.go:15 RecoverConfig defines the config for Recover middleware. Copy type RecoverConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // Size of the stack to be printed. // Optional. Default value 4KB. StackSize int // DisableStackAll disables formatting stack traces of all other goroutines // into buffer after the trace for the current goroutine. // Optional. Default value false. DisableStackAll bool // DisablePrintStack disables printing stack trace. // Optional. Default value as false. DisablePrintStack bool } Fields Skipper Skipper Skipper defines a function to skip middleware. StackSize int Size of the stack to be printed. Optional. Default value 4KB. DisableStackAll bool DisableStackAll disables formatting stack traces of all other goroutines into buffer after the trace for the current goroutine. Optional. Default value false. DisablePrintStack bool DisablePrintStack disables printing stack trace. Optional. Default value as false. func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/recover.go:53 ToMiddleware converts RecoverConfig to middleware or returns an error for invalid configuration type RedirectConfig Source: middleware/redirect.go:15 RedirectConfig defines the config for Redirect middleware. Copy type RedirectConfig struct { // Skipper defines a function to skip middleware. Skipper // Status code to be used when redirecting the request. // Optional. Default value http.StatusMovedPermanently. Code int // contains filtered or unexported fields } Fields Skipper Skipper defines a function to skip middleware. Code int Status code to be used when redirecting the request. Optional. Default value http.StatusMovedPermanently. func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/redirect.go:119 ToMiddleware converts RedirectConfig to middleware or returns an error for invalid configuration type RemoveTrailingSlashConfig Source: middleware/slash.go:80 RemoveTrailingSlashConfig is the middleware config for removing trailing slash from the request. Copy type RemoveTrailingSlashConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // Status code to be used when redirecting the request. // Optional, but when provided the request is redirected using this code. RedirectCode int } Fields Skipper Skipper Skipper defines a function to skip middleware. RedirectCode int Status code to be used when redirecting the request. Optional, but when provided the request is redirected using this code. func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/slash.go:103 ToMiddleware converts RemoveTrailingSlashConfig to middleware or returns an error for invalid configuration type RequestIDConfig Source: middleware/request_id.go:11 RequestIDConfig defines the config for RequestID middleware. Copy type RequestIDConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // Generator defines a function to generate an ID. // Optional. Default value random.String(32). Generator func () string // RequestIDHandler defines a function which is executed for a request id. RequestIDHandler func ( c * echo . Context , requestID string ) // TargetHeader defines what header to look for to populate the id. // Optional. Default value is `X-Request-Id` TargetHeader string } Fields Skipper Skipper Skipper defines a function to skip middleware. Generator func() string Generator defines a function to generate an ID. Optional. Default value random.String(32). RequestIDHandler func(c *echo.Context, requestID string) RequestIDHandler defines a function which is executed for a request id. TargetHeader string TargetHeader defines what header to look for to populate the id. Optional. Default value is X-Request-Id func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/request_id.go:42 ToMiddleware converts RequestIDConfig to middleware or returns an error for invalid configuration type RequestLoggerConfig Source: middleware/request_logger.go:124 RequestLoggerConfig is configuration for Request Logger middleware. Copy type RequestLoggerConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // BeforeNextFunc defines a function that is called before next middleware or handler is called in chain. BeforeNextFunc func ( c * echo . Context ) // LogValuesFunc defines a function that is called with values extracted by logger from request/response. // Mandatory. LogValuesFunc func ( c * echo . Context , v RequestLoggerValues ) error // HandleError instructs logger to call global error handler when next middleware/handler returns an error. // This is useful when you have custom error handler that can decide to use different status codes. // // A side-effect of calling global error handler is that now Response has been committed and sent to the client // and middlewares up in chain can not change Response status code or response body. HandleError bool // LogLatency instructs logger to record duration it took to execute rest of the handler chain (next(c) call). LogLatency bool // LogProtocol instructs logger to extract request protocol (i.e. `HTTP/1.1` or `HTTP/2`) LogProtocol bool // LogRemoteIP instructs logger to extract request remote IP. See `echo.Context.RealIP()` for implementation details. LogRemoteIP bool // LogHost instructs logger to extract request host value (i.e. `example.com`) LogHost bool // LogMethod instructs logger to extract request method value (i.e. `GET` etc) LogMethod bool // LogURI instructs logger to extract request URI (i.e. `/list?lang=en&page=1`) LogURI bool // LogURIPath instructs logger to extract request URI path part (i.e. `/list`) LogURIPath bool // LogRoutePath instructs logger to extract route path part to which request was matched to (i.e. `/user/:id`) LogRoutePath bool // LogRequestID instructs logger to extract request ID from request `X-Request-ID` header or response if request did not have value. LogRequestID bool // LogReferer instructs logger to extract request referer values. LogReferer bool // LogUserAgent instructs logger to extract request user agent values. LogUserAgent bool // LogStatus instructs logger to extract response status code. If handler chain returns an error, // the status code is extracted from the error satisfying echo.StatusCoder interface. LogStatus bool // LogContentLength instructs logger to extract content length header value. Note: this value could be different from // actual request body size as it could be spoofed etc. LogContentLength bool // LogResponseSize instructs logger to extract response content length value. Note: when used with Gzip middleware // this value may not be always correct. LogResponseSize bool // LogHeaders instructs logger to extract given list of headers from request. Note: request can contain more than // one header with same value so slice of values is been logger for each given header. // // Note: header values are converted to canonical form with http.CanonicalHeaderKey as this how request parser converts header // names to. For example, the canonical key for "accept-encoding" is "Accept-Encoding". LogHeaders [] string // LogQueryParams instructs logger to extract given list of query parameters from request URI. Note: request can // contain more than one query parameter with same name so slice of values is been logger for each given query param name. LogQueryParams [] string // LogFormValues instructs logger to extract given list of form values from request body+URI. Note: request can // contain more than one form value with same name so slice of values is been logger for each given form value name. LogFormValues [] string // contains filtered or unexported fields } Fields Skipper Skipper Skipper defines a function to skip middleware. BeforeNextFunc func(c *echo.Context) BeforeNextFunc defines a function that is called before next middleware or handler is called in chain. LogValuesFunc func(c *echo.Context, v RequestLoggerValues) error LogValuesFunc defines a function that is called with values extracted by logger from request/response. Mandatory. HandleError bool HandleError instructs logger to call global error handler when next middleware/handler returns an error. This is useful when you have custom error handler that can decide to use different status codes. A side-effect of calling global error handler is that now Response has been committed and sent to the client and middlewares up in chain can not change Response status code or response body. LogLatency bool LogLatency instructs logger to record duration it took to execute rest of the handler chain (next(c) call). LogProtocol bool LogProtocol instructs logger to extract request protocol (i.e. HTTP/1.1 or HTTP/2 ) LogRemoteIP bool LogRemoteIP instructs logger to extract request remote IP. See echo.Context.RealIP() for implementation details. LogHost bool LogHost instructs logger to extract request host value (i.e. example.com ) LogMethod bool LogMethod instructs logger to extract request method value (i.e. GET etc) LogURI bool LogURI instructs logger to extract request URI (i.e. /list?lang=en&page=1 ) LogURIPath bool LogURIPath instructs logger to extract request URI path part (i.e. /list ) LogRoutePath bool LogRoutePath instructs logger to extract route path part to which request was matched to (i.e. /user/:id ) LogRequestID bool LogRequestID instructs logger to extract request ID from request X-Request-ID header or response if request did not have value. LogReferer bool LogReferer instructs logger to extract request referer values. LogUserAgent bool LogUserAgent instructs logger to extract request user agent values. LogStatus bool LogStatus instructs logger to extract response status code. If handler chain returns an error, the status code is extracted from the error satisfying echo.StatusCoder interface. LogContentLength bool LogContentLength instructs logger to extract content length header value. Note: this value could be different from actual request body size as it could be spoofed etc. LogResponseSize bool LogResponseSize instructs logger to extract response content length value. Note: when used with Gzip middleware this value may not be always correct. LogHeaders []string LogHeaders instructs logger to extract given list of headers from request. Note: request can contain more than one header with same value so slice of values is been logger for each given header. Note: header values are converted to canonical form with http.CanonicalHeaderKey as this how request parser converts header names to. For example, the canonical key for "accept-encoding" is "Accept-Encoding". LogQueryParams []string LogQueryParams instructs logger to extract given list of query parameters from request URI. Note: request can contain more than one query parameter with same name so slice of values is been logger for each given query param name. LogFormValues []string LogFormValues instructs logger to extract given list of form values from request body+URI. Note: request can contain more than one form value with same name so slice of values is been logger for each given form value name. func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/request_logger.go:246 ToMiddleware converts RequestLoggerConfig into middleware or returns an error for invalid configuration. type RequestLoggerValues Source: middleware/request_logger.go:189 RequestLoggerValues contains extracted values from logger. Copy type RequestLoggerValues struct { // StartTime is time recorded before next middleware/handler is executed. StartTime time . Time // Latency is duration it took to execute rest of the handler chain (next(c) call). Latency time . Duration // Protocol is request protocol (i.e. `HTTP/1.1` or `HTTP/2`) Protocol string // RemoteIP is request remote IP. See `echo.Context.RealIP()` for implementation details. RemoteIP string // Host is request host value (i.e. `example.com`) Host string // Method is request method value (i.e. `GET` etc) Method string // URI is request URI (i.e. `/list?lang=en&page=1`) URI string // URIPath is request URI path part (i.e. `/list`) URIPath string // RoutePath is route path part to which request was matched to (i.e. `/user/:id`) RoutePath string // RequestID is request ID from request `X-Request-ID` header or response if request did not have value. RequestID string // Referer is request referer values. Referer string // UserAgent is request user agent values. UserAgent string // Status is a response status code. When the handler returns an error satisfying echo.StatusCoder interface, then code from it. Status int // Error is error returned from executed handler chain. Error error // ContentLength is content length header value. Note: this value could be different from actual request body size // as it could be spoofed etc. ContentLength string // ResponseSize is response content length value. Note: when used with Gzip middleware this value may not be always correct. ResponseSize int64 // Headers are list of headers from request. Note: request can contain more than one header with same value so slice // of values is what will be returned/logged for each given header. // Note: header values are converted to canonical form with http.CanonicalHeaderKey as this how request parser converts header // names to. For example, the canonical key for "accept-encoding" is "Accept-Encoding". Headers map [ string ][] string // QueryParams are list of query parameters from request URI. Note: request can contain more than one query parameter // with same name so slice of values is what will be returned/logged for each given query param name. QueryParams map [ string ][] string // FormValues are list of form values from request body+URI. Note: request can contain more than one form value with // same name so slice of values is what will be returned/logged for each given form value name. FormValues map [ string ][] string } Fields StartTime time.Time StartTime is time recorded before next middleware/handler is executed. Latency time.Duration Latency is duration it took to execute rest of the handler chain (next(c) call). Protocol string Protocol is request protocol (i.e. HTTP/1.1 or HTTP/2 ) RemoteIP string RemoteIP is request remote IP. See echo.Context.RealIP() for implementation details. Host string Host is request host value (i.e. example.com ) Method string Method is request method value (i.e. GET etc) URI string URI is request URI (i.e. /list?lang=en&page=1 ) URIPath string URIPath is request URI path part (i.e. /list ) RoutePath string RoutePath is route path part to which request was matched to (i.e. /user/:id ) RequestID string RequestID is request ID from request X-Request-ID header or response if request did not have value. Referer string Referer is request referer values. UserAgent string UserAgent is request user agent values. Status int Status is a response status code. When the handler returns an error satisfying echo.StatusCoder interface, then code from it. Error error Error is error returned from executed handler chain. ContentLength string ContentLength is content length header value. Note: this value could be different from actual request body size as it could be spoofed etc. ResponseSize int64 ResponseSize is response content length value. Note: when used with Gzip middleware this value may not be always correct. Headers map[string][]string Headers are list of headers from request. Note: request can contain more than one header with same value so slice of values is what will be returned/logged for each given header. Note: header values are converted to canonical form with http.CanonicalHeaderKey as this how request parser converts header names to. For example, the canonical key for "accept-encoding" is "Accept-Encoding". QueryParams map[string][]string QueryParams are list of query parameters from request URI. Note: request can contain more than one query parameter with same name so slice of values is what will be returned/logged for each given query param name. FormValues map[string][]string FormValues are list of form values from request body+URI. Note: request can contain more than one form value with same name so slice of values is what will be returned/logged for each given form value name. type RewriteConfig Source: middleware/rewrite.go:15 RewriteConfig defines the config for Rewrite middleware. Copy type RewriteConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // Rules defines the URL path rewrite rules. The values captured in asterisk can be // retrieved by index e.g. $1, $2 and so on. // Example: // "/old": "/new", // "/api/*": "/$1", // "/js/*": "/public/javascripts/$1", // "/users/*/orders/*": "/user/$1/order/$2", // Required. Rules map [ string ] string // RegexRules defines the URL path rewrite rules using regexp.Rexexp with captures // Every capture group in the values can be retrieved by index e.g. $1, $2 and so on. // Example: // "^/old/[0.9]+/": "/new", // "^/api/.+?/(.*)": "/v2/$1", RegexRules map [ * regexp . Regexp ] string } Fields Skipper Skipper Skipper defines a function to skip middleware. Rules map[string]string Rules defines the URL path rewrite rules. The values captured in asterisk can be retrieved by index e.g. $1, $2 and so on. Example: "/old": "/new", "/api/ ": "/$1", "/js/ ": "/public/javascripts/$1", "/users/ /orders/ ": "/user/$1/order/$2", Required. RegexRules map[*regexp.Regexp]string RegexRules defines the URL path rewrite rules using regexp.Rexexp with captures Every capture group in the values can be retrieved by index e.g. $1, $2 and so on. Example: "^/old/[0.9]+/": "/new", "^/api/.+?/(.*)": "/v2/$1", func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/rewrite.go:54 ToMiddleware converts RewriteConfig to middleware or returns an error for invalid configuration type SecureConfig Source: middleware/secure.go:13 SecureConfig defines the config for Secure middleware. Copy type SecureConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // XSSProtection provides protection against cross-site scripting attack (XSS) // by setting the `X-XSS-Protection` header. // Optional. Default value "1; mode=block". XSSProtection string // ContentTypeNosniff provides protection against overriding Content-Type // header by setting the `X-Content-Type-Options` header. // Optional. Default value "nosniff". ContentTypeNosniff string // XFrameOptions can be used to indicate whether or not a browser should // be allowed to render a page in a <frame>, <iframe> or <object> . // Sites can use this to avoid clickjacking attacks, by ensuring that their // content is not embedded into other sites.provides protection against // clickjacking. // Optional. Default value "SAMEORIGIN". // Possible values: // - "SAMEORIGIN" - The page can only be displayed in a frame on the same origin as the page itself. // - "DENY" - The page cannot be displayed in a frame, regardless of the site attempting to do so. // - "ALLOW-FROM uri" - The page can only be displayed in a frame on the specified origin. XFrameOptions string // HSTSMaxAge sets the `Strict-Transport-Security` header to indicate how // long (in seconds) browsers should remember that this site is only to // be accessed using HTTPS. This reduces your exposure to some SSL-stripping // man-in-the-middle (MITM) attacks. // Optional. Default value 0. HSTSMaxAge int // HSTSExcludeSubdomains won't include subdomains tag in the `Strict Transport Security` // header, excluding all subdomains from security policy. It has no effect // unless HSTSMaxAge is set to a non-zero value. // Optional. Default value false. HSTSExcludeSubdomains bool // ContentSecurityPolicy sets the `Content-Security-Policy` header providing // security against cross-site scripting (XSS), clickjacking and other code // injection attacks resulting from execution of malicious content in the // trusted web page context. // Optional. Default value "". ContentSecurityPolicy string // CSPReportOnly would use the `Content-Security-Policy-Report-Only` header instead // of the `Content-Security-Policy` header. This allows iterative updates of the // content security policy by only reporting the violations that would // have occurred instead of blocking the resource. // Optional. Default value false. CSPReportOnly bool // HSTSPreloadEnabled will add the preload tag in the `Strict Transport Security` // header, which enables the domain to be included in the HSTS preload list // maintained by Chrome (and used by Firefox and Safari): https://hstspreload.org/ // Optional. Default value false. HSTSPreloadEnabled bool // ReferrerPolicy sets the `Referrer-Policy` header providing security against // leaking potentially sensitive request paths to third parties. // Optional. Default value "". ReferrerPolicy string } Fields Skipper Skipper Skipper defines a function to skip middleware. XSSProtection string XSSProtection provides protection against cross-site scripting attack (XSS) by setting the X-XSS-Protection header. Optional. Default value "1; mode=block". ContentTypeNosniff string ContentTypeNosniff provides protection against overriding Content-Type header by setting the X-Content-Type-Options header. Optional. Default value "nosniff". XFrameOptions string XFrameOptions can be used to indicate whether or not a browser should be allowed to render a page in a , or . Sites can use this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites.provides protection against clickjacking. Optional. Default value "SAMEORIGIN". Possible values: "SAMEORIGIN" - The page can only be displayed in a frame on the same origin as the page itself. "DENY" - The page cannot be displayed in a frame, regardless of the site attempting to do so. "ALLOW-FROM uri" - The page can only be displayed in a frame on the specified origin. HSTSMaxAge int HSTSMaxAge sets the Strict-Transport-Security header to indicate how long (in seconds) browsers should remember that this site is only to be accessed using HTTPS. This reduces your exposure to some SSL-stripping man-in-the-middle (MITM) attacks. Optional. Default value 0. HSTSExcludeSubdomains bool HSTSExcludeSubdomains won't include subdomains tag in the Strict Transport Security header, excluding all subdomains from security policy. It has no effect unless HSTSMaxAge is set to a non-zero value. Optional. Default value false. ContentSecurityPolicy string ContentSecurityPolicy sets the Content-Security-Policy header providing security against cross-site scripting (XSS), clickjacking and other code injection attacks resulting from execution of malicious content in the trusted web page context. Optional. Default value "". CSPReportOnly bool CSPReportOnly would use the Content-Security-Policy-Report-Only header instead of the Content-Security-Policy header. This allows iterative updates of the content security policy by only reporting the violations that would have occurred instead of blocking the resource. Optional. Default value false. HSTSPreloadEnabled bool HSTSPreloadEnabled will add the preload tag in the Strict Transport Security header, which enables the domain to be included in the HSTS preload list maintained by Chrome (and used by Firefox and Safari): https://hstspreload.org/ Optional. Default value false. ReferrerPolicy string ReferrerPolicy sets the Referrer-Policy header providing security against leaking potentially sensitive request paths to third parties. Optional. Default value "". func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/secure.go:101 ToMiddleware converts SecureConfig to middleware or returns an error for invalid configuration type Skipper Source: middleware/middleware.go:16 Skipper defines a function to skip middleware. Returning true skips processing the middleware. Copy type Skipper func ( c * echo . Context ) bool type StaticConfig Source: middleware/static.go:24 StaticConfig defines the config for Static middleware. Copy type StaticConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // Root directory from where the static content is served (relative to given Filesystem). // `Root: "."` means root folder from Filesystem. // Required. Root string // Filesystem provides access to the static content. // Optional. Defaults to echo.Filesystem (serves files from `.` folder where executable is started) Filesystem fs . FS // Index file for serving a directory. // Optional. Default value "index.html". Index string // Enable HTML5 mode by forwarding all not-found requests to root so that // SPA (single-page application) can handle the routing. // Optional. Default value false. HTML5 bool // Enable directory browsing. // Optional. Default value false. Browse bool // Enable ignoring of the base of the URL path. // Example: when assigning a static middleware to a non root path group, // the filesystem path is not doubled // Optional. Default value false. IgnoreBase bool // Deprecated: this field is ignored, use EnablePathUnescaping instead. DisablePathUnescaping will be removed in a future version. // Note: previously the zero value (false) enabled unescaping, which was the unsafe default. DisablePathUnescaping bool // EnablePathUnescaping enables path parameter (param: *) unescaping. // Default false (safe): encoded slashes (%2f) in the wildcard param are NOT decoded, // preventing ACL bypass where /admin%2fprivate.txt bypasses a /admin/* route guard by // not matching that route but having its wildcard param decoded to admin/private.txt. // Set to true only when serving files whose names contain URL-encoded characters // (e.g. "hello world.txt" via /hello%20world.txt) and you are not relying on // route-based ACL guards to restrict access. // // Enabling echo.RouterConfig.UseEscapedPathForMatching makes this field irrelevant and can lead to security issues when // using different Routes to exclude some of the files from being served. // e.g. if you serve files from directory as such and use different route to exclude some of the files from being served. // 0. given folder structure: // public/ // public/index.html // public/admin/private.txt // 1. share `public/` folder contents from the server root with `e.Static("/", "public")` // 2. naively assume that everything under /admin folder is now forbidden // e.GET("/admin/*", func(c *Context) error { return echo.ErrForbidden }) // Then request to `/assets/../admin%2fprivate.txt` will be served as router does not match it to guarded route. EnablePathUnescaping bool // DirectoryListTemplate is template to list directory contents // Optional. Default to `directoryListHTMLTemplate` constant below. DirectoryListTemplate string } Fields Skipper Skipper Skipper defines a function to skip middleware. Root string Root directory from where the static content is served (relative to given Filesystem). Root: "." means root folder from Filesystem. Required. Filesystem fs.FS Filesystem provides access to the static content. Optional. Defaults to echo.Filesystem (serves files from . folder where executable is started) Index string Index file for serving a directory. Optional. Default value "index.html". HTML5 bool Enable HTML5 mode by forwarding all not-found requests to root so that SPA (single-page application) can handle the routing. Optional. Default value false. Browse bool Enable directory browsing. Optional. Default value false. IgnoreBase bool Enable ignoring of the base of the URL path. Example: when assigning a static middleware to a non root path group, the filesystem path is not doubled Optional. Default value false. DisablePathUnescaping bool Deprecated: this field is ignored, use EnablePathUnescaping instead. DisablePathUnescaping will be removed in a future version. Note: previously the zero value (false) enabled unescaping, which was the unsafe default. EnablePathUnescaping bool EnablePathUnescaping enables path parameter (param: ) unescaping. Default false (safe): encoded slashes (%2f) in the wildcard param are NOT decoded, preventing ACL bypass where /admin%2fprivate.txt bypasses a /admin/ route guard by not matching that route but having its wildcard param decoded to admin/private.txt. Set to true only when serving files whose names contain URL-encoded characters (e.g. "hello world.txt" via /hello%20world.txt) and you are not relying on route-based ACL guards to restrict access. Enabling echo.RouterConfig.UseEscapedPathForMatching makes this field irrelevant and can lead to security issues when using different Routes to exclude some of the files from being served. e.g. if you serve files from directory as such and use different route to exclude some of the files from being served. 0. given folder structure: public/ public/index.html public/admin/private.txt share public/ folder contents from the server root with e.Static("/", "public") naively assume that everything under /admin folder is now forbidden e.GET("/admin/*", func(c *Context) error { return echo.ErrForbidden }) Then request to /assets/../admin%2fprivate.txt will be served as router does not match it to guarded route. DirectoryListTemplate string DirectoryListTemplate is template to list directory contents Optional. Default to directoryListHTMLTemplate constant below. func ToMiddleware() (echo.MiddlewareFunc, error) Source: middleware/static.go:177 ToMiddleware converts StaticConfig to middleware or returns an error for invalid configuration type ValueExtractorError Source: middleware/extractor.go:37 ValueExtractorError is error type when middleware extractor is unable to extract value from lookups Copy type ValueExtractorError struct { // contains filtered or unexported fields } func Error) Error() string Source: middleware/extractor.go:42 Error returns errors text type ValuesExtractor Source: middleware/extractor.go:54 ValuesExtractor defines a function for extracting values (keys/tokens) from the given context. Copy type ValuesExtractor func ( c * echo . Context ) ([] string , ExtractorSource , error ) type Visitor Source: middleware/rate_limiter.go:182 Visitor signifies a unique user's limiter details Copy type Visitor struct { * rate . Limiter // contains filtered or unexported fields } Fields *rate.Limiter + +### API Reference + +Path: `/api-reference.html` + +github.com/labstack/echo/v5 + +github.com/labstack/echo/v5 github.com/labstack/echo/v5 Package echo implements high performance, minimalist Go web framework. github.com/labstack/echo/v5 echotest github.com/labstack/echo/v5/echotest middleware github.com/labstack/echo/v5/middleware diff --git a/docs/api-reference/llms.txt b/docs/api-reference/llms.txt new file mode 100644 index 000000000..55e4d14ce --- /dev/null +++ b/docs/api-reference/llms.txt @@ -0,0 +1,10 @@ +# Echo API Reference + +> Package echo implements high performance, minimalist Go web framework. + +## API Reference + +- [github.com/labstack/echo/v5](/api-reference/package-root.html): Package echo implements high performance, minimalist Go web framework. +- [echotest](/api-reference/pkg-echotest.html): github.com/labstack/echo/v5/echotest +- [middleware](/api-reference/pkg-middleware.html): github.com/labstack/echo/v5/middleware +- [API Reference](/api-reference.html): github.com/labstack/echo/v5 diff --git a/docs/api-reference/report.md b/docs/api-reference/report.md new file mode 100644 index 000000000..4daf877aa --- /dev/null +++ b/docs/api-reference/report.md @@ -0,0 +1,49 @@ +# Sourcey API Reference for labstack/echo + +## Overview + +Generated comprehensive API reference documentation for [labstack/echo](https://github.com/labstack/echo), a high-performance, minimalist Go web framework. The docs are generated from the actual Go source code using Sourcey's godoc adapter. + +## What was built + +- **87 public APIs documented** across3 packages +- **Full-text search** across all API surfaces +- **Structured navigation** with package-level organization +- **GitHub Actions workflow** for automatic deployment to GitHub Pages + +## Packages documented + +1. **echo** - Core framework types and functions (Echo struct, Context interface, routing, etc.) +2. **echotest** - Testing utilities for echo applications +3. **middleware** - HTTP middleware functions (CORS, Logger, Recover, etc.) + +## Maintainer-facing gaps + +1. **Missing examples**: The godoc snapshot includes test examples, but more real-world usage examples would improve the docs +2. **Configuration reference**: The docs don't include configuration options for middleware (e.g., CORS options, rate limiter settings) +3. **Error handling**: The error handling patterns could be documented more comprehensively +4. **Migration guide**: No migration guide between echo versions +5. **Performance tips**: No documentation on performance optimization or best practices + +## How to use + +1. Visit [https://patrick6x6.github.io/echo/](https://patrick6x6.github.io/echo/) +2. Browse the API reference by package +3. Use the search functionality to find specific types or functions +4. Click on type names to see detailed documentation + +## Deployment + +The docs are deployed to GitHub Pages at [https://patrick6x6.github.io/echo/](https://patrick6x6.github.io/echo/). + +A PR has been submitted to the echo project to add these docs to the project's official documentation: [https://github.com/labstack/echo/pull/3045](https://github.com/labstack/echo/pull/3045) + +Once merged, the docs will be live at `labstack.github.io/echo`. + +## Technical details + +- **Sourcey version**: 3.6.5 +- **Go version**: 1.26.5 +- **Adapter**: godoc (snapshot mode) +- **Output format**: Static HTML with CSS/JS +- **Total size**: 2.4MB diff --git a/docs/api-reference/search-index.json b/docs/api-reference/search-index.json new file mode 100644 index 000000000..e733315d3 --- /dev/null +++ b/docs/api-reference/search-index.json @@ -0,0 +1 @@ +[{"title":"github.com/labstack/echo/v5","content":"Package echo implements high performance, minimalist Go web framework.","url":"/api-reference/package-root.html","tab":"API Reference","category":"Pages"},{"title":"Constants","content":"github.com/labstack/echo/v5 - Constants","url":"/api-reference/package-root.html#constants","tab":"API Reference","category":"Sections"},{"title":"Variables","content":"github.com/labstack/echo/v5 - Variables","url":"/api-reference/package-root.html#variables","tab":"API Reference","category":"Sections"},{"title":"Functions","content":"github.com/labstack/echo/v5 - Functions","url":"/api-reference/package-root.html#functions","tab":"API Reference","category":"Sections"},{"title":"BindBody","content":"github.com/labstack/echo/v5 - BindBody","url":"/api-reference/package-root.html#func-BindBody","tab":"API Reference","category":"Sections"},{"title":"BindHeaders","content":"github.com/labstack/echo/v5 - BindHeaders","url":"/api-reference/package-root.html#func-BindHeaders","tab":"API Reference","category":"Sections"},{"title":"BindPathValues","content":"github.com/labstack/echo/v5 - BindPathValues","url":"/api-reference/package-root.html#func-BindPathValues","tab":"API Reference","category":"Sections"},{"title":"BindQueryParams","content":"github.com/labstack/echo/v5 - BindQueryParams","url":"/api-reference/package-root.html#func-BindQueryParams","tab":"API Reference","category":"Sections"},{"title":"ContextGet","content":"github.com/labstack/echo/v5 - ContextGet","url":"/api-reference/package-root.html#func-ContextGet","tab":"API Reference","category":"Sections"},{"title":"ContextGetOr","content":"github.com/labstack/echo/v5 - ContextGetOr","url":"/api-reference/package-root.html#func-ContextGetOr","tab":"API Reference","category":"Sections"},{"title":"DefaultHTTPErrorHandler","content":"github.com/labstack/echo/v5 - DefaultHTTPErrorHandler","url":"/api-reference/package-root.html#func-DefaultHTTPErrorHandler","tab":"API Reference","category":"Sections"},{"title":"ExtractIPDirect","content":"github.com/labstack/echo/v5 - ExtractIPDirect","url":"/api-reference/package-root.html#func-ExtractIPDirect","tab":"API Reference","category":"Sections"},{"title":"ExtractIPFromRealIPHeader","content":"github.com/labstack/echo/v5 - ExtractIPFromRealIPHeader","url":"/api-reference/package-root.html#func-ExtractIPFromRealIPHeader","tab":"API Reference","category":"Sections"},{"title":"ExtractIPFromXFFHeader","content":"github.com/labstack/echo/v5 - ExtractIPFromXFFHeader","url":"/api-reference/package-root.html#func-ExtractIPFromXFFHeader","tab":"API Reference","category":"Sections"},{"title":"FormFieldBinder","content":"github.com/labstack/echo/v5 - FormFieldBinder","url":"/api-reference/package-root.html#func-FormFieldBinder","tab":"API Reference","category":"Sections"},{"title":"FormValue","content":"github.com/labstack/echo/v5 - FormValue","url":"/api-reference/package-root.html#func-FormValue","tab":"API Reference","category":"Sections"},{"title":"FormValueOr","content":"github.com/labstack/echo/v5 - FormValueOr","url":"/api-reference/package-root.html#func-FormValueOr","tab":"API Reference","category":"Sections"},{"title":"FormValues","content":"github.com/labstack/echo/v5 - FormValues","url":"/api-reference/package-root.html#func-FormValues","tab":"API Reference","category":"Sections"},{"title":"FormValuesOr","content":"github.com/labstack/echo/v5 - FormValuesOr","url":"/api-reference/package-root.html#func-FormValuesOr","tab":"API Reference","category":"Sections"},{"title":"HandlerName","content":"github.com/labstack/echo/v5 - HandlerName","url":"/api-reference/package-root.html#func-HandlerName","tab":"API Reference","category":"Sections"},{"title":"LegacyIPExtractor","content":"github.com/labstack/echo/v5 - LegacyIPExtractor","url":"/api-reference/package-root.html#func-LegacyIPExtractor","tab":"API Reference","category":"Sections"},{"title":"MustSubFS","content":"github.com/labstack/echo/v5 - MustSubFS","url":"/api-reference/package-root.html#func-MustSubFS","tab":"API Reference","category":"Sections"},{"title":"New","content":"github.com/labstack/echo/v5 - New","url":"/api-reference/package-root.html#func-New","tab":"API Reference","category":"Sections"},{"title":"NewBindingError","content":"github.com/labstack/echo/v5 - NewBindingError","url":"/api-reference/package-root.html#func-NewBindingError","tab":"API Reference","category":"Sections"},{"title":"NewConcurrentRouter","content":"github.com/labstack/echo/v5 - NewConcurrentRouter","url":"/api-reference/package-root.html#func-NewConcurrentRouter","tab":"API Reference","category":"Sections"},{"title":"NewContext","content":"github.com/labstack/echo/v5 - NewContext","url":"/api-reference/package-root.html#func-NewContext","tab":"API Reference","category":"Sections"},{"title":"NewDefaultFS","content":"github.com/labstack/echo/v5 - NewDefaultFS","url":"/api-reference/package-root.html#func-NewDefaultFS","tab":"API Reference","category":"Sections"},{"title":"NewHTTPError","content":"github.com/labstack/echo/v5 - NewHTTPError","url":"/api-reference/package-root.html#func-NewHTTPError","tab":"API Reference","category":"Sections"},{"title":"NewResponse","content":"github.com/labstack/echo/v5 - NewResponse","url":"/api-reference/package-root.html#func-NewResponse","tab":"API Reference","category":"Sections"},{"title":"NewRouter","content":"github.com/labstack/echo/v5 - NewRouter","url":"/api-reference/package-root.html#func-NewRouter","tab":"API Reference","category":"Sections"},{"title":"NewVirtualHostHandler","content":"github.com/labstack/echo/v5 - NewVirtualHostHandler","url":"/api-reference/package-root.html#func-NewVirtualHostHandler","tab":"API Reference","category":"Sections"},{"title":"NewWithConfig","content":"github.com/labstack/echo/v5 - NewWithConfig","url":"/api-reference/package-root.html#func-NewWithConfig","tab":"API Reference","category":"Sections"},{"title":"ParseValue","content":"github.com/labstack/echo/v5 - ParseValue","url":"/api-reference/package-root.html#func-ParseValue","tab":"API Reference","category":"Sections"},{"title":"ParseValueOr","content":"github.com/labstack/echo/v5 - ParseValueOr","url":"/api-reference/package-root.html#func-ParseValueOr","tab":"API Reference","category":"Sections"},{"title":"ParseValues","content":"github.com/labstack/echo/v5 - ParseValues","url":"/api-reference/package-root.html#func-ParseValues","tab":"API Reference","category":"Sections"},{"title":"ParseValuesOr","content":"github.com/labstack/echo/v5 - ParseValuesOr","url":"/api-reference/package-root.html#func-ParseValuesOr","tab":"API Reference","category":"Sections"},{"title":"PathParam","content":"github.com/labstack/echo/v5 - PathParam","url":"/api-reference/package-root.html#func-PathParam","tab":"API Reference","category":"Sections"},{"title":"PathParamOr","content":"github.com/labstack/echo/v5 - PathParamOr","url":"/api-reference/package-root.html#func-PathParamOr","tab":"API Reference","category":"Sections"},{"title":"PathValuesBinder","content":"github.com/labstack/echo/v5 - PathValuesBinder","url":"/api-reference/package-root.html#func-PathValuesBinder","tab":"API Reference","category":"Sections"},{"title":"QueryParam","content":"github.com/labstack/echo/v5 - QueryParam","url":"/api-reference/package-root.html#func-QueryParam","tab":"API Reference","category":"Sections"},{"title":"QueryParamOr","content":"github.com/labstack/echo/v5 - QueryParamOr","url":"/api-reference/package-root.html#func-QueryParamOr","tab":"API Reference","category":"Sections"},{"title":"QueryParams","content":"github.com/labstack/echo/v5 - QueryParams","url":"/api-reference/package-root.html#func-QueryParams","tab":"API Reference","category":"Sections"},{"title":"QueryParamsBinder","content":"github.com/labstack/echo/v5 - QueryParamsBinder","url":"/api-reference/package-root.html#func-QueryParamsBinder","tab":"API Reference","category":"Sections"},{"title":"QueryParamsOr","content":"github.com/labstack/echo/v5 - QueryParamsOr","url":"/api-reference/package-root.html#func-QueryParamsOr","tab":"API Reference","category":"Sections"},{"title":"ResolveResponseStatus","content":"github.com/labstack/echo/v5 - ResolveResponseStatus","url":"/api-reference/package-root.html#func-ResolveResponseStatus","tab":"API Reference","category":"Sections"},{"title":"StaticDirectoryHandler","content":"github.com/labstack/echo/v5 - StaticDirectoryHandler","url":"/api-reference/package-root.html#func-StaticDirectoryHandler","tab":"API Reference","category":"Sections"},{"title":"StaticFileHandler","content":"github.com/labstack/echo/v5 - StaticFileHandler","url":"/api-reference/package-root.html#func-StaticFileHandler","tab":"API Reference","category":"Sections"},{"title":"StatusCode","content":"github.com/labstack/echo/v5 - StatusCode","url":"/api-reference/package-root.html#func-StatusCode","tab":"API Reference","category":"Sections"},{"title":"TrustIPRange","content":"github.com/labstack/echo/v5 - TrustIPRange","url":"/api-reference/package-root.html#func-TrustIPRange","tab":"API Reference","category":"Sections"},{"title":"TrustLinkLocal","content":"github.com/labstack/echo/v5 - TrustLinkLocal","url":"/api-reference/package-root.html#func-TrustLinkLocal","tab":"API Reference","category":"Sections"},{"title":"TrustLoopback","content":"github.com/labstack/echo/v5 - TrustLoopback","url":"/api-reference/package-root.html#func-TrustLoopback","tab":"API Reference","category":"Sections"},{"title":"TrustPrivateNet","content":"github.com/labstack/echo/v5 - TrustPrivateNet","url":"/api-reference/package-root.html#func-TrustPrivateNet","tab":"API Reference","category":"Sections"},{"title":"UnwrapResponse","content":"github.com/labstack/echo/v5 - UnwrapResponse","url":"/api-reference/package-root.html#func-UnwrapResponse","tab":"API Reference","category":"Sections"},{"title":"WrapHandler","content":"github.com/labstack/echo/v5 - WrapHandler","url":"/api-reference/package-root.html#func-WrapHandler","tab":"API Reference","category":"Sections"},{"title":"WrapMiddleware","content":"github.com/labstack/echo/v5 - WrapMiddleware","url":"/api-reference/package-root.html#func-WrapMiddleware","tab":"API Reference","category":"Sections"},{"title":"Types","content":"github.com/labstack/echo/v5 - Types","url":"/api-reference/package-root.html#types","tab":"API Reference","category":"Sections"},{"title":"AddRouteError","content":"github.com/labstack/echo/v5 - AddRouteError","url":"/api-reference/package-root.html#type-AddRouteError","tab":"API Reference","category":"Sections"},{"title":"BindUnmarshaler","content":"github.com/labstack/echo/v5 - BindUnmarshaler","url":"/api-reference/package-root.html#type-BindUnmarshaler","tab":"API Reference","category":"Sections"},{"title":"Binder","content":"github.com/labstack/echo/v5 - Binder","url":"/api-reference/package-root.html#type-Binder","tab":"API Reference","category":"Sections"},{"title":"BindingError","content":"github.com/labstack/echo/v5 - BindingError","url":"/api-reference/package-root.html#type-BindingError","tab":"API Reference","category":"Sections"},{"title":"Config","content":"github.com/labstack/echo/v5 - Config","url":"/api-reference/package-root.html#type-Config","tab":"API Reference","category":"Sections"},{"title":"Context","content":"github.com/labstack/echo/v5 - Context","url":"/api-reference/package-root.html#type-Context","tab":"API Reference","category":"Sections"},{"title":"DefaultBinder","content":"github.com/labstack/echo/v5 - DefaultBinder","url":"/api-reference/package-root.html#type-DefaultBinder","tab":"API Reference","category":"Sections"},{"title":"DefaultJSONSerializer","content":"github.com/labstack/echo/v5 - DefaultJSONSerializer","url":"/api-reference/package-root.html#type-DefaultJSONSerializer","tab":"API Reference","category":"Sections"},{"title":"DefaultRouter","content":"github.com/labstack/echo/v5 - DefaultRouter","url":"/api-reference/package-root.html#type-DefaultRouter","tab":"API Reference","category":"Sections"},{"title":"Echo","content":"github.com/labstack/echo/v5 - Echo","url":"/api-reference/package-root.html#type-Echo","tab":"API Reference","category":"Sections"},{"title":"Group","content":"github.com/labstack/echo/v5 - Group","url":"/api-reference/package-root.html#type-Group","tab":"API Reference","category":"Sections"},{"title":"HTTPError","content":"github.com/labstack/echo/v5 - HTTPError","url":"/api-reference/package-root.html#type-HTTPError","tab":"API Reference","category":"Sections"},{"title":"HTTPErrorHandler","content":"github.com/labstack/echo/v5 - HTTPErrorHandler","url":"/api-reference/package-root.html#type-HTTPErrorHandler","tab":"API Reference","category":"Sections"},{"title":"HTTPStatusCoder","content":"github.com/labstack/echo/v5 - HTTPStatusCoder","url":"/api-reference/package-root.html#type-HTTPStatusCoder","tab":"API Reference","category":"Sections"},{"title":"HandlerFunc","content":"github.com/labstack/echo/v5 - HandlerFunc","url":"/api-reference/package-root.html#type-HandlerFunc","tab":"API Reference","category":"Sections"},{"title":"IPExtractor","content":"github.com/labstack/echo/v5 - IPExtractor","url":"/api-reference/package-root.html#type-IPExtractor","tab":"API Reference","category":"Sections"},{"title":"JSONSerializer","content":"github.com/labstack/echo/v5 - JSONSerializer","url":"/api-reference/package-root.html#type-JSONSerializer","tab":"API Reference","category":"Sections"},{"title":"MiddlewareConfigurator","content":"github.com/labstack/echo/v5 - MiddlewareConfigurator","url":"/api-reference/package-root.html#type-MiddlewareConfigurator","tab":"API Reference","category":"Sections"},{"title":"MiddlewareFunc","content":"github.com/labstack/echo/v5 - MiddlewareFunc","url":"/api-reference/package-root.html#type-MiddlewareFunc","tab":"API Reference","category":"Sections"},{"title":"PathValue","content":"github.com/labstack/echo/v5 - PathValue","url":"/api-reference/package-root.html#type-PathValue","tab":"API Reference","category":"Sections"},{"title":"PathValues","content":"github.com/labstack/echo/v5 - PathValues","url":"/api-reference/package-root.html#type-PathValues","tab":"API Reference","category":"Sections"},{"title":"Renderer","content":"github.com/labstack/echo/v5 - Renderer","url":"/api-reference/package-root.html#type-Renderer","tab":"API Reference","category":"Sections"},{"title":"Response","content":"github.com/labstack/echo/v5 - Response","url":"/api-reference/package-root.html#type-Response","tab":"API Reference","category":"Sections"},{"title":"Route","content":"github.com/labstack/echo/v5 - Route","url":"/api-reference/package-root.html#type-Route","tab":"API Reference","category":"Sections"},{"title":"RouteInfo","content":"github.com/labstack/echo/v5 - RouteInfo","url":"/api-reference/package-root.html#type-RouteInfo","tab":"API Reference","category":"Sections"},{"title":"Router","content":"github.com/labstack/echo/v5 - Router","url":"/api-reference/package-root.html#type-Router","tab":"API Reference","category":"Sections"},{"title":"RouterConfig","content":"github.com/labstack/echo/v5 - RouterConfig","url":"/api-reference/package-root.html#type-RouterConfig","tab":"API Reference","category":"Sections"},{"title":"Routes","content":"github.com/labstack/echo/v5 - Routes","url":"/api-reference/package-root.html#type-Routes","tab":"API Reference","category":"Sections"},{"title":"StartConfig","content":"github.com/labstack/echo/v5 - StartConfig","url":"/api-reference/package-root.html#type-StartConfig","tab":"API Reference","category":"Sections"},{"title":"TemplateRenderer","content":"github.com/labstack/echo/v5 - TemplateRenderer","url":"/api-reference/package-root.html#type-TemplateRenderer","tab":"API Reference","category":"Sections"},{"title":"TimeLayout","content":"github.com/labstack/echo/v5 - TimeLayout","url":"/api-reference/package-root.html#type-TimeLayout","tab":"API Reference","category":"Sections"},{"title":"TimeOpts","content":"github.com/labstack/echo/v5 - TimeOpts","url":"/api-reference/package-root.html#type-TimeOpts","tab":"API Reference","category":"Sections"},{"title":"TrustOption","content":"github.com/labstack/echo/v5 - TrustOption","url":"/api-reference/package-root.html#type-TrustOption","tab":"API Reference","category":"Sections"},{"title":"Validator","content":"github.com/labstack/echo/v5 - Validator","url":"/api-reference/package-root.html#type-Validator","tab":"API Reference","category":"Sections"},{"title":"ValueBinder","content":"github.com/labstack/echo/v5 - ValueBinder","url":"/api-reference/package-root.html#type-ValueBinder","tab":"API Reference","category":"Sections"},{"title":"const TimeLayoutUnixTime","content":"TimeLayout constants for parsing Unix timestamps in different precisions.\n\nconst (\n\tTimeLayoutUnixTime = TimeLayout(\"UnixTime\") // Unix timestamp in seconds\n\tTimeLayoutUnixTimeMilli = TimeLayout(\"UnixTimeMilli\") // Unix timestamp in milliseconds\n\tTimeLayoutUnixTimeNano = TimeLayout(\"UnixTimeNano\") // Unix timestamp in nanoseconds\n)","url":"/api-reference/package-root.html#const-TimeLayoutUnixTime","tab":"API Reference","category":"go constant"},{"title":"const TimeLayoutUnixTimeMilli","content":"TimeLayout constants for parsing Unix timestamps in different precisions.\n\nconst (\n\tTimeLayoutUnixTime = TimeLayout(\"UnixTime\") // Unix timestamp in seconds\n\tTimeLayoutUnixTimeMilli = TimeLayout(\"UnixTimeMilli\") // Unix timestamp in milliseconds\n\tTimeLayoutUnixTimeNano = TimeLayout(\"UnixTimeNano\") // Unix timestamp in nanoseconds\n)","url":"/api-reference/package-root.html#const-TimeLayoutUnixTimeMilli","tab":"API Reference","category":"go constant"},{"title":"const TimeLayoutUnixTimeNano","content":"TimeLayout constants for parsing Unix timestamps in different precisions.\n\nconst (\n\tTimeLayoutUnixTime = TimeLayout(\"UnixTime\") // Unix timestamp in seconds\n\tTimeLayoutUnixTimeMilli = TimeLayout(\"UnixTimeMilli\") // Unix timestamp in milliseconds\n\tTimeLayoutUnixTimeNano = TimeLayout(\"UnixTimeNano\") // Unix timestamp in nanoseconds\n)","url":"/api-reference/package-root.html#const-TimeLayoutUnixTimeNano","tab":"API Reference","category":"go constant"},{"title":"const MIMEApplicationJSON","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMEApplicationJSON","tab":"API Reference","category":"go constant"},{"title":"const MIMEApplicationJSONCharsetUTF8","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMEApplicationJSONCharsetUTF8","tab":"API Reference","category":"go constant"},{"title":"const MIMEApplicationJavaScript","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMEApplicationJavaScript","tab":"API Reference","category":"go constant"},{"title":"const MIMEApplicationJavaScriptCharsetUTF8","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMEApplicationJavaScriptCharsetUTF8","tab":"API Reference","category":"go constant"},{"title":"const MIMEApplicationXML","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMEApplicationXML","tab":"API Reference","category":"go constant"},{"title":"const MIMEApplicationXMLCharsetUTF8","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMEApplicationXMLCharsetUTF8","tab":"API Reference","category":"go constant"},{"title":"const MIMETextXML","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMETextXML","tab":"API Reference","category":"go constant"},{"title":"const MIMETextXMLCharsetUTF8","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMETextXMLCharsetUTF8","tab":"API Reference","category":"go constant"},{"title":"const MIMEApplicationForm","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMEApplicationForm","tab":"API Reference","category":"go constant"},{"title":"const MIMEApplicationProtobuf","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMEApplicationProtobuf","tab":"API Reference","category":"go constant"},{"title":"const MIMEApplicationMsgpack","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMEApplicationMsgpack","tab":"API Reference","category":"go constant"},{"title":"const MIMETextHTML","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMETextHTML","tab":"API Reference","category":"go constant"},{"title":"const MIMETextHTMLCharsetUTF8","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMETextHTMLCharsetUTF8","tab":"API Reference","category":"go constant"},{"title":"const MIMETextPlain","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMETextPlain","tab":"API Reference","category":"go constant"},{"title":"const MIMETextPlainCharsetUTF8","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMETextPlainCharsetUTF8","tab":"API Reference","category":"go constant"},{"title":"const MIMEMultipartForm","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMEMultipartForm","tab":"API Reference","category":"go constant"},{"title":"const MIMEOctetStream","content":"MIME types\n\nconst (\n\t// MIMEApplicationJSON JavaScript Object Notation (JSON) https://www.rfc-editor.org/rfc/rfc8259\n\tMIMEApplicationJSON = \"application/json\"\n\t// Deprecated: Please use MIMEApplicationJSON instead. JSON should be encoded using UTF-8 by default.\n\t// No \"charset\" parameter is defined for this registration.\n\t// Adding one really has no effect on compliant recipients.\n\t// See RFC 8259, section 8.1. https://datatracker.ietf.org/doc/html/rfc8259#section-8.1n\"\n\tMIMEApplicationJSONChars","url":"/api-reference/package-root.html#const-MIMEOctetStream","tab":"API Reference","category":"go constant"},{"title":"const PROPFIND","content":"const (\n\n\t// PROPFIND Method can be used on collection and property resources.\n\tPROPFIND = \"PROPFIND\"\n\t// REPORT Method can be used to get information about a resource, see rfc 3253\n\tREPORT = \"REPORT\"\n\t// QUERY Method is a safe, idempotent request method carrying request content (a query) in its body, see rfc 10008.\n\t// It is not (yet) part of the `net/http` standard library, so Echo defines it here.\n\tQUERY = \"QUERY\"\n\t// RouteNotFound is special method type for routes handling \"route not found\" ","url":"/api-reference/package-root.html#const-PROPFIND","tab":"API Reference","category":"go constant"},{"title":"const REPORT","content":"const (\n\n\t// PROPFIND Method can be used on collection and property resources.\n\tPROPFIND = \"PROPFIND\"\n\t// REPORT Method can be used to get information about a resource, see rfc 3253\n\tREPORT = \"REPORT\"\n\t// QUERY Method is a safe, idempotent request method carrying request content (a query) in its body, see rfc 10008.\n\t// It is not (yet) part of the `net/http` standard library, so Echo defines it here.\n\tQUERY = \"QUERY\"\n\t// RouteNotFound is special method type for routes handling \"route not found\" ","url":"/api-reference/package-root.html#const-REPORT","tab":"API Reference","category":"go constant"},{"title":"const QUERY","content":"const (\n\n\t// PROPFIND Method can be used on collection and property resources.\n\tPROPFIND = \"PROPFIND\"\n\t// REPORT Method can be used to get information about a resource, see rfc 3253\n\tREPORT = \"REPORT\"\n\t// QUERY Method is a safe, idempotent request method carrying request content (a query) in its body, see rfc 10008.\n\t// It is not (yet) part of the `net/http` standard library, so Echo defines it here.\n\tQUERY = \"QUERY\"\n\t// RouteNotFound is special method type for routes handling \"route not found\" ","url":"/api-reference/package-root.html#const-QUERY","tab":"API Reference","category":"go constant"},{"title":"const RouteNotFound","content":"const (\n\n\t// PROPFIND Method can be used on collection and property resources.\n\tPROPFIND = \"PROPFIND\"\n\t// REPORT Method can be used to get information about a resource, see rfc 3253\n\tREPORT = \"REPORT\"\n\t// QUERY Method is a safe, idempotent request method carrying request content (a query) in its body, see rfc 10008.\n\t// It is not (yet) part of the `net/http` standard library, so Echo defines it here.\n\tQUERY = \"QUERY\"\n\t// RouteNotFound is special method type for routes handling \"route not found\" ","url":"/api-reference/package-root.html#const-RouteNotFound","tab":"API Reference","category":"go constant"},{"title":"const RouteAny","content":"const (\n\n\t// PROPFIND Method can be used on collection and property resources.\n\tPROPFIND = \"PROPFIND\"\n\t// REPORT Method can be used to get information about a resource, see rfc 3253\n\tREPORT = \"REPORT\"\n\t// QUERY Method is a safe, idempotent request method carrying request content (a query) in its body, see rfc 10008.\n\t// It is not (yet) part of the `net/http` standard library, so Echo defines it here.\n\tQUERY = \"QUERY\"\n\t// RouteNotFound is special method type for routes handling \"route not found\" ","url":"/api-reference/package-root.html#const-RouteAny","tab":"API Reference","category":"go constant"},{"title":"const HeaderAccept","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderAccept","tab":"API Reference","category":"go constant"},{"title":"const HeaderAcceptEncoding","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderAcceptEncoding","tab":"API Reference","category":"go constant"},{"title":"const HeaderAllow","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderAllow","tab":"API Reference","category":"go constant"},{"title":"const HeaderAuthorization","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderAuthorization","tab":"API Reference","category":"go constant"},{"title":"const HeaderContentDisposition","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderContentDisposition","tab":"API Reference","category":"go constant"},{"title":"const HeaderContentEncoding","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderContentEncoding","tab":"API Reference","category":"go constant"},{"title":"const HeaderContentLength","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderContentLength","tab":"API Reference","category":"go constant"},{"title":"const HeaderContentType","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderContentType","tab":"API Reference","category":"go constant"},{"title":"const HeaderCookie","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderCookie","tab":"API Reference","category":"go constant"},{"title":"const HeaderSetCookie","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderSetCookie","tab":"API Reference","category":"go constant"},{"title":"const HeaderIfModifiedSince","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderIfModifiedSince","tab":"API Reference","category":"go constant"},{"title":"const HeaderLastModified","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderLastModified","tab":"API Reference","category":"go constant"},{"title":"const HeaderLocation","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderLocation","tab":"API Reference","category":"go constant"},{"title":"const HeaderRetryAfter","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderRetryAfter","tab":"API Reference","category":"go constant"},{"title":"const HeaderUpgrade","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderUpgrade","tab":"API Reference","category":"go constant"},{"title":"const HeaderVary","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderVary","tab":"API Reference","category":"go constant"},{"title":"const HeaderWWWAuthenticate","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderWWWAuthenticate","tab":"API Reference","category":"go constant"},{"title":"const HeaderXForwardedFor","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderXForwardedFor","tab":"API Reference","category":"go constant"},{"title":"const HeaderXForwardedProto","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderXForwardedProto","tab":"API Reference","category":"go constant"},{"title":"const HeaderXForwardedProtocol","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderXForwardedProtocol","tab":"API Reference","category":"go constant"},{"title":"const HeaderXForwardedSsl","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderXForwardedSsl","tab":"API Reference","category":"go constant"},{"title":"const HeaderXUrlScheme","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderXUrlScheme","tab":"API Reference","category":"go constant"},{"title":"const HeaderXHTTPMethodOverride","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderXHTTPMethodOverride","tab":"API Reference","category":"go constant"},{"title":"const HeaderXRealIP","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderXRealIP","tab":"API Reference","category":"go constant"},{"title":"const HeaderXRequestID","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderXRequestID","tab":"API Reference","category":"go constant"},{"title":"const HeaderXCorrelationID","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderXCorrelationID","tab":"API Reference","category":"go constant"},{"title":"const HeaderXRequestedWith","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderXRequestedWith","tab":"API Reference","category":"go constant"},{"title":"const HeaderServer","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderServer","tab":"API Reference","category":"go constant"},{"title":"const HeaderOrigin","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderOrigin","tab":"API Reference","category":"go constant"},{"title":"const HeaderCacheControl","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderCacheControl","tab":"API Reference","category":"go constant"},{"title":"const HeaderConnection","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderConnection","tab":"API Reference","category":"go constant"},{"title":"const HeaderAccessControlRequestMethod","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderAccessControlRequestMethod","tab":"API Reference","category":"go constant"},{"title":"const HeaderAccessControlRequestHeaders","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderAccessControlRequestHeaders","tab":"API Reference","category":"go constant"},{"title":"const HeaderAccessControlAllowOrigin","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderAccessControlAllowOrigin","tab":"API Reference","category":"go constant"},{"title":"const HeaderAccessControlAllowMethods","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderAccessControlAllowMethods","tab":"API Reference","category":"go constant"},{"title":"const HeaderAccessControlAllowHeaders","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderAccessControlAllowHeaders","tab":"API Reference","category":"go constant"},{"title":"const HeaderAccessControlAllowCredentials","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderAccessControlAllowCredentials","tab":"API Reference","category":"go constant"},{"title":"const HeaderAccessControlExposeHeaders","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderAccessControlExposeHeaders","tab":"API Reference","category":"go constant"},{"title":"const HeaderAccessControlMaxAge","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderAccessControlMaxAge","tab":"API Reference","category":"go constant"},{"title":"const HeaderStrictTransportSecurity","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderStrictTransportSecurity","tab":"API Reference","category":"go constant"},{"title":"const HeaderXContentTypeOptions","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderXContentTypeOptions","tab":"API Reference","category":"go constant"},{"title":"const HeaderXXSSProtection","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderXXSSProtection","tab":"API Reference","category":"go constant"},{"title":"const HeaderXFrameOptions","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderXFrameOptions","tab":"API Reference","category":"go constant"},{"title":"const HeaderContentSecurityPolicy","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderContentSecurityPolicy","tab":"API Reference","category":"go constant"},{"title":"const HeaderContentSecurityPolicyReportOnly","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderContentSecurityPolicyReportOnly","tab":"API Reference","category":"go constant"},{"title":"const HeaderXCSRFToken","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderXCSRFToken","tab":"API Reference","category":"go constant"},{"title":"const HeaderReferrerPolicy","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderReferrerPolicy","tab":"API Reference","category":"go constant"},{"title":"const HeaderSecFetchSite","content":"Headers\n\nconst (\n\tHeaderAccept = \"Accept\"\n\tHeaderAcceptEncoding = \"Accept-Encoding\"\n\t// HeaderAllow is the name of the \"Allow\" header field used to list the set of methods\n\t// advertised as supported by the target resource. Returning an Allow header is mandatory\n\t// for status 405 (method not found) and useful for the OPTIONS method in responses.\n\t// See RFC 7231: https://datatracker.ietf.org/doc/html/rfc7231#section-7.4.1\n\tHeaderAllow = \"Allow\"\n\tHeaderAuthorization =","url":"/api-reference/package-root.html#const-HeaderSecFetchSite","tab":"API Reference","category":"go constant"},{"title":"const NotFoundRouteName","content":"const (\n\t// NotFoundRouteName is name of RouteInfo returned when router did not find matching route (404: not found).\n\tNotFoundRouteName = \"echo_route_not_found_name\"\n\t// MethodNotAllowedRouteName is name of RouteInfo returned when router did not find matching method for route (405: method not allowed).\n\tMethodNotAllowedRouteName = \"echo_route_method_not_allowed_name\"\n)","url":"/api-reference/package-root.html#const-NotFoundRouteName","tab":"API Reference","category":"go constant"},{"title":"const MethodNotAllowedRouteName","content":"const (\n\t// NotFoundRouteName is name of RouteInfo returned when router did not find matching route (404: not found).\n\tNotFoundRouteName = \"echo_route_not_found_name\"\n\t// MethodNotAllowedRouteName is name of RouteInfo returned when router did not find matching method for route (405: method not allowed).\n\tMethodNotAllowedRouteName = \"echo_route_method_not_allowed_name\"\n)","url":"/api-reference/package-root.html#const-MethodNotAllowedRouteName","tab":"API Reference","category":"go constant"},{"title":"const ContextKeyHeaderAllow","content":"const (\n\t// ContextKeyHeaderAllow is set by Router for getting value for `Allow` header in later stages of handler call chain.\n\t// Allow header is mandatory for status 405 (method not found) and useful for OPTIONS method requests.\n\t// It is added to context only when Router does not find matching method handler for request.\n\tContextKeyHeaderAllow = \"echo_header_allow\"\n)","url":"/api-reference/package-root.html#const-ContextKeyHeaderAllow","tab":"API Reference","category":"go constant"},{"title":"const Version","content":"const (\n\t// Version of Echo\n\tVersion = \"5.3.0\"\n)","url":"/api-reference/package-root.html#const-Version","tab":"API Reference","category":"go constant"},{"title":"var ErrBadRequest","content":"The following errors can produce HTTP status code by implementing HTTPStatusCoder interface\n\nvar (\n\tErrBadRequest = &httpError{http.StatusBadRequest} // 400\n\tErrUnauthorized = &httpError{http.StatusUnauthorized} // 401\n\tErrForbidden = &httpError{http.StatusForbidden} // 403\n\tErrNotFound = &httpError{http.StatusNotFound} // 404\n\tErrMethodNotAllowed = &httpError{http.StatusM","url":"/api-reference/package-root.html#var-ErrBadRequest","tab":"API Reference","category":"go variable"},{"title":"var ErrUnauthorized","content":"The following errors can produce HTTP status code by implementing HTTPStatusCoder interface\n\nvar (\n\tErrBadRequest = &httpError{http.StatusBadRequest} // 400\n\tErrUnauthorized = &httpError{http.StatusUnauthorized} // 401\n\tErrForbidden = &httpError{http.StatusForbidden} // 403\n\tErrNotFound = &httpError{http.StatusNotFound} // 404\n\tErrMethodNotAllowed = &httpError{http.StatusM","url":"/api-reference/package-root.html#var-ErrUnauthorized","tab":"API Reference","category":"go variable"},{"title":"var ErrForbidden","content":"The following errors can produce HTTP status code by implementing HTTPStatusCoder interface\n\nvar (\n\tErrBadRequest = &httpError{http.StatusBadRequest} // 400\n\tErrUnauthorized = &httpError{http.StatusUnauthorized} // 401\n\tErrForbidden = &httpError{http.StatusForbidden} // 403\n\tErrNotFound = &httpError{http.StatusNotFound} // 404\n\tErrMethodNotAllowed = &httpError{http.StatusM","url":"/api-reference/package-root.html#var-ErrForbidden","tab":"API Reference","category":"go variable"},{"title":"var ErrNotFound","content":"The following errors can produce HTTP status code by implementing HTTPStatusCoder interface\n\nvar (\n\tErrBadRequest = &httpError{http.StatusBadRequest} // 400\n\tErrUnauthorized = &httpError{http.StatusUnauthorized} // 401\n\tErrForbidden = &httpError{http.StatusForbidden} // 403\n\tErrNotFound = &httpError{http.StatusNotFound} // 404\n\tErrMethodNotAllowed = &httpError{http.StatusM","url":"/api-reference/package-root.html#var-ErrNotFound","tab":"API Reference","category":"go variable"},{"title":"var ErrMethodNotAllowed","content":"The following errors can produce HTTP status code by implementing HTTPStatusCoder interface\n\nvar (\n\tErrBadRequest = &httpError{http.StatusBadRequest} // 400\n\tErrUnauthorized = &httpError{http.StatusUnauthorized} // 401\n\tErrForbidden = &httpError{http.StatusForbidden} // 403\n\tErrNotFound = &httpError{http.StatusNotFound} // 404\n\tErrMethodNotAllowed = &httpError{http.StatusM","url":"/api-reference/package-root.html#var-ErrMethodNotAllowed","tab":"API Reference","category":"go variable"},{"title":"var ErrRequestTimeout","content":"The following errors can produce HTTP status code by implementing HTTPStatusCoder interface\n\nvar (\n\tErrBadRequest = &httpError{http.StatusBadRequest} // 400\n\tErrUnauthorized = &httpError{http.StatusUnauthorized} // 401\n\tErrForbidden = &httpError{http.StatusForbidden} // 403\n\tErrNotFound = &httpError{http.StatusNotFound} // 404\n\tErrMethodNotAllowed = &httpError{http.StatusM","url":"/api-reference/package-root.html#var-ErrRequestTimeout","tab":"API Reference","category":"go variable"},{"title":"var ErrStatusRequestEntityTooLarge","content":"The following errors can produce HTTP status code by implementing HTTPStatusCoder interface\n\nvar (\n\tErrBadRequest = &httpError{http.StatusBadRequest} // 400\n\tErrUnauthorized = &httpError{http.StatusUnauthorized} // 401\n\tErrForbidden = &httpError{http.StatusForbidden} // 403\n\tErrNotFound = &httpError{http.StatusNotFound} // 404\n\tErrMethodNotAllowed = &httpError{http.StatusM","url":"/api-reference/package-root.html#var-ErrStatusRequestEntityTooLarge","tab":"API Reference","category":"go variable"},{"title":"var ErrUnsupportedMediaType","content":"The following errors can produce HTTP status code by implementing HTTPStatusCoder interface\n\nvar (\n\tErrBadRequest = &httpError{http.StatusBadRequest} // 400\n\tErrUnauthorized = &httpError{http.StatusUnauthorized} // 401\n\tErrForbidden = &httpError{http.StatusForbidden} // 403\n\tErrNotFound = &httpError{http.StatusNotFound} // 404\n\tErrMethodNotAllowed = &httpError{http.StatusM","url":"/api-reference/package-root.html#var-ErrUnsupportedMediaType","tab":"API Reference","category":"go variable"},{"title":"var ErrTooManyRequests","content":"The following errors can produce HTTP status code by implementing HTTPStatusCoder interface\n\nvar (\n\tErrBadRequest = &httpError{http.StatusBadRequest} // 400\n\tErrUnauthorized = &httpError{http.StatusUnauthorized} // 401\n\tErrForbidden = &httpError{http.StatusForbidden} // 403\n\tErrNotFound = &httpError{http.StatusNotFound} // 404\n\tErrMethodNotAllowed = &httpError{http.StatusM","url":"/api-reference/package-root.html#var-ErrTooManyRequests","tab":"API Reference","category":"go variable"},{"title":"var ErrInternalServerError","content":"The following errors can produce HTTP status code by implementing HTTPStatusCoder interface\n\nvar (\n\tErrBadRequest = &httpError{http.StatusBadRequest} // 400\n\tErrUnauthorized = &httpError{http.StatusUnauthorized} // 401\n\tErrForbidden = &httpError{http.StatusForbidden} // 403\n\tErrNotFound = &httpError{http.StatusNotFound} // 404\n\tErrMethodNotAllowed = &httpError{http.StatusM","url":"/api-reference/package-root.html#var-ErrInternalServerError","tab":"API Reference","category":"go variable"},{"title":"var ErrBadGateway","content":"The following errors can produce HTTP status code by implementing HTTPStatusCoder interface\n\nvar (\n\tErrBadRequest = &httpError{http.StatusBadRequest} // 400\n\tErrUnauthorized = &httpError{http.StatusUnauthorized} // 401\n\tErrForbidden = &httpError{http.StatusForbidden} // 403\n\tErrNotFound = &httpError{http.StatusNotFound} // 404\n\tErrMethodNotAllowed = &httpError{http.StatusM","url":"/api-reference/package-root.html#var-ErrBadGateway","tab":"API Reference","category":"go variable"},{"title":"var ErrServiceUnavailable","content":"The following errors can produce HTTP status code by implementing HTTPStatusCoder interface\n\nvar (\n\tErrBadRequest = &httpError{http.StatusBadRequest} // 400\n\tErrUnauthorized = &httpError{http.StatusUnauthorized} // 401\n\tErrForbidden = &httpError{http.StatusForbidden} // 403\n\tErrNotFound = &httpError{http.StatusNotFound} // 404\n\tErrMethodNotAllowed = &httpError{http.StatusM","url":"/api-reference/package-root.html#var-ErrServiceUnavailable","tab":"API Reference","category":"go variable"},{"title":"var ErrValidatorNotRegistered","content":"The following errors fall into 500 (InternalServerError) category\n\nvar (\n\tErrValidatorNotRegistered = errors.New(\"validator not registered\")\n\tErrRendererNotRegistered = errors.New(\"renderer not registered\")\n\tErrInvalidRedirectCode = errors.New(\"invalid redirect status code\")\n\tErrCookieNotFound = errors.New(\"cookie not found\")\n\tErrInvalidCertOrKeyType = errors.New(\"invalid cert or key type, must be string or []byte\")\n\tErrInvalidListenerNetwork = errors.New(\"invalid listener network\"","url":"/api-reference/package-root.html#var-ErrValidatorNotRegistered","tab":"API Reference","category":"go variable"},{"title":"var ErrRendererNotRegistered","content":"The following errors fall into 500 (InternalServerError) category\n\nvar (\n\tErrValidatorNotRegistered = errors.New(\"validator not registered\")\n\tErrRendererNotRegistered = errors.New(\"renderer not registered\")\n\tErrInvalidRedirectCode = errors.New(\"invalid redirect status code\")\n\tErrCookieNotFound = errors.New(\"cookie not found\")\n\tErrInvalidCertOrKeyType = errors.New(\"invalid cert or key type, must be string or []byte\")\n\tErrInvalidListenerNetwork = errors.New(\"invalid listener network\"","url":"/api-reference/package-root.html#var-ErrRendererNotRegistered","tab":"API Reference","category":"go variable"},{"title":"var ErrInvalidRedirectCode","content":"The following errors fall into 500 (InternalServerError) category\n\nvar (\n\tErrValidatorNotRegistered = errors.New(\"validator not registered\")\n\tErrRendererNotRegistered = errors.New(\"renderer not registered\")\n\tErrInvalidRedirectCode = errors.New(\"invalid redirect status code\")\n\tErrCookieNotFound = errors.New(\"cookie not found\")\n\tErrInvalidCertOrKeyType = errors.New(\"invalid cert or key type, must be string or []byte\")\n\tErrInvalidListenerNetwork = errors.New(\"invalid listener network\"","url":"/api-reference/package-root.html#var-ErrInvalidRedirectCode","tab":"API Reference","category":"go variable"},{"title":"var ErrCookieNotFound","content":"The following errors fall into 500 (InternalServerError) category\n\nvar (\n\tErrValidatorNotRegistered = errors.New(\"validator not registered\")\n\tErrRendererNotRegistered = errors.New(\"renderer not registered\")\n\tErrInvalidRedirectCode = errors.New(\"invalid redirect status code\")\n\tErrCookieNotFound = errors.New(\"cookie not found\")\n\tErrInvalidCertOrKeyType = errors.New(\"invalid cert or key type, must be string or []byte\")\n\tErrInvalidListenerNetwork = errors.New(\"invalid listener network\"","url":"/api-reference/package-root.html#var-ErrCookieNotFound","tab":"API Reference","category":"go variable"},{"title":"var ErrInvalidCertOrKeyType","content":"The following errors fall into 500 (InternalServerError) category\n\nvar (\n\tErrValidatorNotRegistered = errors.New(\"validator not registered\")\n\tErrRendererNotRegistered = errors.New(\"renderer not registered\")\n\tErrInvalidRedirectCode = errors.New(\"invalid redirect status code\")\n\tErrCookieNotFound = errors.New(\"cookie not found\")\n\tErrInvalidCertOrKeyType = errors.New(\"invalid cert or key type, must be string or []byte\")\n\tErrInvalidListenerNetwork = errors.New(\"invalid listener network\"","url":"/api-reference/package-root.html#var-ErrInvalidCertOrKeyType","tab":"API Reference","category":"go variable"},{"title":"var ErrInvalidListenerNetwork","content":"The following errors fall into 500 (InternalServerError) category\n\nvar (\n\tErrValidatorNotRegistered = errors.New(\"validator not registered\")\n\tErrRendererNotRegistered = errors.New(\"renderer not registered\")\n\tErrInvalidRedirectCode = errors.New(\"invalid redirect status code\")\n\tErrCookieNotFound = errors.New(\"cookie not found\")\n\tErrInvalidCertOrKeyType = errors.New(\"invalid cert or key type, must be string or []byte\")\n\tErrInvalidListenerNetwork = errors.New(\"invalid listener network\"","url":"/api-reference/package-root.html#var-ErrInvalidListenerNetwork","tab":"API Reference","category":"go variable"},{"title":"var ErrInvalidKeyType","content":"ErrInvalidKeyType is error that is returned when the value is not castable to expected type.\n\nvar ErrInvalidKeyType = errors.New(\"invalid key type\")","url":"/api-reference/package-root.html#var-ErrInvalidKeyType","tab":"API Reference","category":"go variable"},{"title":"var ErrNonExistentKey","content":"ErrNonExistentKey is error that is returned when key does not exist\n\nvar ErrNonExistentKey = errors.New(\"non existent key\")","url":"/api-reference/package-root.html#var-ErrNonExistentKey","tab":"API Reference","category":"go variable"},{"title":"func BindBody(c *Context, target any) (err error)","content":"BindBody binds request body contents to bindable object\nNB: then binding forms take note that this implementation uses standard library form parsing\nwhich parses form data from BOTH URL and BODY if content type is not MIMEMultipartForm\nSee non-MIMEMultipartForm: https://golang.org/pkg/net/http/#Request.ParseForm\nSee MIMEMultipartForm: https://golang.org/pkg/net/http/#Request.ParseMultipartForm\n\nfunc BindBody(c *Context, target any) (err error)","url":"/api-reference/package-root.html#func-BindBody","tab":"API Reference","category":"go function"},{"title":"func BindHeaders(c *Context, target any) error","content":"BindHeaders binds HTTP headers to a bindable object\n\nfunc BindHeaders(c *Context, target any) error","url":"/api-reference/package-root.html#func-BindHeaders","tab":"API Reference","category":"go function"},{"title":"func BindPathValues(c *Context, target any) error","content":"BindPathValues binds path parameter values to bindable object\n\nfunc BindPathValues(c *Context, target any) error","url":"/api-reference/package-root.html#func-BindPathValues","tab":"API Reference","category":"go function"},{"title":"func BindQueryParams(c *Context, target any) error","content":"BindQueryParams binds query params to bindable object\n\nfunc BindQueryParams(c *Context, target any) error","url":"/api-reference/package-root.html#func-BindQueryParams","tab":"API Reference","category":"go function"},{"title":"func ContextGet[T any](c *Context, key string) (T, error)","content":"ContextGet retrieves a value from the context store or ErrNonExistentKey error the key is missing.\nReturns ErrInvalidKeyType error if the value is not castable to type T.\n\nfunc ContextGet[T any](c *Context, key string) (T, error)","url":"/api-reference/package-root.html#func-ContextGet","tab":"API Reference","category":"go function"},{"title":"func ContextGetOr[T any](c *Context, key string, defaultValue T) (T, error)","content":"ContextGetOr retrieves a value from the context store or returns a default value when the key\nis missing. Returns ErrInvalidKeyType error if the value is not castable to type T.\n\nfunc ContextGetOr[T any](c *Context, key string, defaultValue T) (T, error)","url":"/api-reference/package-root.html#func-ContextGetOr","tab":"API Reference","category":"go function"},{"title":"func DefaultHTTPErrorHandler(exposeError bool) HTTPErrorHandler","content":"DefaultHTTPErrorHandler creates new default HTTP error handler implementation. It sends a JSON response\nwith status code. `exposeError` parameter decides if returned message will contain also error message or not\n\nNote: DefaultHTTPErrorHandler does not log errors. Use middleware for it if errors need to be logged (separately)\nNote: In case errors happens in middleware call-chain that is returning from handler (which did not return an error).\nWhen handler has already sent response (ala c.JSON()) ","url":"/api-reference/package-root.html#func-DefaultHTTPErrorHandler","tab":"API Reference","category":"go function"},{"title":"Example DefaultHTTPErrorHandler","content":"// SPDX-License-Identifier: MIT\n// SPDX-FileCopyrightText: © 2015 LabStack LLC and Echo contributors\n\n// run tests as external package to get real feel for API\npackage echo_test\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"github.com/labstack/echo/v5\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n)\n\nfunc ExampleDefaultHTTPErrorHandler() {\n\te := echo.New()\n\te.GET(\"/api/endpoint\", func(c *echo.Context) error {\n\t\treturn &apiError{\n\t\t\tCode: http.StatusBadRequest,\n\t\t\tBody: map[string]any{\"message\": \"custom error\"},\n\t\t}\n\t}","url":"/api-reference/package-root.html#func-DefaultHTTPErrorHandler","tab":"API Reference","category":"go example"},{"title":"func ExtractIPDirect() IPExtractor","content":"ExtractIPDirect extracts an IP address using an actual IP address.\nUse this if your server faces to internet directly (i.e.: uses no proxy).\n\nfunc ExtractIPDirect() IPExtractor","url":"/api-reference/package-root.html#func-ExtractIPDirect","tab":"API Reference","category":"go function"},{"title":"func ExtractIPFromRealIPHeader(options ...TrustOption) IPExtractor","content":"ExtractIPFromRealIPHeader extracts IP address using `x-real-ip` header.\nUse this if you put proxy which uses this header.\n\nfunc ExtractIPFromRealIPHeader(options ...TrustOption) IPExtractor","url":"/api-reference/package-root.html#func-ExtractIPFromRealIPHeader","tab":"API Reference","category":"go function"},{"title":"func ExtractIPFromXFFHeader(options ...TrustOption) IPExtractor","content":"ExtractIPFromXFFHeader extracts IP address using `x-forwarded-for` header.\nUse this if you put proxy which uses this header.\nThis returns nearest untrustable IP. If all IPs are trustable, returns furthest one (i.e.: XFF[0]).\n\nfunc ExtractIPFromXFFHeader(options ...TrustOption) IPExtractor","url":"/api-reference/package-root.html#func-ExtractIPFromXFFHeader","tab":"API Reference","category":"go function"},{"title":"func FormFieldBinder(c *Context) *ValueBinder","content":"FormFieldBinder creates form field value binder\nFor all requests, FormFieldBinder parses the raw query from the URL and uses query params as form fields\n\nFor POST, PUT, and PATCH requests, it also reads the request body, parses it\nas a form and uses query params as form fields. Request body parameters take precedence over URL query\nstring values in r.Form.\n\nNB: when binding forms take note that this implementation uses standard library form parsing\nwhich parses form data from BOTH URL and BODY i","url":"/api-reference/package-root.html#func-FormFieldBinder","tab":"API Reference","category":"go function"},{"title":"func FormValue[T any](c *Context, key string, opts ...any) (T, error)","content":"FormValue extracts and parses a single form value from the request by key.\nIt returns the typed value and an error if binding fails. Returns ErrNonExistentKey if parameter not found.\n\nEmpty String Handling:\n\n\tIf the form field exists but has an empty value, the zero value of type T is returned\n\twith no error. For example, an empty form field returns (0, nil) for int types.\n\tThis differs from standard library behavior where parsing empty strings returns errors.\n\tTo treat empty values as errors, v","url":"/api-reference/package-root.html#func-FormValue","tab":"API Reference","category":"go function"},{"title":"func FormValueOr[T any](c *Context, key string, defaultValue T, opts ...any) (T, error)","content":"FormValueOr extracts and parses a single form value from the request by key.\nReturns defaultValue if the parameter is not found or has an empty value.\nReturns an error only if parsing fails or form parsing errors occur.\n\nExample:\n\n\tlimit, err := echo.FormValueOr[int](c, \"limit\", 100)\n\t// If \"limit\" is missing: returns (100, nil)\n\t// If \"limit\" is \"50\": returns (50, nil)\n\t// If \"limit\" is \"abc\": returns (100, BindingError)\n\nSee ParseValue for supported types and options\n\nfunc FormValueOr[T any](c","url":"/api-reference/package-root.html#func-FormValueOr","tab":"API Reference","category":"go function"},{"title":"func FormValues[T any](c *Context, key string, opts ...any) ([]T, error)","content":"FormValues extracts and parses all values for a form values key as a slice.\nIt returns the typed slice and an error if binding any value fails. Returns ErrNonExistentKey if parameter not found.\n\nSee ParseValues for supported types and options\n\nfunc FormValues[T any](c *Context, key string, opts ...any) ([]T, error)","url":"/api-reference/package-root.html#func-FormValues","tab":"API Reference","category":"go function"},{"title":"func FormValuesOr[T any](c *Context, key string, defaultValue []T, opts ...any) ([]T, error)","content":"FormValuesOr extracts and parses all values for a form values key as a slice.\nReturns defaultValue if the parameter is not found.\nReturns an error only if parsing any value fails or form parsing errors occur.\n\nExample:\n\n\ttags, err := echo.FormValuesOr[string](c, \"tags\", []string{})\n\t// If \"tags\" is missing: returns ([], nil)\n\t// If form parsing fails: returns (nil, error)\n\nSee ParseValues for supported types and options\n\nfunc FormValuesOr[T any](c *Context, key string, defaultValue []T, opts ...","url":"/api-reference/package-root.html#func-FormValuesOr","tab":"API Reference","category":"go function"},{"title":"func HandlerName(h HandlerFunc) string","content":"HandlerName returns string name for given function.\n\nfunc HandlerName(h HandlerFunc) string","url":"/api-reference/package-root.html#func-HandlerName","tab":"API Reference","category":"go function"},{"title":"func LegacyIPExtractor() IPExtractor","content":"LegacyIPExtractor returns an IPExtractor that derives the client IP address\nfrom common proxy headers, falling back to the request's remote address.\n\nResolution order:\n 1. X-Forwarded-For: returns the first IP in the comma-separated list.\n If multiple values are present, only the left-most (original client)\n is used. Surrounding brackets (for IPv6) are stripped.\n 2. X-Real-IP: used if X-Forwarded-For is absent. Surrounding brackets\n (for IPv6) are stripped.\n 3. req.RemoteAddr: used as a","url":"/api-reference/package-root.html#func-LegacyIPExtractor","tab":"API Reference","category":"go function"},{"title":"func MustSubFS(currentFs fs.FS, fsRoot string) fs.FS","content":"MustSubFS creates sub FS from current filesystem or panic on failure.\nPanic happens when `fsRoot` contains invalid path according to `fs.ValidPath` rules.\n\nMustSubFS is helpful when dealing with `embed.FS` because for example `//go:embed assets/images` embeds files with\npaths including `assets/images` as their prefix. In that case use `fs := echo.MustSubFS(fs, \"rootDirectory\") to\ncreate sub fs which uses necessary prefix for directory path.\n\nfunc MustSubFS(currentFs fs.FS, fsRoot string) fs.FS","url":"/api-reference/package-root.html#func-MustSubFS","tab":"API Reference","category":"go function"},{"title":"func New() *Echo","content":"New creates an instance of Echo.\n\nfunc New() *Echo","url":"/api-reference/package-root.html#func-New","tab":"API Reference","category":"go function"},{"title":"func NewBindingError(sourceParam string, values []string, message string, err error) error","content":"NewBindingError creates new instance of binding error\n\nfunc NewBindingError(sourceParam string, values []string, message string, err error) error","url":"/api-reference/package-root.html#func-NewBindingError","tab":"API Reference","category":"go function"},{"title":"func NewConcurrentRouter(r Router) Router","content":"NewConcurrentRouter creates concurrency safe Router which routes can be added/removed safely\neven after http.Server has been started.\n\nfunc NewConcurrentRouter(r Router) Router","url":"/api-reference/package-root.html#func-NewConcurrentRouter","tab":"API Reference","category":"go function"},{"title":"func NewContext(r *http.Request, w http.ResponseWriter, opts ...any) *Context","content":"NewContext returns a new Context instance.\n\nNote: request,response and e can be left to nil as Echo.ServeHTTP will call c.Reset(req,resp) anyway\nthese arguments are useful when creating context for tests and cases like that.\n\nfunc NewContext(r *http.Request, w http.ResponseWriter, opts ...any) *Context","url":"/api-reference/package-root.html#func-NewContext","tab":"API Reference","category":"go function"},{"title":"func NewDefaultFS(dir string) fs.FS","content":"NewDefaultFS returns a new defaultFS instance which allows `fs.FS.Open` to have absolute paths as input if it matches\nthen given dir as prefix.\n\nfunc NewDefaultFS(dir string) fs.FS","url":"/api-reference/package-root.html#func-NewDefaultFS","tab":"API Reference","category":"go function"},{"title":"func NewHTTPError(code int, message string) *HTTPError","content":"NewHTTPError creates a new instance of HTTPError\n\nfunc NewHTTPError(code int, message string) *HTTPError","url":"/api-reference/package-root.html#func-NewHTTPError","tab":"API Reference","category":"go function"},{"title":"func NewResponse(w http.ResponseWriter, logger *slog.Logger) (r *Response)","content":"NewResponse creates a new instance of Response.\n\nfunc NewResponse(w http.ResponseWriter, logger *slog.Logger) (r *Response)","url":"/api-reference/package-root.html#func-NewResponse","tab":"API Reference","category":"go function"},{"title":"func NewRouter(config RouterConfig) *DefaultRouter","content":"NewRouter returns a new Router instance.\n\nfunc NewRouter(config RouterConfig) *DefaultRouter","url":"/api-reference/package-root.html#func-NewRouter","tab":"API Reference","category":"go function"},{"title":"func NewVirtualHostHandler(vhosts map[string]*Echo) *Echo","content":"NewVirtualHostHandler creates instance of Echo that routes requests to given virtual hosts\nwhen hosts in request does not exist in given map the request is served by returned Echo instance.\n\nfunc NewVirtualHostHandler(vhosts map[string]*Echo) *Echo","url":"/api-reference/package-root.html#func-NewVirtualHostHandler","tab":"API Reference","category":"go function"},{"title":"func NewWithConfig(config Config) *Echo","content":"NewWithConfig creates an instance of Echo with given configuration.\n\nfunc NewWithConfig(config Config) *Echo","url":"/api-reference/package-root.html#func-NewWithConfig","tab":"API Reference","category":"go function"},{"title":"func ParseValue[T any](value string, opts ...any) (T, error)","content":"ParseValue parses value to generic type\n\nTypes that are supported:\n - bool\n - float32\n - float64\n - int\n - int8\n - int16\n - int32\n - int64\n - uint\n - uint8/byte\n - uint16\n - uint32\n - uint64\n - string\n - echo.BindUnmarshaler interface\n - encoding.TextUnmarshaler interface\n - json.Unmarshaler interface\n - time.Duration\n - time.Time use echo.TimeOpts or echo.TimeLayout to set time parsing configuration\n\nfunc ParseValue[T any](value string, opts ...any) (T, error)","url":"/api-reference/package-root.html#func-ParseValue","tab":"API Reference","category":"go function"},{"title":"func ParseValueOr[T any](value string, defaultValue T, opts ...any) (T, error)","content":"ParseValueOr parses value to generic type, when value is empty defaultValue is returned.\n\nTypes that are supported:\n - bool\n - float32\n - float64\n - int\n - int8\n - int16\n - int32\n - int64\n - uint\n - uint8/byte\n - uint16\n - uint32\n - uint64\n - string\n - echo.BindUnmarshaler interface\n - encoding.TextUnmarshaler interface\n - json.Unmarshaler interface\n - time.Duration\n - time.Time use echo.TimeOpts or echo.TimeLayout to set time parsing configuration\n\nfunc ParseValueOr[T any](va","url":"/api-reference/package-root.html#func-ParseValueOr","tab":"API Reference","category":"go function"},{"title":"func ParseValues[T any](values []string, opts ...any) ([]T, error)","content":"ParseValues parses value to generic type slice. Same types are supported as ParseValue\nfunction but the result type is slice instead of scalar value.\n\nSee ParseValue for supported types and options\n\nfunc ParseValues[T any](values []string, opts ...any) ([]T, error)","url":"/api-reference/package-root.html#func-ParseValues","tab":"API Reference","category":"go function"},{"title":"func ParseValuesOr[T any](values []string, defaultValue []T, opts ...any) ([]T, error)","content":"ParseValuesOr parses value to generic type slice, when value is empty defaultValue is returned.\nSame types are supported as ParseValue function but the result type is slice instead of scalar value.\n\nSee ParseValue for supported types and options\n\nfunc ParseValuesOr[T any](values []string, defaultValue []T, opts ...any) ([]T, error)","url":"/api-reference/package-root.html#func-ParseValuesOr","tab":"API Reference","category":"go function"},{"title":"func PathParam[T any](c *Context, paramName string, opts ...any) (T, error)","content":"PathParam extracts and parses a path parameter from the context by name.\nIt returns the typed value and an error if binding fails. Returns ErrNonExistentKey if parameter not found.\n\nEmpty String Handling:\n\n\tIf the parameter exists but has an empty value, the zero value of type T is returned\n\twith no error. For example, a path parameter with value \"\" returns (0, nil) for int types.\n\tThis differs from standard library behavior where parsing empty strings returns errors.\n\tTo treat empty values as e","url":"/api-reference/package-root.html#func-PathParam","tab":"API Reference","category":"go function"},{"title":"func PathParamOr[T any](c *Context, paramName string, defaultValue T, opts ...any) (T, error)","content":"PathParamOr extracts and parses a path parameter from the context by name.\nReturns defaultValue if the parameter is not found or has an empty value.\nReturns an error only if parsing fails (e.g., \"abc\" for int type).\n\nExample:\n\n\tid, err := echo.PathParamOr[int](c, \"id\", 0)\n\t// If \"id\" is missing: returns (0, nil)\n\t// If \"id\" is \"123\": returns (123, nil)\n\t// If \"id\" is \"abc\": returns (0, BindingError)\n\nSee ParseValue for supported types and options\n\nfunc PathParamOr[T any](c *Context, paramName st","url":"/api-reference/package-root.html#func-PathParamOr","tab":"API Reference","category":"go function"},{"title":"func PathValuesBinder(c *Context) *ValueBinder","content":"PathValuesBinder creates path parameter value binder\n\nfunc PathValuesBinder(c *Context) *ValueBinder","url":"/api-reference/package-root.html#func-PathValuesBinder","tab":"API Reference","category":"go function"},{"title":"func QueryParam[T any](c *Context, key string, opts ...any) (T, error)","content":"QueryParam extracts and parses a single query parameter from the request by key.\nIt returns the typed value and an error if binding fails. Returns ErrNonExistentKey if parameter not found.\n\nEmpty String Handling:\n\n\tIf the parameter exists but has an empty value (?key=), the zero value of type T is returned\n\twith no error. For example, \"?count=\" returns (0, nil) for int types.\n\tThis differs from standard library behavior where parsing empty strings returns errors.\n\tTo treat empty values as errors","url":"/api-reference/package-root.html#func-QueryParam","tab":"API Reference","category":"go function"},{"title":"func QueryParamOr[T any](c *Context, key string, defaultValue T, opts ...any) (T, error)","content":"QueryParamOr extracts and parses a single query parameter from the request by key.\nReturns defaultValue if the parameter is not found or has an empty value.\nReturns an error only if parsing fails (e.g., \"abc\" for int type).\n\nExample:\n\n\tpage, err := echo.QueryParamOr[int](c, \"page\", 1)\n\t// If \"page\" is missing: returns (1, nil)\n\t// If \"page\" is \"5\": returns (5, nil)\n\t// If \"page\" is \"abc\": returns (1, BindingError)\n\nSee ParseValue for supported types and options\n\nfunc QueryParamOr[T any](c *Conte","url":"/api-reference/package-root.html#func-QueryParamOr","tab":"API Reference","category":"go function"},{"title":"func QueryParams[T any](c *Context, key string, opts ...any) ([]T, error)","content":"QueryParams extracts and parses all values for a query parameter key as a slice.\nIt returns the typed slice and an error if binding any value fails. Returns ErrNonExistentKey if parameter not found.\n\nSee ParseValues for supported types and options\n\nfunc QueryParams[T any](c *Context, key string, opts ...any) ([]T, error)","url":"/api-reference/package-root.html#func-QueryParams","tab":"API Reference","category":"go function"},{"title":"func QueryParamsBinder(c *Context) *ValueBinder","content":"QueryParamsBinder creates query parameter value binder\n\nfunc QueryParamsBinder(c *Context) *ValueBinder","url":"/api-reference/package-root.html#func-QueryParamsBinder","tab":"API Reference","category":"go function"},{"title":"func QueryParamsOr[T any](c *Context, key string, defaultValue []T, opts ...any) ([]T, error)","content":"QueryParamsOr extracts and parses all values for a query parameter key as a slice.\nReturns defaultValue if the parameter is not found.\nReturns an error only if parsing any value fails.\n\nExample:\n\n\tids, err := echo.QueryParamsOr[int](c, \"ids\", []int{})\n\t// If \"ids\" is missing: returns ([], nil)\n\t// If \"ids\" is \"1&ids=2\": returns ([1, 2], nil)\n\t// If \"ids\" contains \"abc\": returns ([], BindingError)\n\nSee ParseValues for supported types and options\n\nfunc QueryParamsOr[T any](c *Context, key string, ","url":"/api-reference/package-root.html#func-QueryParamsOr","tab":"API Reference","category":"go function"},{"title":"func ResolveResponseStatus(rw http.ResponseWriter, err error) (resp *Response, status int)","content":"ResolveResponseStatus returns the Response and HTTP status code that should be (or has been) sent for rw,\ngiven an optional error.\n\nThis function is useful for middleware and handlers that need to figure out the HTTP status\ncode to return based on the error that occurred or what was set in the response.\n\nPrecedence rules:\n 1. If the response has already been committed, the committed status wins (err is ignored).\n 2. Otherwise, start with 200 OK (net/http default if WriteHeader is never called).\n","url":"/api-reference/package-root.html#func-ResolveResponseStatus","tab":"API Reference","category":"go function"},{"title":"func StaticDirectoryHandler(fileSystem fs.FS, disablePathUnescaping bool) HandlerFunc","content":"StaticDirectoryHandler creates handler function to serve files from provided file system\nWhen disablePathUnescaping is set then file name from path is not unescaped and is served as is.\n\nNote: when disablePathUnescaping=false, the handler decodes the wildcard param before serving.\nIf route guards (e.g. e.GET(\"/admin/*\", forbidden)) are used to restrict parts of the\nfilesystem, an encoded separator (%2F) or encoded dot-dot (%2E%2E) in the URL can resolve to\na path that the router never matched ag","url":"/api-reference/package-root.html#func-StaticDirectoryHandler","tab":"API Reference","category":"go function"},{"title":"func StaticFileHandler(file string, filesystem fs.FS) HandlerFunc","content":"StaticFileHandler creates handler function to serve file from provided file system.\n\nAvoid using the leading `/` slash as most of the Go standard library fs.FS implementations require relative paths for\nfile operations.\n\nfunc StaticFileHandler(file string, filesystem fs.FS) HandlerFunc","url":"/api-reference/package-root.html#func-StaticFileHandler","tab":"API Reference","category":"go function"},{"title":"func StatusCode(err error) int","content":"StatusCode returns status code from err if it implements HTTPStatusCoder interface.\nIf err does not implement the interface, it returns 0.\n\nfunc StatusCode(err error) int","url":"/api-reference/package-root.html#func-StatusCode","tab":"API Reference","category":"go function"},{"title":"func TrustIPRange(ipRange *net.IPNet) TrustOption","content":"TrustIPRange add trustable IP ranges using CIDR notation.\n\nfunc TrustIPRange(ipRange *net.IPNet) TrustOption","url":"/api-reference/package-root.html#func-TrustIPRange","tab":"API Reference","category":"go function"},{"title":"func TrustLinkLocal(v bool) TrustOption","content":"TrustLinkLocal configures if you trust link-local address (default: true).\n\nfunc TrustLinkLocal(v bool) TrustOption","url":"/api-reference/package-root.html#func-TrustLinkLocal","tab":"API Reference","category":"go function"},{"title":"func TrustLoopback(v bool) TrustOption","content":"TrustLoopback configures if you trust loopback address (default: true).\n\nfunc TrustLoopback(v bool) TrustOption","url":"/api-reference/package-root.html#func-TrustLoopback","tab":"API Reference","category":"go function"},{"title":"func TrustPrivateNet(v bool) TrustOption","content":"TrustPrivateNet configures if you trust private network address (default: true).\n\nfunc TrustPrivateNet(v bool) TrustOption","url":"/api-reference/package-root.html#func-TrustPrivateNet","tab":"API Reference","category":"go function"},{"title":"func UnwrapResponse(rw http.ResponseWriter) (*Response, error)","content":"UnwrapResponse unwraps given ResponseWriter to return contexts original Echo Response. rw has to implement\nfollowing method `Unwrap() http.ResponseWriter`\n\nfunc UnwrapResponse(rw http.ResponseWriter) (*Response, error)","url":"/api-reference/package-root.html#func-UnwrapResponse","tab":"API Reference","category":"go function"},{"title":"func WrapHandler(h http.Handler) HandlerFunc","content":"WrapHandler wraps `http.Handler` into `echo.HandlerFunc`.\n\nfunc WrapHandler(h http.Handler) HandlerFunc","url":"/api-reference/package-root.html#func-WrapHandler","tab":"API Reference","category":"go function"},{"title":"func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc","content":"WrapMiddleware wraps `func(http.Handler) http.Handler` into `echo.MiddlewareFunc`\n\nfunc WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc","url":"/api-reference/package-root.html#func-WrapMiddleware","tab":"API Reference","category":"go function"},{"title":"type AddRouteError","content":"AddRouteError is error returned by Router.Add containing information what actual route adding failed. Useful for\nmass adding (i.e. Any() routes)\n\ntype AddRouteError struct {\n\tErr error\n\tMethod string\n\tPath string\n}","url":"/api-reference/package-root.html#type-AddRouteError","tab":"API Reference","category":"go type"},{"title":"AddRouteError.Error","content":"func Error) Error() string","url":"/api-reference/package-root.html#method-AddRouteError-Error","tab":"API Reference","category":"go method"},{"title":"AddRouteError.Unwrap","content":"func Unwrap() error","url":"/api-reference/package-root.html#method-AddRouteError-Unwrap","tab":"API Reference","category":"go method"},{"title":"type BindUnmarshaler","content":"BindUnmarshaler is the interface used to wrap the UnmarshalParam method.\nTypes that don't implement this, but do implement encoding.TextUnmarshaler\nwill use that interface instead.\n\ntype BindUnmarshaler interface {\n\t// UnmarshalParam decodes and assigns a value from an form or query param.\n\tUnmarshalParam(param string) error\n}","url":"/api-reference/package-root.html#type-BindUnmarshaler","tab":"API Reference","category":"go type"},{"title":"type Binder","content":"Binder is the interface that wraps the Bind method.\n\ntype Binder interface {\n\tBind(c *Context, target any) error\n}","url":"/api-reference/package-root.html#type-Binder","tab":"API Reference","category":"go type"},{"title":"type BindingError","content":"BindingError represents an error that occurred while binding request data.\n\nNote: JSON serialization is handled by the MarshalJSON method below, not by the\nstruct tags (which are kept for documentation). MarshalJSON emits {\"field\",\"message\"}.\n\ntype BindingError struct {\n\t// Field is the field name where value binding failed\n\tField string `json:\"field\"`\n\t*HTTPError\n\t// Values of parameter that failed to bind.\n\tValues []string `json:\"-\"`\n}","url":"/api-reference/package-root.html#type-BindingError","tab":"API Reference","category":"go type"},{"title":"BindingError.Error","content":"Error returns error message\n\nfunc Error) Error() string","url":"/api-reference/package-root.html#method-BindingError-Error","tab":"API Reference","category":"go method"},{"title":"BindingError.MarshalJSON","content":"MarshalJSON implements json.Marshaler so that binding errors are serialized into\na structured response (e.g. {\"field\":\"id\",\"message\":\"...\"}) rather than being\nflattened to a generic message. DefaultHTTPErrorHandler routes errors that\nimplement json.Marshaler through their own encoding.\n\nfunc MarshalJSON() ([]byte, error)","url":"/api-reference/package-root.html#method-BindingError-MarshalJSON","tab":"API Reference","category":"go method"},{"title":"type Config","content":"Config is configuration for NewWithConfig function\n\ntype Config struct {\n\t// Logger is the slog logger instance used for application-wide structured logging.\n\t// If not set, a default TextHandler writing to stdout is created.\n\tLogger *slog.Logger\n\n\t// HTTPErrorHandler is the centralized error handler that processes errors returned\n\t// by handlers and middleware, converting them to appropriate HTTP responses.\n\t// If not set, DefaultHTTPErrorHandler(false) is used.\n\tHTTPErrorHandler HTTPErrorHandl","url":"/api-reference/package-root.html#type-Config","tab":"API Reference","category":"go type"},{"title":"type Context","content":"Context represents the context of the current HTTP request. It holds request and\nresponse objects, path, path parameters, data and registered handler.\n\ntype Context struct {\n\t// contains filtered or unexported fields\n}","url":"/api-reference/package-root.html#type-Context","tab":"API Reference","category":"go type"},{"title":"Context.Attachment","content":"Attachment sends a response as attachment, prompting client to save the file.\n\nAvoid using the leading `/` slash as most of the Go standard library fs.FS implementations require relative paths for\nfile operations.\n\nfunc Attachment(file, name string) error","url":"/api-reference/package-root.html#method-Context-Attachment","tab":"API Reference","category":"go method"},{"title":"Context.Bind","content":"Bind binds path params, query params and the request body into provided type `i`. The default binder\nbinds body based on Content-Type header.\n\nfunc Bind(i any) error","url":"/api-reference/package-root.html#method-Context-Bind","tab":"API Reference","category":"go method"},{"title":"Context.Blob","content":"Blob sends a blob response with status code and content type.\n\nfunc Blob(code int, contentType string, b []byte) (err error)","url":"/api-reference/package-root.html#method-Context-Blob","tab":"API Reference","category":"go method"},{"title":"Context.Cookie","content":"Cookie returns the named cookie provided in the request.\n\nfunc Cookie(name string) (*http.Cookie, error)","url":"/api-reference/package-root.html#method-Context-Cookie","tab":"API Reference","category":"go method"},{"title":"Context.Cookies","content":"Cookies returns the HTTP cookies sent with the request.\n\nfunc Cookies() []*http.Cookie","url":"/api-reference/package-root.html#method-Context-Cookies","tab":"API Reference","category":"go method"},{"title":"Context.Echo","content":"Echo returns the `Echo` instance.\n\nfunc Echo() *Echo","url":"/api-reference/package-root.html#method-Context-Echo","tab":"API Reference","category":"go method"},{"title":"Context.File","content":"File sends a response with the content of the file.\n\nAvoid using the leading `/` slash as most of the Go standard library fs.FS implementations require relative paths for\nfile operations.\n\nfunc File(file string) error","url":"/api-reference/package-root.html#method-Context-File","tab":"API Reference","category":"go method"},{"title":"Context.FileFS","content":"FileFS serves file from given file system.\n\nWhen dealing with `embed.FS` use `fs := echo.MustSubFS(fs, \"rootDirectory\") to create sub fs which uses necessary\nprefix for directory path. This is necessary as `//go:embed assets/images` embeds files with paths\nincluding `assets/images` as their prefix.\n\nfunc FileFS(file string, filesystem fs.FS) error","url":"/api-reference/package-root.html#method-Context-FileFS","tab":"API Reference","category":"go method"},{"title":"Context.FormFile","content":"FormFile returns the multipart form file for the provided name.\n\nfunc FormFile(name string) (*multipart.FileHeader, error)","url":"/api-reference/package-root.html#method-Context-FormFile","tab":"API Reference","category":"go method"},{"title":"Context.FormValue","content":"FormValue returns the form field value for the provided name.\n\nfunc FormValue(name string) string","url":"/api-reference/package-root.html#method-Context-FormValue","tab":"API Reference","category":"go method"},{"title":"Context.FormValueOr","content":"FormValueOr returns the form field value or default value for the provided name.\nNote: FormValueOr does not distinguish if form had no value by that name or value was empty string\n\nfunc FormValueOr(name, defaultValue string) string","url":"/api-reference/package-root.html#method-Context-FormValueOr","tab":"API Reference","category":"go method"},{"title":"Context.FormValues","content":"FormValues returns the form field values as `url.Values`.\n\nfunc FormValues() (url.Values, error)","url":"/api-reference/package-root.html#method-Context-FormValues","tab":"API Reference","category":"go method"},{"title":"Context.Get","content":"Get retrieves data from the context.\nMethod returns any(nil) when key does not exist which is different from typed nil (eg. []byte(nil)).\n\nfunc Get(key string) any","url":"/api-reference/package-root.html#method-Context-Get","tab":"API Reference","category":"go method"},{"title":"Context.HTML","content":"HTML sends an HTTP response with status code.\n\nfunc HTML(code int, html string) (err error)","url":"/api-reference/package-root.html#method-Context-HTML","tab":"API Reference","category":"go method"},{"title":"Context.HTMLBlob","content":"HTMLBlob sends an HTTP blob response with status code.\n\nfunc HTMLBlob(code int, b []byte) (err error)","url":"/api-reference/package-root.html#method-Context-HTMLBlob","tab":"API Reference","category":"go method"},{"title":"Context.InitializeRoute","content":"InitializeRoute sets the route related variables of this request to the context.\n\nfunc InitializeRoute(ri *RouteInfo, pathValues *PathValues)","url":"/api-reference/package-root.html#method-Context-InitializeRoute","tab":"API Reference","category":"go method"},{"title":"Context.Inline","content":"Inline sends a response as inline, opening the file in the browser.\n\nAvoid using the leading `/` slash as most of the Go standard library fs.FS implementations require relative paths for\nfile operations.\n\nfunc Inline(file, name string) error","url":"/api-reference/package-root.html#method-Context-Inline","tab":"API Reference","category":"go method"},{"title":"Context.IsTLS","content":"IsTLS returns true if HTTP connection is TLS otherwise false.\n\nfunc IsTLS() bool","url":"/api-reference/package-root.html#method-Context-IsTLS","tab":"API Reference","category":"go method"},{"title":"Context.IsWebSocket","content":"IsWebSocket returns true if HTTP connection is WebSocket otherwise false.\n\nfunc IsWebSocket() bool","url":"/api-reference/package-root.html#method-Context-IsWebSocket","tab":"API Reference","category":"go method"},{"title":"Context.JSON","content":"JSON sends a JSON response with status code.\n\nfunc JSON(code int, i any) (err error)","url":"/api-reference/package-root.html#method-Context-JSON","tab":"API Reference","category":"go method"},{"title":"Context.JSONBlob","content":"JSONBlob sends a JSON blob response with status code.\n\nfunc JSONBlob(code int, b []byte) (err error)","url":"/api-reference/package-root.html#method-Context-JSONBlob","tab":"API Reference","category":"go method"},{"title":"Context.JSONP","content":"JSONP sends a JSONP response with status code. It uses `callback` to construct\nthe JSONP payload.\n\nfunc JSONP(code int, callback string, i any) (err error)","url":"/api-reference/package-root.html#method-Context-JSONP","tab":"API Reference","category":"go method"},{"title":"Context.JSONPBlob","content":"JSONPBlob sends a JSONP blob response with status code. It uses `callback`\nto construct the JSONP payload.\n\nfunc JSONPBlob(code int, callback string, b []byte) (err error)","url":"/api-reference/package-root.html#method-Context-JSONPBlob","tab":"API Reference","category":"go method"},{"title":"Context.JSONPretty","content":"JSONPretty sends a pretty-print JSON with status code.\n\nfunc JSONPretty(code int, i any, indent string) (err error)","url":"/api-reference/package-root.html#method-Context-JSONPretty","tab":"API Reference","category":"go method"},{"title":"Context.Logger","content":"Logger returns logger in Context\n\nfunc Logger() *slog.Logger","url":"/api-reference/package-root.html#method-Context-Logger","tab":"API Reference","category":"go method"},{"title":"Context.MultipartForm","content":"MultipartForm returns the multipart form.\n\nfunc MultipartForm() (*multipart.Form, error)","url":"/api-reference/package-root.html#method-Context-MultipartForm","tab":"API Reference","category":"go method"},{"title":"Context.NoContent","content":"NoContent sends a response with no body and a status code.\n\nfunc NoContent(code int) error","url":"/api-reference/package-root.html#method-Context-NoContent","tab":"API Reference","category":"go method"},{"title":"Context.Param","content":"Param returns path parameter by name.\n\nfunc Param(name string) string","url":"/api-reference/package-root.html#method-Context-Param","tab":"API Reference","category":"go method"},{"title":"Context.ParamOr","content":"ParamOr returns the path parameter or default value for the provided name.\n\nNotes for DefaultRouter implementation:\nPath parameter could be empty for cases like that:\n* route `/release-:version/bin` and request URL is `/release-/bin`\n* route `/api/:version/image.jpg` and request URL is `/api//image.jpg`\nbut not when path parameter is last part of route path\n* route `/download/file.:ext` will not match request `/download/file.`\n\nfunc ParamOr(name, defaultValue string) string","url":"/api-reference/package-root.html#method-Context-ParamOr","tab":"API Reference","category":"go method"},{"title":"Context.Path","content":"Path returns the registered path for the handler.\n\nfunc Path() string","url":"/api-reference/package-root.html#method-Context-Path","tab":"API Reference","category":"go method"},{"title":"Context.PathValues","content":"PathValues returns path parameter values.\n\nfunc PathValues() PathValues","url":"/api-reference/package-root.html#method-Context-PathValues","tab":"API Reference","category":"go method"},{"title":"Context.QueryParam","content":"QueryParam returns the query param for the provided name.\n\nfunc QueryParam(name string) string","url":"/api-reference/package-root.html#method-Context-QueryParam","tab":"API Reference","category":"go method"},{"title":"Context.QueryParamOr","content":"QueryParamOr returns the query param or default value for the provided name.\nNote: QueryParamOr does not distinguish if query had no value by that name or value was empty string\nThis means URLs `/test?search=` and `/test` would both return `1` for `c.QueryParamOr(\"search\", \"1\")`\n\nfunc QueryParamOr(name, defaultValue string) string","url":"/api-reference/package-root.html#method-Context-QueryParamOr","tab":"API Reference","category":"go method"},{"title":"Context.QueryParams","content":"QueryParams returns the query parameters as `url.Values`.\n\nfunc QueryParams() url.Values","url":"/api-reference/package-root.html#method-Context-QueryParams","tab":"API Reference","category":"go method"},{"title":"Context.QueryString","content":"QueryString returns the URL query string.\n\nfunc QueryString() string","url":"/api-reference/package-root.html#method-Context-QueryString","tab":"API Reference","category":"go method"},{"title":"Context.RealIP","content":"RealIP returns the client IP address using the configured extraction strategy.\n\nIf Echo#IPExtractor is set, it is used to resolve the client IP from the incoming request (typically via proxy\nheaders such as X-Forwarded-For or X-Real-IP).\nLook into the `ip.go` file for comments and examples.\n\nSee:\n - Echo#ExtractIPFromXFFHeader for `X-Forwarded-For` handling with trust checks\n - Echo#ExtractIPFromRealIPHeader for `X-Real-IP` handling with trust checks\n - Echo#LegacyIPExtractor for `v4` compati","url":"/api-reference/package-root.html#method-Context-RealIP","tab":"API Reference","category":"go method"},{"title":"Context.Redirect","content":"Redirect redirects the request to a provided URL with status code.\n\nfunc Redirect(code int, url string) error","url":"/api-reference/package-root.html#method-Context-Redirect","tab":"API Reference","category":"go method"},{"title":"Context.Render","content":"Render renders a template with data and sends a text/html response with status\ncode. Renderer must be registered using `Echo.Renderer`.\n\nfunc Render(code int, name string, data any) (err error)","url":"/api-reference/package-root.html#method-Context-Render","tab":"API Reference","category":"go method"},{"title":"Context.Request","content":"Request returns `*http.Request`.\n\nfunc Request() *http.Request","url":"/api-reference/package-root.html#method-Context-Request","tab":"API Reference","category":"go method"},{"title":"Context.Reset","content":"Reset resets the context after request completes. It must be called along\nwith `Echo#AcquireContext()` and `Echo#ReleaseContext()`.\nSee `Echo#ServeHTTP()`\n\nfunc Reset(r *http.Request, w http.ResponseWriter)","url":"/api-reference/package-root.html#method-Context-Reset","tab":"API Reference","category":"go method"},{"title":"Context.Response","content":"Response returns `*Response`.\n\nfunc Response() http.ResponseWriter","url":"/api-reference/package-root.html#method-Context-Response","tab":"API Reference","category":"go method"},{"title":"Context.RouteInfo","content":"RouteInfo returns current request route information. Method, Path, Name and params if they exist for matched route.\n\nRouteInfo returns generic \"empty\" struct for these cases:\n* Context is accessed before Routing is done. For example inside Pre middlewares (`e.Pre()`)\n* Router did not find matching route - 404 (route not found)\n* Router did not find matching route with same method - 405 (method not allowed)\n\nfunc RouteInfo() RouteInfo","url":"/api-reference/package-root.html#method-Context-RouteInfo","tab":"API Reference","category":"go method"},{"title":"Context.Scheme","content":"Scheme returns the HTTP protocol scheme, `http` or `https`.\n\nfunc Scheme() string","url":"/api-reference/package-root.html#method-Context-Scheme","tab":"API Reference","category":"go method"},{"title":"Context.Set","content":"Set saves data in the context.\n\nfunc Set(key string, val any)","url":"/api-reference/package-root.html#method-Context-Set","tab":"API Reference","category":"go method"},{"title":"Context.SetCookie","content":"SetCookie adds a `Set-Cookie` header in HTTP response.\n\nfunc SetCookie(cookie *http.Cookie)","url":"/api-reference/package-root.html#method-Context-SetCookie","tab":"API Reference","category":"go method"},{"title":"Context.SetLogger","content":"SetLogger sets logger in Context\n\nfunc SetLogger(logger *slog.Logger)","url":"/api-reference/package-root.html#method-Context-SetLogger","tab":"API Reference","category":"go method"},{"title":"Context.SetPath","content":"SetPath sets the registered path for the handler.\n\nfunc SetPath(p string)","url":"/api-reference/package-root.html#method-Context-SetPath","tab":"API Reference","category":"go method"},{"title":"Context.SetPathValues","content":"SetPathValues sets path parameters for current request.\n\nfunc SetPathValues(pathValues PathValues)","url":"/api-reference/package-root.html#method-Context-SetPathValues","tab":"API Reference","category":"go method"},{"title":"Context.SetRequest","content":"SetRequest sets `*http.Request`.\n\nfunc SetRequest(r *http.Request)","url":"/api-reference/package-root.html#method-Context-SetRequest","tab":"API Reference","category":"go method"},{"title":"Context.SetResponse","content":"SetResponse sets `*http.ResponseWriter`. Some context methods and/or middleware require that given ResponseWriter implements following\nmethod `Unwrap() http.ResponseWriter` which eventually should return *echo.Response instance.\n\nfunc SetResponse(r http.ResponseWriter)","url":"/api-reference/package-root.html#method-Context-SetResponse","tab":"API Reference","category":"go method"},{"title":"Context.Stream","content":"Stream sends a streaming response with status code and content type.\n\nfunc Stream(code int, contentType string, r io.Reader) (err error)","url":"/api-reference/package-root.html#method-Context-Stream","tab":"API Reference","category":"go method"},{"title":"Context.String","content":"String sends a string response with status code.\n\nfunc String(code int, s string) (err error)","url":"/api-reference/package-root.html#method-Context-String","tab":"API Reference","category":"go method"},{"title":"Context.Validate","content":"Validate validates provided `i`. It is usually called after `Context#Bind()`.\nValidator must be registered using `Echo#Validator`.\n\nfunc Validate(i any) error","url":"/api-reference/package-root.html#method-Context-Validate","tab":"API Reference","category":"go method"},{"title":"Context.XML","content":"XML sends an XML response with status code.\n\nfunc XML(code int, i any) (err error)","url":"/api-reference/package-root.html#method-Context-XML","tab":"API Reference","category":"go method"},{"title":"Context.XMLBlob","content":"XMLBlob sends an XML blob response with status code.\n\nfunc XMLBlob(code int, b []byte) (err error)","url":"/api-reference/package-root.html#method-Context-XMLBlob","tab":"API Reference","category":"go method"},{"title":"Context.XMLPretty","content":"XMLPretty sends a pretty-print XML with status code.\n\nfunc XMLPretty(code int, i any, indent string) (err error)","url":"/api-reference/package-root.html#method-Context-XMLPretty","tab":"API Reference","category":"go method"},{"title":"type DefaultBinder","content":"DefaultBinder is the default implementation of the Binder interface.\n\ntype DefaultBinder struct{}","url":"/api-reference/package-root.html#type-DefaultBinder","tab":"API Reference","category":"go type"},{"title":"DefaultBinder.Bind","content":"Bind implements the `Binder#Bind` function.\nBinding is done in following order: 1) path params; 2) query params; 3) request body. Each step COULD override previous\nstep bound values. For single source binding use their own methods BindBody, BindQueryParams, BindPathValues.\n\nfunc Binder) Bind(c *Context, target any) error","url":"/api-reference/package-root.html#method-DefaultBinder-Bind","tab":"API Reference","category":"go method"},{"title":"type DefaultJSONSerializer","content":"DefaultJSONSerializer implements JSON encoding using encoding/json.\n\ntype DefaultJSONSerializer struct{}","url":"/api-reference/package-root.html#type-DefaultJSONSerializer","tab":"API Reference","category":"go type"},{"title":"DefaultJSONSerializer.Deserialize","content":"Deserialize reads a JSON from a request body and converts it into an interface.\n\nThe body is read into a pooled buffer and decoded with json.Unmarshal rather\nthan streaming through json.NewDecoder. This avoids allocating a decoder and\nits internal read buffer on every request. json.Unmarshal does not retain a\nreference to the input slice, so the buffer is safe to reuse afterwards.\n\nNote: the full request body is read into memory before decoding. As with any\nJSON parser, decoding untrusted input ","url":"/api-reference/package-root.html#method-DefaultJSONSerializer-Deserialize","tab":"API Reference","category":"go method"},{"title":"DefaultJSONSerializer.Serialize","content":"Serialize converts an interface into a json and writes it to the response.\nYou can optionally use the indent parameter to produce pretty JSONs.\n\nfunc Serializer) Serialize(c *Context, target any, indent string) error","url":"/api-reference/package-root.html#method-DefaultJSONSerializer-Serialize","tab":"API Reference","category":"go method"},{"title":"type DefaultRouter","content":"DefaultRouter is the registry of all registered routes for an `Echo` instance for\nrequest matching and URL path parameter parsing.\nNote: DefaultRouter is not coroutine-safe. Do not Add/Remove routes after HTTP server has been started with Echo.\n\ntype DefaultRouter struct {\n\t// contains filtered or unexported fields\n}","url":"/api-reference/package-root.html#type-DefaultRouter","tab":"API Reference","category":"go type"},{"title":"DefaultRouter.Add","content":"Add registers a new route for method and path with matching handler.\n\nfunc Add(route Route) (RouteInfo, error)","url":"/api-reference/package-root.html#method-DefaultRouter-Add","tab":"API Reference","category":"go method"},{"title":"DefaultRouter.Remove","content":"Remove unregisters registered route\n\nfunc Remove(method string, path string) error","url":"/api-reference/package-root.html#method-DefaultRouter-Remove","tab":"API Reference","category":"go method"},{"title":"DefaultRouter.Route","content":"Route looks up a handler registered for method and path. It also parses URL for path parameters and loads them\ninto context.\n\nFor performance:\n\n- Get context from `Echo#AcquireContext()`\n- Reset it `Context#Reset()`\n- Return it `Echo#ReleaseContext()`.\n\nfunc Router) Route(c *Context) HandlerFunc","url":"/api-reference/package-root.html#method-DefaultRouter-Route","tab":"API Reference","category":"go method"},{"title":"DefaultRouter.Routes","content":"Routes returns all registered routes\n\nfunc Routes() Routes","url":"/api-reference/package-root.html#method-DefaultRouter-Routes","tab":"API Reference","category":"go method"},{"title":"type Echo","content":"Echo is the top-level framework instance.\n\nGoroutine safety: Do not mutate Echo instance fields after server has started. Accessing these\nfields from handlers/middlewares and changing field values at the same time leads to data-races.\nSame rule applies to adding new routes after server has been started - Adding a route is not Goroutine safe action.\n\ntype Echo struct {\n\tBinder Binder\n\n\t// Filesystem is the file system used for serving static files. Defaults to the current working directory (os.Ge","url":"/api-reference/package-root.html#type-Echo","tab":"API Reference","category":"go type"},{"title":"Echo.AcquireContext","content":"AcquireContext returns an empty `Context` instance from the pool.\nYou must return the context by calling `ReleaseContext()`.\n\nfunc AcquireContext() *Context","url":"/api-reference/package-root.html#method-Echo-AcquireContext","tab":"API Reference","category":"go method"},{"title":"Echo.Add","content":"Add registers a new route for an HTTP method and path with matching handler\nin the router with optional route-level middleware.\n\nfunc Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-Add","tab":"API Reference","category":"go method"},{"title":"Echo.AddRoute","content":"AddRoute registers a new Route with default host Router\n\nfunc AddRoute(route Route) (RouteInfo, error)","url":"/api-reference/package-root.html#method-Echo-AddRoute","tab":"API Reference","category":"go method"},{"title":"Echo.Any","content":"Any registers a new route for all HTTP methods (supported by Echo) and path with matching handler\nin the router with optional route-level middleware.\n\nNote: this method only adds specific set of supported HTTP methods as handler and is not true\n\"catch-any-arbitrary-method\" way of matching requests.\n\nfunc Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-Any","tab":"API Reference","category":"go method"},{"title":"Echo.CONNECT","content":"CONNECT registers a new CONNECT route for a path with matching handler in the\nrouter with optional route-level middleware. Panics on error.\n\nfunc CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-CONNECT","tab":"API Reference","category":"go method"},{"title":"Echo.DELETE","content":"DELETE registers a new DELETE route for a path with matching handler in the router\nwith optional route-level middleware. Panics on error.\n\nfunc DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-DELETE","tab":"API Reference","category":"go method"},{"title":"Echo.File","content":"File registers a new route with path to serve a static file with optional route-level middleware. Panics on error.\n\nAvoid using the leading `/` slash as most of the Go standard library fs.FS implementations require relative paths for\nfile operations.\n\nfunc File(path, file string, middleware ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-File","tab":"API Reference","category":"go method"},{"title":"Echo.FileFS","content":"FileFS registers a new route with path to serve file from the provided file system.\n\nAvoid using the leading `/` slash as most of the Go standard library fs.FS implementations require relative paths for\nfile operations.\n\nfunc FileFS(path, file string, filesystem fs.FS, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-FileFS","tab":"API Reference","category":"go method"},{"title":"Echo.GET","content":"GET registers a new GET route for a path with matching handler in the router\nwith optional route-level middleware. Panics on error.\n\nfunc GET(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-GET","tab":"API Reference","category":"go method"},{"title":"Echo.Group","content":"Group creates a new router group with prefix and optional group-level middleware.\n\nfunc Group(prefix string, m ...MiddlewareFunc) (g *Group)","url":"/api-reference/package-root.html#method-Echo-Group","tab":"API Reference","category":"go method"},{"title":"Echo.HEAD","content":"HEAD registers a new HEAD route for a path with matching handler in the\nrouter with optional route-level middleware. Panics on error.\n\nfunc HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-HEAD","tab":"API Reference","category":"go method"},{"title":"Echo.Match","content":"Match registers a new route for multiple HTTP methods and path with matching\nhandler in the router with optional route-level middleware. Panics on error.\n\nfunc Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) Routes","url":"/api-reference/package-root.html#method-Echo-Match","tab":"API Reference","category":"go method"},{"title":"Echo.Middlewares","content":"Middlewares returns registered route level middlewares. Does not contain any group level\nmiddlewares. Use this method to build your own ServeHTTP method.\n\nNOTE: returned slice is not a copy. Do not mutate.\n\nfunc Middlewares() []MiddlewareFunc","url":"/api-reference/package-root.html#method-Echo-Middlewares","tab":"API Reference","category":"go method"},{"title":"Echo.NewContext","content":"NewContext returns a new Context instance.\n\nNote: both request and response can be left to nil as Echo.ServeHTTP will call c.Reset(req,resp) anyway\nthese arguments are useful when creating context for tests and cases like that.\n\nfunc NewContext(r *http.Request, w http.ResponseWriter) *Context","url":"/api-reference/package-root.html#method-Echo-NewContext","tab":"API Reference","category":"go method"},{"title":"Echo.OPTIONS","content":"OPTIONS registers a new OPTIONS route for a path with matching handler in the\nrouter with optional route-level middleware. Panics on error.\n\nfunc OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-OPTIONS","tab":"API Reference","category":"go method"},{"title":"Echo.PATCH","content":"PATCH registers a new PATCH route for a path with matching handler in the\nrouter with optional route-level middleware. Panics on error.\n\nfunc PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-PATCH","tab":"API Reference","category":"go method"},{"title":"Echo.POST","content":"POST registers a new POST route for a path with matching handler in the\nrouter with optional route-level middleware. Panics on error.\n\nfunc POST(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-POST","tab":"API Reference","category":"go method"},{"title":"Echo.PUT","content":"PUT registers a new PUT route for a path with matching handler in the\nrouter with optional route-level middleware. Panics on error.\n\nfunc PUT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-PUT","tab":"API Reference","category":"go method"},{"title":"Echo.Pre","content":"Pre adds middleware to the chain which is run before router tries to find matching route.\nMeaning middleware is executed even for 404 (not found) cases.\n\nfunc Pre(middleware ...MiddlewareFunc)","url":"/api-reference/package-root.html#method-Echo-Pre","tab":"API Reference","category":"go method"},{"title":"Echo.PreMiddlewares","content":"PreMiddlewares returns registered pre middlewares. These are middleware to the chain\nwhich are run before router tries to find matching route.\nUse this method to build your own ServeHTTP method.\n\nNOTE: returned slice is not a copy. Do not mutate.\n\nfunc PreMiddlewares() []MiddlewareFunc","url":"/api-reference/package-root.html#method-Echo-PreMiddlewares","tab":"API Reference","category":"go method"},{"title":"Echo.QUERY","content":"QUERY registers a new QUERY route for a path with matching handler in the\nrouter with optional route-level middleware. Panics on error.\n\nfunc QUERY(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-QUERY","tab":"API Reference","category":"go method"},{"title":"Echo.ReleaseContext","content":"ReleaseContext returns the `Context` instance back to the pool.\nYou must call it after `AcquireContext()`.\n\nfunc ReleaseContext(c *Context)","url":"/api-reference/package-root.html#method-Echo-ReleaseContext","tab":"API Reference","category":"go method"},{"title":"Echo.RouteNotFound","content":"RouteNotFound registers a special-case route which is executed when no other route is found (i.e. HTTP 404 cases)\nfor current request URL.\nPath supports static and named/any parameters just like other http method is defined. Generally path is ended with\nwildcard/match-any character (`/*`, `/download/*` etc).\n\nExample: `e.RouteNotFound(\"/*\", func(c *echo.Context) error { return c.NoContent(http.StatusNotFound) })`\n\nfunc RouteNotFound(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-RouteNotFound","tab":"API Reference","category":"go method"},{"title":"Echo.Router","content":"Router returns the default router.\n\nfunc Router() Router","url":"/api-reference/package-root.html#method-Echo-Router","tab":"API Reference","category":"go method"},{"title":"Echo.ServeHTTP","content":"ServeHTTP implements `http.Handler` interface, which serves HTTP requests.\n\nfunc ServeHTTP(w http.ResponseWriter, r *http.Request)","url":"/api-reference/package-root.html#method-Echo-ServeHTTP","tab":"API Reference","category":"go method"},{"title":"Echo.Start","content":"Start stars HTTP server on given address with Echo as a handler serving requests. The server can be shutdown by\nsending os.Interrupt signal with `ctrl+c`. Method returns only errors that are not http.ErrServerClosed.\n\nNote: this method is created for use in examples/demos and is deliberately simple without providing configuration\noptions.\n\nIn need of customization use:\n\n\tctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)\n\tdefer cancel()\n\tsc := echo.StartConf","url":"/api-reference/package-root.html#method-Echo-Start","tab":"API Reference","category":"go method"},{"title":"Echo.Static","content":"Static registers a new route with path prefix to serve static files from the provided root directory.\n\nfunc Static(pathPrefix, fsRoot string, middleware ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-Static","tab":"API Reference","category":"go method"},{"title":"Echo.StaticFS","content":"StaticFS registers a new route with path prefix to serve static files from the provided file system.\n\nWhen dealing with `embed.FS` use `fs := echo.MustSubFS(fs, \"rootDirectory\") to create sub fs which uses necessary\nprefix for directory path. This is necessary as `//go:embed assets/images` embeds files with paths\nincluding `assets/images` as their prefix.\n\nfunc StaticFS(pathPrefix string, filesystem fs.FS, middleware ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-StaticFS","tab":"API Reference","category":"go method"},{"title":"Echo.TRACE","content":"TRACE registers a new TRACE route for a path with matching handler in the\nrouter with optional route-level middleware. Panics on error.\n\nfunc TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Echo-TRACE","tab":"API Reference","category":"go method"},{"title":"Echo.Use","content":"Use adds middleware to the chain which is run after router has found matching route and before route/request handler method is executed.\n\nfunc Use(middleware ...MiddlewareFunc)","url":"/api-reference/package-root.html#method-Echo-Use","tab":"API Reference","category":"go method"},{"title":"type Group","content":"Group is a set of sub-routes for a specified route. It can be used for inner\nroutes that share a common middleware or functionality that should be separate\nfrom the parent echo instance while still inheriting from it.\n\ntype Group struct {\n\t// contains filtered or unexported fields\n}","url":"/api-reference/package-root.html#type-Group","tab":"API Reference","category":"go type"},{"title":"Group.Add","content":"Add implements `Echo#Add()` for sub-routes within the Group. Panics on error.\n\nfunc Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-Add","tab":"API Reference","category":"go method"},{"title":"Group.AddRoute","content":"AddRoute registers a new Routable with Router\n\nfunc AddRoute(route Route) (RouteInfo, error)","url":"/api-reference/package-root.html#method-Group-AddRoute","tab":"API Reference","category":"go method"},{"title":"Group.Any","content":"Any implements `Echo#Any()` for sub-routes within the Group. Panics on error.\n\nfunc Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-Any","tab":"API Reference","category":"go method"},{"title":"Group.CONNECT","content":"CONNECT implements `Echo#CONNECT()` for sub-routes within the Group. Panics on error.\n\nfunc CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-CONNECT","tab":"API Reference","category":"go method"},{"title":"Group.DELETE","content":"DELETE implements `Echo#DELETE()` for sub-routes within the Group. Panics on error.\n\nfunc DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-DELETE","tab":"API Reference","category":"go method"},{"title":"Group.File","content":"File implements `Echo#File()` for sub-routes within the Group. Panics on error.\n\nAvoid using the leading `/` slash as most of the Go standard library fs.FS implementations require relative paths for\nfile operations.\n\nfunc File(path, file string, middleware ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-File","tab":"API Reference","category":"go method"},{"title":"Group.FileFS","content":"FileFS implements `Echo#FileFS()` for sub-routes within the Group.\n\nAvoid using the leading `/` slash as most of the Go standard library fs.FS implementations require relative paths for\nfile operations.\n\nfunc FileFS(path, file string, filesystem fs.FS, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-FileFS","tab":"API Reference","category":"go method"},{"title":"Group.GET","content":"GET implements `Echo#GET()` for sub-routes within the Group. Panics on error.\n\nfunc GET(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-GET","tab":"API Reference","category":"go method"},{"title":"Group.Group","content":"Group creates a new sub-group with prefix and optional sub-group-level middleware.\n\nImportant! Group middlewares are executed in case there was no exact route match as by default Group registers\n`/*` NotFound routes for itself. If this kind of behavior is not needed, then create an Echo instance with the ` noAutoRegisterRoutes `\nflag set to true. Example `echo.NewWithConfig(echo.Config{NoGroupAutoRegister404Routes: true})`.\n\nfunc Group) Group(prefix string, middleware ...MiddlewareFunc) (sg *Gr","url":"/api-reference/package-root.html#method-Group-Group","tab":"API Reference","category":"go method"},{"title":"Group.HEAD","content":"HEAD implements `Echo#HEAD()` for sub-routes within the Group. Panics on error.\n\nfunc HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-HEAD","tab":"API Reference","category":"go method"},{"title":"Group.Match","content":"Match implements `Echo#Match()` for sub-routes within the Group. Panics on error.\n\nfunc Match(methods []string, path string, handler HandlerFunc, middleware ...MiddlewareFunc) Routes","url":"/api-reference/package-root.html#method-Group-Match","tab":"API Reference","category":"go method"},{"title":"Group.OPTIONS","content":"OPTIONS implements `Echo#OPTIONS()` for sub-routes within the Group. Panics on error.\n\nfunc OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-OPTIONS","tab":"API Reference","category":"go method"},{"title":"Group.PATCH","content":"PATCH implements `Echo#PATCH()` for sub-routes within the Group. Panics on error.\n\nfunc PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-PATCH","tab":"API Reference","category":"go method"},{"title":"Group.POST","content":"POST implements `Echo#POST()` for sub-routes within the Group. Panics on error.\n\nfunc POST(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-POST","tab":"API Reference","category":"go method"},{"title":"Group.PUT","content":"PUT implements `Echo#PUT()` for sub-routes within the Group. Panics on error.\n\nfunc PUT(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-PUT","tab":"API Reference","category":"go method"},{"title":"Group.QUERY","content":"QUERY implements `Echo#QUERY()` for sub-routes within the Group. Panics on error.\n\nfunc QUERY(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-QUERY","tab":"API Reference","category":"go method"},{"title":"Group.RouteNotFound","content":"RouteNotFound implements `Echo#RouteNotFound()` for sub-routes within the Group.\n\nExample: `g.RouteNotFound(\"/*\", func(c *echo.Context) error { return c.NoContent(http.StatusNotFound) })`\n\nfunc RouteNotFound(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-RouteNotFound","tab":"API Reference","category":"go method"},{"title":"Group.Static","content":"Static implements `Echo#Static()` for sub-routes within the Group.\n\nfunc Static(pathPrefix, fsRoot string, middleware ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-Static","tab":"API Reference","category":"go method"},{"title":"Group.StaticFS","content":"StaticFS implements `Echo#StaticFS()` for sub-routes within the Group.\n\nWhen dealing with `embed.FS` use `fs := echo.MustSubFS(fs, \"rootDirectory\") to create sub fs which uses necessary\nprefix for directory path. This is necessary as `//go:embed assets/images` embeds files with paths\nincluding `assets/images` as their prefix.\n\nfunc StaticFS(pathPrefix string, filesystem fs.FS, middleware ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-StaticFS","tab":"API Reference","category":"go method"},{"title":"Group.TRACE","content":"TRACE implements `Echo#TRACE()` for sub-routes within the Group. Panics on error.\n\nfunc TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) RouteInfo","url":"/api-reference/package-root.html#method-Group-TRACE","tab":"API Reference","category":"go method"},{"title":"Group.Use","content":"Use implements `Echo#Use()` for sub-routes within the Group.\n\nImportant! Group middlewares are executed in case there was no exact route match as by default Group registers\n`/*` NotFound routes for itself. If this kind of behavior is not needed, then create an Echo instance with the ` noAutoRegisterRoutes `\nflag set to true. Example `echo.NewWithConfig(echo.Config{NoGroupAutoRegister404Routes: true})`.\n\nfunc Use(middleware ...MiddlewareFunc)","url":"/api-reference/package-root.html#method-Group-Use","tab":"API Reference","category":"go method"},{"title":"type HTTPError","content":"HTTPError represents an error that occurred while handling a request.\n\ntype HTTPError struct {\n\t// Code is status code for HTTP response\n\tCode int `json:\"-\"`\n\tMessage string `json:\"message\"`\n\t// contains filtered or unexported fields\n}","url":"/api-reference/package-root.html#type-HTTPError","tab":"API Reference","category":"go type"},{"title":"HTTPError.Error","content":"Error makes it compatible with the ` error ` interface.\n\nfunc Error) Error() string","url":"/api-reference/package-root.html#method-HTTPError-Error","tab":"API Reference","category":"go method"},{"title":"HTTPError.StatusCode","content":"StatusCode returns status code for HTTP response\n\nfunc StatusCode() int","url":"/api-reference/package-root.html#method-HTTPError-StatusCode","tab":"API Reference","category":"go method"},{"title":"HTTPError.Unwrap","content":"func Unwrap() error","url":"/api-reference/package-root.html#method-HTTPError-Unwrap","tab":"API Reference","category":"go method"},{"title":"HTTPError.Wrap","content":"Wrap returns a new HTTPError with given errors wrapped inside\n\nfunc Wrap(err error) error","url":"/api-reference/package-root.html#method-HTTPError-Wrap","tab":"API Reference","category":"go method"},{"title":"type HTTPErrorHandler","content":"HTTPErrorHandler is a centralized HTTP error handler.\n\ntype HTTPErrorHandler func(c *Context, err error)","url":"/api-reference/package-root.html#type-HTTPErrorHandler","tab":"API Reference","category":"go type"},{"title":"type HTTPStatusCoder","content":"HTTPStatusCoder is an interface that errors can implement to produce status code for HTTP response\n\ntype HTTPStatusCoder interface {\n\tStatusCode() int\n}","url":"/api-reference/package-root.html#type-HTTPStatusCoder","tab":"API Reference","category":"go type"},{"title":"type HandlerFunc","content":"HandlerFunc defines a function to serve HTTP requests.\n\ntype HandlerFunc func(c *Context) error","url":"/api-reference/package-root.html#type-HandlerFunc","tab":"API Reference","category":"go type"},{"title":"type IPExtractor","content":"IPExtractor is a function to extract IP addr from http.Request.\nSet appropriate one to Echo#IPExtractor.\nSee https://echo.labstack.com/guide/ip-address for more details.\n\ntype IPExtractor func(*http.Request) string","url":"/api-reference/package-root.html#type-IPExtractor","tab":"API Reference","category":"go type"},{"title":"type JSONSerializer","content":"JSONSerializer is the interface that encodes and decodes JSON to and from interfaces.\n\ntype JSONSerializer interface {\n\tSerialize(c *Context, target any, indent string) error\n\tDeserialize(c *Context, target any) error\n}","url":"/api-reference/package-root.html#type-JSONSerializer","tab":"API Reference","category":"go type"},{"title":"type MiddlewareConfigurator","content":"MiddlewareConfigurator defines interface for creating middleware handlers with possibility to return configuration errors instead of panicking.\n\ntype MiddlewareConfigurator interface {\n\tToMiddleware() (MiddlewareFunc, error)\n}","url":"/api-reference/package-root.html#type-MiddlewareConfigurator","tab":"API Reference","category":"go type"},{"title":"type MiddlewareFunc","content":"MiddlewareFunc defines a function to process middleware.\n\ntype MiddlewareFunc func(next HandlerFunc) HandlerFunc","url":"/api-reference/package-root.html#type-MiddlewareFunc","tab":"API Reference","category":"go type"},{"title":"type PathValue","content":"PathValue is tuple pf path parameter name and its value in request path\n\ntype PathValue struct {\n\tName string\n\tValue string\n}","url":"/api-reference/package-root.html#type-PathValue","tab":"API Reference","category":"go type"},{"title":"type PathValues","content":"PathValues is collections of PathValue instances with various helper methods\n\ntype PathValues []PathValue","url":"/api-reference/package-root.html#type-PathValues","tab":"API Reference","category":"go type"},{"title":"PathValues.Get","content":"Get returns path parameter value for given name or false.\n\nfunc Get(name string) (string, bool)","url":"/api-reference/package-root.html#method-PathValues-Get","tab":"API Reference","category":"go method"},{"title":"PathValues.GetOr","content":"GetOr returns path parameter value for given name or default value if the name does not exist.\n\nfunc GetOr(name string, defaultValue string) string","url":"/api-reference/package-root.html#method-PathValues-GetOr","tab":"API Reference","category":"go method"},{"title":"type Renderer","content":"Renderer is the interface that wraps the Render function.\n\ntype Renderer interface {\n\tRender(c *Context, w io.Writer, templateName string, data any) error\n}","url":"/api-reference/package-root.html#type-Renderer","tab":"API Reference","category":"go type"},{"title":"type Response","content":"Response wraps an http.ResponseWriter and implements its interface to be used\nby an HTTP handler to construct an HTTP response.\nSee: https://golang.org/pkg/net/http/#ResponseWriter\n\ntype Response struct {\n\thttp.ResponseWriter\n\n\tStatus int\n\tSize int64\n\tCommitted bool\n\t// contains filtered or unexported fields\n}","url":"/api-reference/package-root.html#type-Response","tab":"API Reference","category":"go type"},{"title":"Response.After","content":"After registers a function which is called just after the response is written.\n\nfunc After(fn func())","url":"/api-reference/package-root.html#method-Response-After","tab":"API Reference","category":"go method"},{"title":"Response.Before","content":"Before registers a function which is called just before the response (status) is written.\n\nfunc Before(fn func())","url":"/api-reference/package-root.html#method-Response-Before","tab":"API Reference","category":"go method"},{"title":"Response.Flush","content":"Flush implements the http.Flusher interface to allow an HTTP handler to flush\nbuffered data to the client.\nSee [http.Flusher](https://golang.org/pkg/net/http/#Flusher)\n\nfunc Flush()","url":"/api-reference/package-root.html#method-Response-Flush","tab":"API Reference","category":"go method"},{"title":"Response.Hijack","content":"Hijack implements the http.Hijacker interface to allow an HTTP handler to\ntake over the connection.\nThis method is relevant to Websocket connection upgrades, proxis, and other advanced use cases.\nSee [http.Hijacker](https://golang.org/pkg/net/http/#Hijacker)\n\nfunc Hijack() (net.Conn, *bufio.ReadWriter, error)","url":"/api-reference/package-root.html#method-Response-Hijack","tab":"API Reference","category":"go method"},{"title":"Response.Unwrap","content":"Unwrap returns the original http.ResponseWriter.\nResponseController can be used to access the original http.ResponseWriter.\nSee [https://go.dev/blog/go1.20]\n\nfunc Unwrap() http.ResponseWriter","url":"/api-reference/package-root.html#method-Response-Unwrap","tab":"API Reference","category":"go method"},{"title":"Response.Write","content":"Write writes the data to the connection as part of an HTTP reply.\n\nfunc Write(b []byte) (n int, err error)","url":"/api-reference/package-root.html#method-Response-Write","tab":"API Reference","category":"go method"},{"title":"Response.WriteHeader","content":"WriteHeader sends an HTTP response header with status code. If WriteHeader is\nnot called explicitly, the first call to Write will trigger an implicit\nWriteHeader(http.StatusOK). Thus explicit calls to WriteHeader are mainly\nused to send error codes.\n\nfunc WriteHeader(code int)","url":"/api-reference/package-root.html#method-Response-WriteHeader","tab":"API Reference","category":"go method"},{"title":"type Route","content":"Route contains information to adding/registering new route with the router.\nMethod+Path pair uniquely identifies the Route. It is mandatory to provide Method+Path fields.\n\ntype Route struct {\n\tMethod string\n\tPath string\n\tName string\n\n\t// HandlerFunc is a function that handles HTTP requests. This could be left nil when the Router implementation allows\n\t// fallback to default/global handlers in certain situations.\n\tHandler HandlerFunc\n\tMiddlewares []MiddlewareFunc\n}","url":"/api-reference/package-root.html#type-Route","tab":"API Reference","category":"go type"},{"title":"Route.ToRouteInfo","content":"ToRouteInfo converts Route to RouteInfo\n\nfunc ToRouteInfo(params []string) RouteInfo","url":"/api-reference/package-root.html#method-Route-ToRouteInfo","tab":"API Reference","category":"go method"},{"title":"Route.WithPrefix","content":"WithPrefix recreates Route with added group prefix and group middlewares it is grouped to.\n\nfunc WithPrefix(pathPrefix string, middlewares []MiddlewareFunc) Route","url":"/api-reference/package-root.html#method-Route-WithPrefix","tab":"API Reference","category":"go method"},{"title":"type RouteInfo","content":"RouteInfo contains information about registered Route.\n\ntype RouteInfo struct {\n\tName string\n\tMethod string\n\tPath string\n\tParameters []string\n}","url":"/api-reference/package-root.html#type-RouteInfo","tab":"API Reference","category":"go type"},{"title":"RouteInfo.Clone","content":"Clone creates copy of RouteInfo\n\nfunc Clone() RouteInfo","url":"/api-reference/package-root.html#method-RouteInfo-Clone","tab":"API Reference","category":"go method"},{"title":"RouteInfo.Reverse","content":"Reverse reverses route to URL string by replacing path parameters with given params values.\n\nfunc Reverse(pathValues ...any) string","url":"/api-reference/package-root.html#method-RouteInfo-Reverse","tab":"API Reference","category":"go method"},{"title":"type Router","content":"Router is interface for routing request contexts to registered routes.\n\nContract between Echo/Context instance and the router:\n - all routes must be added through methods on echo.Echo instance.\n Reason: Echo instance uses RouteInfo.Params() length to allocate slice for paths parameters (see `Echo.contextPathParamAllocSize`).\n - Router must populate Context during Router.Route call with:\n - Context.InitializeRoute (IMPORTANT! to reduce allocations use same slice that c.PathValues() returns)","url":"/api-reference/package-root.html#type-Router","tab":"API Reference","category":"go type"},{"title":"type RouterConfig","content":"RouterConfig is configuration options for (default) router\n\ntype RouterConfig struct {\n\t// NotFoundHandler is a handler that is executed when no route matches the request.\n\tNotFoundHandler HandlerFunc\n\n\t// MethodNotAllowedHandler is a handler that is executed when no route with exact METHOD matches the request but\n\t// there is a route with same path but different method.\n\tMethodNotAllowedHandler HandlerFunc\n\n\t// OptionsMethodHandler is a handler that is executed when an OPTIONS request is made.\n","url":"/api-reference/package-root.html#type-RouterConfig","tab":"API Reference","category":"go type"},{"title":"type Routes","content":"Routes is collection of RouteInfo instances with various helper methods.\n\ntype Routes []RouteInfo","url":"/api-reference/package-root.html#type-Routes","tab":"API Reference","category":"go type"},{"title":"Routes.Clone","content":"Clone creates copy of Routes\n\nfunc Clone() Routes","url":"/api-reference/package-root.html#method-Routes-Clone","tab":"API Reference","category":"go method"},{"title":"Routes.FilterByMethod","content":"FilterByMethod searched for matching route info by method\n\nfunc FilterByMethod(method string) (Routes, error)","url":"/api-reference/package-root.html#method-Routes-FilterByMethod","tab":"API Reference","category":"go method"},{"title":"Routes.FilterByName","content":"FilterByName searched for matching route info by name\n\nfunc FilterByName(name string) (Routes, error)","url":"/api-reference/package-root.html#method-Routes-FilterByName","tab":"API Reference","category":"go method"},{"title":"Routes.FilterByPath","content":"FilterByPath searched for matching route info by path\n\nfunc FilterByPath(path string) (Routes, error)","url":"/api-reference/package-root.html#method-Routes-FilterByPath","tab":"API Reference","category":"go method"},{"title":"Routes.FindByMethodPath","content":"FindByMethodPath searched for matching route info by method and path\n\nfunc FindByMethodPath(method string, path string) (RouteInfo, error)","url":"/api-reference/package-root.html#method-Routes-FindByMethodPath","tab":"API Reference","category":"go method"},{"title":"Routes.Reverse","content":"Reverse reverses route to URL string by replacing path parameters with given params values.\n\nfunc Reverse(routeName string, pathValues ...any) (string, error)","url":"/api-reference/package-root.html#method-Routes-Reverse","tab":"API Reference","category":"go method"},{"title":"type StartConfig","content":"StartConfig is for creating configured http.Server instance to start serve http(s) requests with given Echo instance\n\ntype StartConfig struct {\n\t// Address specifies the address where listener will start listening on to serve HTTP(s) requests\n\tAddress string\n\n\t// HideBanner instructs Start* method not to print banner when starting the Server.\n\tHideBanner bool\n\t// HidePort instructs Start* method not to print port when starting the Server.\n\tHidePort bool\n\n\t// CertFilesystem is filesystem is used ","url":"/api-reference/package-root.html#type-StartConfig","tab":"API Reference","category":"go type"},{"title":"StartConfig.Start","content":"Start starts given Handler with HTTP(s) server.\n\nfunc StartConfig) Start(ctx stdContext.Context, h http.Handler) error","url":"/api-reference/package-root.html#method-StartConfig-Start","tab":"API Reference","category":"go method"},{"title":"StartConfig.StartTLS","content":"StartTLS starts given Handler with HTTPS server.\nIf `certFile` or `keyFile` is `string` the values are treated as file paths.\nIf `certFile` or `keyFile` is `[]byte` the values are treated as the certificate or key as-is.\n\nfunc StartTLS(ctx stdContext.Context, h http.Handler, certFile, keyFile any) error","url":"/api-reference/package-root.html#method-StartConfig-StartTLS","tab":"API Reference","category":"go method"},{"title":"type TemplateRenderer","content":"TemplateRenderer is helper to ease creating renderers for `html/template` and `text/template` packages.\nExample usage:\n\n\t\te.Renderer = &echo.TemplateRenderer{\n\t\t\tTemplate: template.Must(template.ParseGlob(\"templates/*.html\")),\n\t\t}\n\n\t e.Renderer = &echo.TemplateRenderer{\n\t\t\tTemplate: template.Must(template.New(\"hello\").Parse(\"Hello, {{.}}!\")),\n\t\t}\n\ntype TemplateRenderer struct {\n\tTemplate interface {\n\t\tExecuteTemplate(wr io.Writer, name string, data any) error\n\t}\n}","url":"/api-reference/package-root.html#type-TemplateRenderer","tab":"API Reference","category":"go type"},{"title":"TemplateRenderer.Render","content":"Render renders the template with given data.\n\nfunc Renderer) Render(c *Context, w io.Writer, name string, data any) error","url":"/api-reference/package-root.html#method-TemplateRenderer-Render","tab":"API Reference","category":"go method"},{"title":"type TimeLayout","content":"TimeLayout specifies the format for parsing time values in request parameters.\nIt can be a standard Go time layout string or one of the special Unix time layouts.\n\ntype TimeLayout string","url":"/api-reference/package-root.html#type-TimeLayout","tab":"API Reference","category":"go type"},{"title":"type TimeOpts","content":"TimeOpts is options for parsing time.Time values\n\ntype TimeOpts struct {\n\t// Layout specifies the format for parsing time values in request parameters.\n\t// It can be a standard Go time layout string or one of the special Unix time layouts.\n\t//\n\t// Parsing layout defaults to: echo.TimeLayout(time.RFC3339Nano)\n\t// - To convert to custom layout use `echo.TimeLayout(\"2006-01-02\")`\n\t// - To convert unix timestamp (integer) to time.Time use `echo.TimeLayoutUnixTime`\n\t// - To convert unix timestamp in ","url":"/api-reference/package-root.html#type-TimeOpts","tab":"API Reference","category":"go type"},{"title":"type TrustOption","content":"TrustOption is config for which IP address to trust\n\ntype TrustOption func(*ipChecker)","url":"/api-reference/package-root.html#type-TrustOption","tab":"API Reference","category":"go type"},{"title":"type Validator","content":"Validator is the interface that wraps the Validate function.\n\ntype Validator interface {\n\tValidate(i any) error\n}","url":"/api-reference/package-root.html#type-Validator","tab":"API Reference","category":"go type"},{"title":"type ValueBinder","content":"ValueBinder provides utility methods for binding query or path parameter to various Go built-in types\n\ntype ValueBinder struct {\n\t// ValueFunc is used to get single parameter (first) value from request\n\tValueFunc func(sourceParam string) string\n\t// ValuesFunc is used to get all values for parameter from request. i.e. `/api/search?ids=1&ids=2`\n\tValuesFunc func(sourceParam string) []string\n\t// ErrorFunc is used to create errors. Allows you to use your own error type, that for example marshals to y","url":"/api-reference/package-root.html#type-ValueBinder","tab":"API Reference","category":"go type"},{"title":"ValueBinder.BindError","content":"BindError returns first seen bind error and resets/empties binder errors for further calls\n\nfunc BindError() error","url":"/api-reference/package-root.html#method-ValueBinder-BindError","tab":"API Reference","category":"go method"},{"title":"Example ValueBinder.BindError","content":"{\n\n\tfailFastRouteFunc := func(c *echo.Context) error {\n\t\tvar opts struct {\n\t\t\tIDs []int64\n\t\t\tActive bool\n\t\t}\n\t\tlength := int64(50)\n\n\t\tb := echo.QueryParamsBinder(c)\n\n\t\terr := b.Int64(\"length\", &length).\n\t\t\tInt64s(\"ids\", &opts.IDs).\n\t\t\tBool(\"active\", &opts.Active).\n\t\t\tBindError()\n\t\tif err != nil {\n\t\t\tbErr := err.(*echo.BindingError)\n\t\t\treturn fmt.Errorf(\"my own custom error for field: %s values: %v\", bErr.Field, bErr.Values)\n\t\t}\n\t\tfmt.Printf(\"active = %v, length = %v, ids = %v\\n\", opts.Active,","url":"/api-reference/package-root.html#method-ValueBinder-BindError","tab":"API Reference","category":"go example"},{"title":"ValueBinder.BindErrors","content":"BindErrors returns all bind errors and resets/empties binder errors for further calls\n\nfunc BindErrors() []error","url":"/api-reference/package-root.html#method-ValueBinder-BindErrors","tab":"API Reference","category":"go method"},{"title":"Example ValueBinder.BindErrors","content":"{\n\n\trouteFunc := func(c *echo.Context) error {\n\t\tvar opts struct {\n\t\t\tIDs []int64\n\t\t\tActive bool\n\t\t}\n\t\tlength := int64(50)\n\n\t\tb := echo.QueryParamsBinder(c)\n\n\t\terrs := b.Int64(\"length\", &length).\n\t\t\tInt64s(\"ids\", &opts.IDs).\n\t\t\tBool(\"active\", &opts.Active).\n\t\t\tBindErrors()\n\t\tif errs != nil {\n\t\t\tfor _, err := range errs {\n\t\t\t\tbErr := err.(*echo.BindingError)\n\t\t\t\tlog.Printf(\"in case you want to access what field: %s values: %v failed\", bErr.Field, bErr.Values)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"%v fiel","url":"/api-reference/package-root.html#method-ValueBinder-BindErrors","tab":"API Reference","category":"go example"},{"title":"ValueBinder.BindUnmarshaler","content":"BindUnmarshaler binds parameter to destination implementing BindUnmarshaler interface\n\nfunc BindUnmarshaler(sourceParam string, dest BindUnmarshaler) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-BindUnmarshaler","tab":"API Reference","category":"go method"},{"title":"ValueBinder.BindWithDelimiter","content":"BindWithDelimiter binds parameter to destination by suitable conversion function.\nDelimiter is used before conversion to split parameter value to separate values\n\nfunc BindWithDelimiter(sourceParam string, dest any, delimiter string) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-BindWithDelimiter","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Bool","content":"Bool binds parameter to bool variable\n\nfunc Bool(sourceParam string, dest *bool) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Bool","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Bools","content":"Bools binds parameter values to slice of bool variables\n\nfunc Bools(sourceParam string, dest *[]bool) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Bools","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Byte","content":"Byte binds parameter to byte variable\n\nfunc Byte(sourceParam string, dest *byte) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Byte","tab":"API Reference","category":"go method"},{"title":"ValueBinder.CustomFunc","content":"CustomFunc binds parameter values with Func. Func is called only when parameter values exist.\n\nfunc CustomFunc(sourceParam string, customFunc func(values []string) []error) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-CustomFunc","tab":"API Reference","category":"go method"},{"title":"Example ValueBinder.CustomFunc","content":"{\n\n\trouteFunc := func(c *echo.Context) error {\n\t\tlength := int64(50)\n\t\tvar binary []byte\n\n\t\tb := echo.QueryParamsBinder(c)\n\t\terrs := b.Int64(\"length\", &length).\n\t\t\tCustomFunc(\"base64\", func(values []string) []error {\n\t\t\t\tif len(values) == 0 {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tdecoded, err := base64.URLEncoding.DecodeString(values[0])\n\t\t\t\tif err != nil {\n\n\t\t\t\t\treturn []error{echo.NewBindingError(\"base64\", values[0:1], \"failed to decode base64\", err)}\n\t\t\t\t}\n\t\t\t\tbinary = decoded\n\t\t\t\treturn nil\n\t\t\t}).\n\t\t\tBi","url":"/api-reference/package-root.html#method-ValueBinder-CustomFunc","tab":"API Reference","category":"go example"},{"title":"ValueBinder.Duration","content":"Duration binds parameter to time.Duration variable\n\nfunc Duration(sourceParam string, dest *time.Duration) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Duration","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Durations","content":"Durations binds parameter values to slice of time.Duration variables\n\nfunc Durations(sourceParam string, dest *[]time.Duration) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Durations","tab":"API Reference","category":"go method"},{"title":"ValueBinder.FailFast","content":"FailFast set internal flag to indicate if binding methods will return early (without binding) when previous bind failed\nNB: call this method before any other binding methods as it modifies binding methods behaviour\n\nfunc FailFast(value bool) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-FailFast","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Float32","content":"Float32 binds parameter to float32 variable\n\nfunc Float32(sourceParam string, dest *float32) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Float32","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Float32s","content":"Float32s binds parameter values to slice of float32 variables\n\nfunc Float32s(sourceParam string, dest *[]float32) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Float32s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Float64","content":"Float64 binds parameter to float64 variable\n\nfunc Float64(sourceParam string, dest *float64) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Float64","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Float64s","content":"Float64s binds parameter values to slice of float64 variables\n\nfunc Float64s(sourceParam string, dest *[]float64) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Float64s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Int","content":"Int binds parameter to int variable\n\nfunc Int(sourceParam string, dest *int) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Int","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Int16","content":"Int16 binds parameter to int16 variable\n\nfunc Int16(sourceParam string, dest *int16) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Int16","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Int16s","content":"Int16s binds parameter to slice of int16\n\nfunc Int16s(sourceParam string, dest *[]int16) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Int16s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Int32","content":"Int32 binds parameter to int32 variable\n\nfunc Int32(sourceParam string, dest *int32) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Int32","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Int32s","content":"Int32s binds parameter to slice of int32\n\nfunc Int32s(sourceParam string, dest *[]int32) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Int32s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Int64","content":"Int64 binds parameter to int64 variable\n\nfunc Int64(sourceParam string, dest *int64) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Int64","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Int64s","content":"Int64s binds parameter to slice of int64\n\nfunc Int64s(sourceParam string, dest *[]int64) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Int64s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Int8","content":"Int8 binds parameter to int8 variable\n\nfunc Int8(sourceParam string, dest *int8) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Int8","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Int8s","content":"Int8s binds parameter to slice of int8\n\nfunc Int8s(sourceParam string, dest *[]int8) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Int8s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Ints","content":"Ints binds parameter to slice of int\n\nfunc Ints(sourceParam string, dest *[]int) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Ints","tab":"API Reference","category":"go method"},{"title":"ValueBinder.JSONUnmarshaler","content":"JSONUnmarshaler binds parameter to destination implementing json.Unmarshaler interface\n\nfunc JSONUnmarshaler(sourceParam string, dest json.Unmarshaler) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-JSONUnmarshaler","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustBindUnmarshaler","content":"MustBindUnmarshaler requires parameter value to exist to bind to destination implementing BindUnmarshaler interface.\nReturns error when value does not exist\n\nfunc MustBindUnmarshaler(sourceParam string, dest BindUnmarshaler) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustBindUnmarshaler","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustBindWithDelimiter","content":"MustBindWithDelimiter requires parameter value to exist to bind destination by suitable conversion function.\nDelimiter is used before conversion to split parameter value to separate values\n\nfunc MustBindWithDelimiter(sourceParam string, dest any, delimiter string) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustBindWithDelimiter","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustBool","content":"MustBool requires parameter value to exist to bind to bool variable. Returns error when value does not exist\n\nfunc MustBool(sourceParam string, dest *bool) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustBool","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustBools","content":"MustBools requires parameter values to exist to bind to slice of bool variables. Returns error when values does not exist\n\nfunc MustBools(sourceParam string, dest *[]bool) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustBools","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustByte","content":"MustByte requires parameter value to exist to bind to byte variable. Returns error when value does not exist\n\nfunc MustByte(sourceParam string, dest *byte) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustByte","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustCustomFunc","content":"MustCustomFunc requires parameter values to exist to bind with Func. Returns error when value does not exist.\n\nfunc MustCustomFunc(sourceParam string, customFunc func(values []string) []error) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustCustomFunc","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustDuration","content":"MustDuration requires parameter value to exist to bind to time.Duration variable. Returns error when value does not exist\n\nfunc MustDuration(sourceParam string, dest *time.Duration) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustDuration","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustDurations","content":"MustDurations requires parameter values to exist to bind to slice of time.Duration variables. Returns error when values does not exist\n\nfunc MustDurations(sourceParam string, dest *[]time.Duration) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustDurations","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustFloat32","content":"MustFloat32 requires parameter value to exist to bind to float32 variable. Returns error when value does not exist\n\nfunc MustFloat32(sourceParam string, dest *float32) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustFloat32","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustFloat32s","content":"MustFloat32s requires parameter values to exist to bind to slice of float32 variables. Returns error when values does not exist\n\nfunc MustFloat32s(sourceParam string, dest *[]float32) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustFloat32s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustFloat64","content":"MustFloat64 requires parameter value to exist to bind to float64 variable. Returns error when value does not exist\n\nfunc MustFloat64(sourceParam string, dest *float64) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustFloat64","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustFloat64s","content":"MustFloat64s requires parameter values to exist to bind to slice of float64 variables. Returns error when values does not exist\n\nfunc MustFloat64s(sourceParam string, dest *[]float64) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustFloat64s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustInt","content":"MustInt requires parameter value to exist to bind to int variable. Returns error when value does not exist\n\nfunc MustInt(sourceParam string, dest *int) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustInt","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustInt16","content":"MustInt16 requires parameter value to exist to bind to int16 variable. Returns error when value does not exist\n\nfunc MustInt16(sourceParam string, dest *int16) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustInt16","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustInt16s","content":"MustInt16s requires parameter value to exist to bind to int16 slice variable. Returns error when value does not exist\n\nfunc MustInt16s(sourceParam string, dest *[]int16) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustInt16s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustInt32","content":"MustInt32 requires parameter value to exist to bind to int32 variable. Returns error when value does not exist\n\nfunc MustInt32(sourceParam string, dest *int32) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustInt32","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustInt32s","content":"MustInt32s requires parameter value to exist to bind to int32 slice variable. Returns error when value does not exist\n\nfunc MustInt32s(sourceParam string, dest *[]int32) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustInt32s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustInt64","content":"MustInt64 requires parameter value to exist to bind to int64 variable. Returns error when value does not exist\n\nfunc MustInt64(sourceParam string, dest *int64) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustInt64","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustInt64s","content":"MustInt64s requires parameter value to exist to bind to int64 slice variable. Returns error when value does not exist\n\nfunc MustInt64s(sourceParam string, dest *[]int64) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustInt64s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustInt8","content":"MustInt8 requires parameter value to exist to bind to int8 variable. Returns error when value does not exist\n\nfunc MustInt8(sourceParam string, dest *int8) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustInt8","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustInt8s","content":"MustInt8s requires parameter value to exist to bind to int8 slice variable. Returns error when value does not exist\n\nfunc MustInt8s(sourceParam string, dest *[]int8) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustInt8s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustInts","content":"MustInts requires parameter value to exist to bind to int slice variable. Returns error when value does not exist\n\nfunc MustInts(sourceParam string, dest *[]int) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustInts","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustJSONUnmarshaler","content":"MustJSONUnmarshaler requires parameter value to exist to bind to destination implementing json.Unmarshaler interface.\nReturns error when value does not exist\n\nfunc MustJSONUnmarshaler(sourceParam string, dest json.Unmarshaler) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustJSONUnmarshaler","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustString","content":"MustString requires parameter value to exist to bind to string variable. Returns error when value does not exist\n\nfunc MustString(sourceParam string, dest *string) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustString","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustStrings","content":"MustStrings requires parameter values to exist to bind to slice of string variables. Returns error when value does not exist\n\nfunc MustStrings(sourceParam string, dest *[]string) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustStrings","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustTextUnmarshaler","content":"MustTextUnmarshaler requires parameter value to exist to bind to destination implementing encoding.TextUnmarshaler interface.\nReturns error when value does not exist\n\nfunc MustTextUnmarshaler(sourceParam string, dest encoding.TextUnmarshaler) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustTextUnmarshaler","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustTime","content":"MustTime requires parameter value to exist to bind to time.Time variable. Returns error when value does not exist\n\nfunc MustTime(sourceParam string, dest *time.Time, layout string) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustTime","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustTimes","content":"MustTimes requires parameter values to exist to bind to slice of time.Time variables. Returns error when values does not exist\n\nfunc MustTimes(sourceParam string, dest *[]time.Time, layout string) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustTimes","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustUint","content":"MustUint requires parameter value to exist to bind to uint variable. Returns error when value does not exist\n\nfunc MustUint(sourceParam string, dest *uint) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustUint","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustUint16","content":"MustUint16 requires parameter value to exist to bind to uint16 variable. Returns error when value does not exist\n\nfunc MustUint16(sourceParam string, dest *uint16) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustUint16","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustUint16s","content":"MustUint16s requires parameter value to exist to bind to uint16 slice variable. Returns error when value does not exist\n\nfunc MustUint16s(sourceParam string, dest *[]uint16) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustUint16s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustUint32","content":"MustUint32 requires parameter value to exist to bind to uint32 variable. Returns error when value does not exist\n\nfunc MustUint32(sourceParam string, dest *uint32) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustUint32","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustUint32s","content":"MustUint32s requires parameter value to exist to bind to uint32 slice variable. Returns error when value does not exist\n\nfunc MustUint32s(sourceParam string, dest *[]uint32) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustUint32s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustUint64","content":"MustUint64 requires parameter value to exist to bind to uint64 variable. Returns error when value does not exist\n\nfunc MustUint64(sourceParam string, dest *uint64) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustUint64","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustUint64s","content":"MustUint64s requires parameter value to exist to bind to uint64 slice variable. Returns error when value does not exist\n\nfunc MustUint64s(sourceParam string, dest *[]uint64) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustUint64s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustUint8","content":"MustUint8 requires parameter value to exist to bind to uint8 variable. Returns error when value does not exist\n\nfunc MustUint8(sourceParam string, dest *uint8) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustUint8","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustUint8s","content":"MustUint8s requires parameter value to exist to bind to uint8 slice variable. Returns error when value does not exist\n\nfunc MustUint8s(sourceParam string, dest *[]uint8) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustUint8s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustUints","content":"MustUints requires parameter value to exist to bind to uint slice variable. Returns error when value does not exist\n\nfunc MustUints(sourceParam string, dest *[]uint) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustUints","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustUnixTime","content":"MustUnixTime requires parameter value to exist to bind to time.Time variable (in local time corresponding\nto the given Unix time). Returns error when value does not exist.\n\nExample: 1609180603 bind to 2020-12-28T18:36:43.000000000+00:00\n\nNote:\n - time.Time{} (param is empty) and time.Unix(0,0) (param = \"0\") are not equal\n\nfunc MustUnixTime(sourceParam string, dest *time.Time) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustUnixTime","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustUnixTimeMilli","content":"MustUnixTimeMilli requires parameter value to exist to bind to time.Time variable (in local time corresponding\nto the given Unix time in millisecond precision). Returns error when value does not exist.\n\nExample: 1647184410140 bind to 2022-03-13T15:13:30.140000000+00:00\n\nNote:\n - time.Time{} (param is empty) and time.Unix(0,0) (param = \"0\") are not equal\n\nfunc MustUnixTimeMilli(sourceParam string, dest *time.Time) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-MustUnixTimeMilli","tab":"API Reference","category":"go method"},{"title":"ValueBinder.MustUnixTimeNano","content":"MustUnixTimeNano requires parameter value to exist to bind to time.Time variable (in local time corresponding\nto the given Unix time value in nanosecond precision). Returns error when value does not exist.\n\nExample: 1609180603123456789 binds to 2020-12-28T18:36:43.123456789+00:00\nExample: 1000000000 binds to 1970-01-01T00:00:01.000000000+00:00\nExample: 999999999 binds to 1970-01-01T00:00:00.999999999+00:00\n\nNote:\n - time.Time{} (param is empty) and time.Unix(0,0) (param = \"0\"","url":"/api-reference/package-root.html#method-ValueBinder-MustUnixTimeNano","tab":"API Reference","category":"go method"},{"title":"ValueBinder.String","content":"String binds parameter to string variable\n\nfunc String(sourceParam string, dest *string) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-String","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Strings","content":"Strings binds parameter values to slice of string\n\nfunc Strings(sourceParam string, dest *[]string) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Strings","tab":"API Reference","category":"go method"},{"title":"ValueBinder.TextUnmarshaler","content":"TextUnmarshaler binds parameter to destination implementing encoding.TextUnmarshaler interface\n\nfunc TextUnmarshaler(sourceParam string, dest encoding.TextUnmarshaler) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-TextUnmarshaler","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Time","content":"Time binds parameter to time.Time variable\n\nfunc Time(sourceParam string, dest *time.Time, layout string) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Time","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Times","content":"Times binds parameter values to slice of time.Time variables\n\nfunc Times(sourceParam string, dest *[]time.Time, layout string) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Times","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Uint","content":"Uint binds parameter to uint variable\n\nfunc Uint(sourceParam string, dest *uint) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Uint","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Uint16","content":"Uint16 binds parameter to uint16 variable\n\nfunc Uint16(sourceParam string, dest *uint16) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Uint16","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Uint16s","content":"Uint16s binds parameter to slice of uint16\n\nfunc Uint16s(sourceParam string, dest *[]uint16) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Uint16s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Uint32","content":"Uint32 binds parameter to uint32 variable\n\nfunc Uint32(sourceParam string, dest *uint32) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Uint32","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Uint32s","content":"Uint32s binds parameter to slice of uint32\n\nfunc Uint32s(sourceParam string, dest *[]uint32) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Uint32s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Uint64","content":"Uint64 binds parameter to uint64 variable\n\nfunc Uint64(sourceParam string, dest *uint64) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Uint64","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Uint64s","content":"Uint64s binds parameter to slice of uint64\n\nfunc Uint64s(sourceParam string, dest *[]uint64) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Uint64s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Uint8","content":"Uint8 binds parameter to uint8 variable\n\nfunc Uint8(sourceParam string, dest *uint8) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Uint8","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Uint8s","content":"Uint8s binds parameter to slice of uint8\n\nfunc Uint8s(sourceParam string, dest *[]uint8) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Uint8s","tab":"API Reference","category":"go method"},{"title":"ValueBinder.Uints","content":"Uints binds parameter to slice of uint\n\nfunc Uints(sourceParam string, dest *[]uint) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-Uints","tab":"API Reference","category":"go method"},{"title":"ValueBinder.UnixTime","content":"UnixTime binds parameter to time.Time variable (in local Time corresponding to the given Unix time).\n\nExample: 1609180603 bind to 2020-12-28T18:36:43.000000000+00:00\n\nNote:\n - time.Time{} (param is empty) and time.Unix(0,0) (param = \"0\") are not equal\n\nfunc UnixTime(sourceParam string, dest *time.Time) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-UnixTime","tab":"API Reference","category":"go method"},{"title":"ValueBinder.UnixTimeMilli","content":"UnixTimeMilli binds parameter to time.Time variable (in local time corresponding to the given Unix time in millisecond precision).\n\nExample: 1647184410140 bind to 2022-03-13T15:13:30.140000000+00:00\n\nNote:\n - time.Time{} (param is empty) and time.Unix(0,0) (param = \"0\") are not equal\n\nfunc UnixTimeMilli(sourceParam string, dest *time.Time) *ValueBinder","url":"/api-reference/package-root.html#method-ValueBinder-UnixTimeMilli","tab":"API Reference","category":"go method"},{"title":"ValueBinder.UnixTimeNano","content":"UnixTimeNano binds parameter to time.Time variable (in local time corresponding to the given Unix time in nanosecond precision).\n\nExample: 1609180603123456789 binds to 2020-12-28T18:36:43.123456789+00:00\nExample: 1000000000 binds to 1970-01-01T00:00:01.000000000+00:00\nExample: 999999999 binds to 1970-01-01T00:00:00.999999999+00:00\n\nNote:\n - time.Time{} (param is empty) and time.Unix(0,0) (param = \"0\") are not equal\n - Javascript's Number type only has about 53 bits of precis","url":"/api-reference/package-root.html#method-ValueBinder-UnixTimeNano","tab":"API Reference","category":"go method"},{"title":"echotest","content":"github.com/labstack/echo/v5/echotest","url":"/api-reference/pkg-echotest.html","tab":"API Reference","category":"Pages"},{"title":"Functions","content":"echotest - Functions","url":"/api-reference/pkg-echotest.html#functions","tab":"API Reference","category":"Sections"},{"title":"LoadBytes","content":"echotest - LoadBytes","url":"/api-reference/pkg-echotest.html#func-LoadBytes","tab":"API Reference","category":"Sections"},{"title":"TrimNewlineEnd","content":"echotest - TrimNewlineEnd","url":"/api-reference/pkg-echotest.html#func-TrimNewlineEnd","tab":"API Reference","category":"Sections"},{"title":"Types","content":"echotest - Types","url":"/api-reference/pkg-echotest.html#types","tab":"API Reference","category":"Sections"},{"title":"ContextConfig","content":"echotest - ContextConfig","url":"/api-reference/pkg-echotest.html#type-ContextConfig","tab":"API Reference","category":"Sections"},{"title":"MultipartForm","content":"echotest - MultipartForm","url":"/api-reference/pkg-echotest.html#type-MultipartForm","tab":"API Reference","category":"Sections"},{"title":"MultipartFormFile","content":"echotest - MultipartFormFile","url":"/api-reference/pkg-echotest.html#type-MultipartFormFile","tab":"API Reference","category":"Sections"},{"title":"func LoadBytes(t *testing.T, name string, opts ...loadBytesOpts) []byte","content":"LoadBytes is helper to load file contents relative to current (where test file is) package\ndirectory.\n\nfunc LoadBytes(t *testing.T, name string, opts ...loadBytesOpts) []byte","url":"/api-reference/pkg-echotest.html#func-LoadBytes","tab":"API Reference","category":"go function"},{"title":"func TrimNewlineEnd(bytes []byte) []byte","content":"TrimNewlineEnd instructs LoadBytes to remove `\\n` from the end of loaded file.\n\nfunc TrimNewlineEnd(bytes []byte) []byte","url":"/api-reference/pkg-echotest.html#func-TrimNewlineEnd","tab":"API Reference","category":"go function"},{"title":"type ContextConfig","content":"ContextConfig is configuration for creating echo.Context for testing purposes.\n\ntype ContextConfig struct {\n\t// Request will be used instead of default `httptest.NewRequest(http.MethodGet, \"/\", nil)`\n\tRequest *http.Request\n\n\t// Response will be used instead of default `httptest.NewRecorder()`\n\tResponse *httptest.ResponseRecorder\n\n\t// QueryValues will be set as Request.URL.RawQuery value\n\tQueryValues url.Values\n\n\t// Headers will be set as Request.Header value\n\tHeaders http.Header\n\n\t// PathValues ","url":"/api-reference/pkg-echotest.html#type-ContextConfig","tab":"API Reference","category":"go type"},{"title":"ContextConfig.ServeWithHandler","content":"ServeWithHandler serves ContextConfig with given handler and returns httptest.ResponseRecorder for response checking\n\nfunc ServeWithHandler(t *testing.T, handler echo.HandlerFunc, opts ...any) *httptest.ResponseRecorder","url":"/api-reference/pkg-echotest.html#method-ContextConfig-ServeWithHandler","tab":"API Reference","category":"go method"},{"title":"ContextConfig.ToContext","content":"ToContext converts ContextConfig to echo.Context\n\nfunc ToContext(t *testing.T) *echo.Context","url":"/api-reference/pkg-echotest.html#method-ContextConfig-ToContext","tab":"API Reference","category":"go method"},{"title":"ContextConfig.ToContextRecorder","content":"ToContextRecorder converts ContextConfig to echo.Context and httptest.ResponseRecorder\n\nfunc ToContextRecorder(t *testing.T) (*echo.Context, *httptest.ResponseRecorder)","url":"/api-reference/pkg-echotest.html#method-ContextConfig-ToContextRecorder","tab":"API Reference","category":"go method"},{"title":"type MultipartForm","content":"MultipartForm is used to create multipart form out of given value\n\ntype MultipartForm struct {\n\tFields map[string]string\n\tFiles []MultipartFormFile\n}","url":"/api-reference/pkg-echotest.html#type-MultipartForm","tab":"API Reference","category":"go type"},{"title":"type MultipartFormFile","content":"MultipartFormFile is used to create file in multipart form out of given value\n\ntype MultipartFormFile struct {\n\tFieldname string\n\tFilename string\n\tContent []byte\n}","url":"/api-reference/pkg-echotest.html#type-MultipartFormFile","tab":"API Reference","category":"go type"},{"title":"middleware","content":"github.com/labstack/echo/v5/middleware","url":"/api-reference/pkg-middleware.html","tab":"API Reference","category":"Pages"},{"title":"Constants","content":"middleware - Constants","url":"/api-reference/pkg-middleware.html#constants","tab":"API Reference","category":"Sections"},{"title":"Variables","content":"middleware - Variables","url":"/api-reference/pkg-middleware.html#variables","tab":"API Reference","category":"Sections"},{"title":"Functions","content":"middleware - Functions","url":"/api-reference/pkg-middleware.html#functions","tab":"API Reference","category":"Sections"},{"title":"AddTrailingSlash","content":"middleware - AddTrailingSlash","url":"/api-reference/pkg-middleware.html#func-AddTrailingSlash","tab":"API Reference","category":"Sections"},{"title":"AddTrailingSlashWithConfig","content":"middleware - AddTrailingSlashWithConfig","url":"/api-reference/pkg-middleware.html#func-AddTrailingSlashWithConfig","tab":"API Reference","category":"Sections"},{"title":"BasicAuth","content":"middleware - BasicAuth","url":"/api-reference/pkg-middleware.html#func-BasicAuth","tab":"API Reference","category":"Sections"},{"title":"BasicAuthWithConfig","content":"middleware - BasicAuthWithConfig","url":"/api-reference/pkg-middleware.html#func-BasicAuthWithConfig","tab":"API Reference","category":"Sections"},{"title":"BodyDump","content":"middleware - BodyDump","url":"/api-reference/pkg-middleware.html#func-BodyDump","tab":"API Reference","category":"Sections"},{"title":"BodyDumpWithConfig","content":"middleware - BodyDumpWithConfig","url":"/api-reference/pkg-middleware.html#func-BodyDumpWithConfig","tab":"API Reference","category":"Sections"},{"title":"BodyLimit","content":"middleware - BodyLimit","url":"/api-reference/pkg-middleware.html#func-BodyLimit","tab":"API Reference","category":"Sections"},{"title":"BodyLimitWithConfig","content":"middleware - BodyLimitWithConfig","url":"/api-reference/pkg-middleware.html#func-BodyLimitWithConfig","tab":"API Reference","category":"Sections"},{"title":"CORS","content":"middleware - CORS","url":"/api-reference/pkg-middleware.html#func-CORS","tab":"API Reference","category":"Sections"},{"title":"CORSWithConfig","content":"middleware - CORSWithConfig","url":"/api-reference/pkg-middleware.html#func-CORSWithConfig","tab":"API Reference","category":"Sections"},{"title":"CSRF","content":"middleware - CSRF","url":"/api-reference/pkg-middleware.html#func-CSRF","tab":"API Reference","category":"Sections"},{"title":"CSRFWithConfig","content":"middleware - CSRFWithConfig","url":"/api-reference/pkg-middleware.html#func-CSRFWithConfig","tab":"API Reference","category":"Sections"},{"title":"ContextTimeout","content":"middleware - ContextTimeout","url":"/api-reference/pkg-middleware.html#func-ContextTimeout","tab":"API Reference","category":"Sections"},{"title":"ContextTimeoutWithConfig","content":"middleware - ContextTimeoutWithConfig","url":"/api-reference/pkg-middleware.html#func-ContextTimeoutWithConfig","tab":"API Reference","category":"Sections"},{"title":"CreateExtractors","content":"middleware - CreateExtractors","url":"/api-reference/pkg-middleware.html#func-CreateExtractors","tab":"API Reference","category":"Sections"},{"title":"Decompress","content":"middleware - Decompress","url":"/api-reference/pkg-middleware.html#func-Decompress","tab":"API Reference","category":"Sections"},{"title":"DecompressWithConfig","content":"middleware - DecompressWithConfig","url":"/api-reference/pkg-middleware.html#func-DecompressWithConfig","tab":"API Reference","category":"Sections"},{"title":"DefaultSkipper","content":"middleware - DefaultSkipper","url":"/api-reference/pkg-middleware.html#func-DefaultSkipper","tab":"API Reference","category":"Sections"},{"title":"Gzip","content":"middleware - Gzip","url":"/api-reference/pkg-middleware.html#func-Gzip","tab":"API Reference","category":"Sections"},{"title":"GzipWithConfig","content":"middleware - GzipWithConfig","url":"/api-reference/pkg-middleware.html#func-GzipWithConfig","tab":"API Reference","category":"Sections"},{"title":"HTTPSNonWWWRedirect","content":"middleware - HTTPSNonWWWRedirect","url":"/api-reference/pkg-middleware.html#func-HTTPSNonWWWRedirect","tab":"API Reference","category":"Sections"},{"title":"HTTPSNonWWWRedirectWithConfig","content":"middleware - HTTPSNonWWWRedirectWithConfig","url":"/api-reference/pkg-middleware.html#func-HTTPSNonWWWRedirectWithConfig","tab":"API Reference","category":"Sections"},{"title":"HTTPSRedirect","content":"middleware - HTTPSRedirect","url":"/api-reference/pkg-middleware.html#func-HTTPSRedirect","tab":"API Reference","category":"Sections"},{"title":"HTTPSRedirectWithConfig","content":"middleware - HTTPSRedirectWithConfig","url":"/api-reference/pkg-middleware.html#func-HTTPSRedirectWithConfig","tab":"API Reference","category":"Sections"},{"title":"HTTPSWWWRedirect","content":"middleware - HTTPSWWWRedirect","url":"/api-reference/pkg-middleware.html#func-HTTPSWWWRedirect","tab":"API Reference","category":"Sections"},{"title":"HTTPSWWWRedirectWithConfig","content":"middleware - HTTPSWWWRedirectWithConfig","url":"/api-reference/pkg-middleware.html#func-HTTPSWWWRedirectWithConfig","tab":"API Reference","category":"Sections"},{"title":"KeyAuth","content":"middleware - KeyAuth","url":"/api-reference/pkg-middleware.html#func-KeyAuth","tab":"API Reference","category":"Sections"},{"title":"KeyAuthWithConfig","content":"middleware - KeyAuthWithConfig","url":"/api-reference/pkg-middleware.html#func-KeyAuthWithConfig","tab":"API Reference","category":"Sections"},{"title":"MethodFromForm","content":"middleware - MethodFromForm","url":"/api-reference/pkg-middleware.html#func-MethodFromForm","tab":"API Reference","category":"Sections"},{"title":"MethodFromHeader","content":"middleware - MethodFromHeader","url":"/api-reference/pkg-middleware.html#func-MethodFromHeader","tab":"API Reference","category":"Sections"},{"title":"MethodFromQuery","content":"middleware - MethodFromQuery","url":"/api-reference/pkg-middleware.html#func-MethodFromQuery","tab":"API Reference","category":"Sections"},{"title":"MethodOverride","content":"middleware - MethodOverride","url":"/api-reference/pkg-middleware.html#func-MethodOverride","tab":"API Reference","category":"Sections"},{"title":"MethodOverrideWithConfig","content":"middleware - MethodOverrideWithConfig","url":"/api-reference/pkg-middleware.html#func-MethodOverrideWithConfig","tab":"API Reference","category":"Sections"},{"title":"NewRandomBalancer","content":"middleware - NewRandomBalancer","url":"/api-reference/pkg-middleware.html#func-NewRandomBalancer","tab":"API Reference","category":"Sections"},{"title":"NewRateLimiterMemoryStore","content":"middleware - NewRateLimiterMemoryStore","url":"/api-reference/pkg-middleware.html#func-NewRateLimiterMemoryStore","tab":"API Reference","category":"Sections"},{"title":"NewRateLimiterMemoryStoreWithConfig","content":"middleware - NewRateLimiterMemoryStoreWithConfig","url":"/api-reference/pkg-middleware.html#func-NewRateLimiterMemoryStoreWithConfig","tab":"API Reference","category":"Sections"},{"title":"NewRoundRobinBalancer","content":"middleware - NewRoundRobinBalancer","url":"/api-reference/pkg-middleware.html#func-NewRoundRobinBalancer","tab":"API Reference","category":"Sections"},{"title":"NonWWWRedirect","content":"middleware - NonWWWRedirect","url":"/api-reference/pkg-middleware.html#func-NonWWWRedirect","tab":"API Reference","category":"Sections"},{"title":"NonWWWRedirectWithConfig","content":"middleware - NonWWWRedirectWithConfig","url":"/api-reference/pkg-middleware.html#func-NonWWWRedirectWithConfig","tab":"API Reference","category":"Sections"},{"title":"Proxy","content":"middleware - Proxy","url":"/api-reference/pkg-middleware.html#func-Proxy","tab":"API Reference","category":"Sections"},{"title":"ProxyWithConfig","content":"middleware - ProxyWithConfig","url":"/api-reference/pkg-middleware.html#func-ProxyWithConfig","tab":"API Reference","category":"Sections"},{"title":"RateLimiter","content":"middleware - RateLimiter","url":"/api-reference/pkg-middleware.html#func-RateLimiter","tab":"API Reference","category":"Sections"},{"title":"RateLimiterWithConfig","content":"middleware - RateLimiterWithConfig","url":"/api-reference/pkg-middleware.html#func-RateLimiterWithConfig","tab":"API Reference","category":"Sections"},{"title":"Recover","content":"middleware - Recover","url":"/api-reference/pkg-middleware.html#func-Recover","tab":"API Reference","category":"Sections"},{"title":"RecoverWithConfig","content":"middleware - RecoverWithConfig","url":"/api-reference/pkg-middleware.html#func-RecoverWithConfig","tab":"API Reference","category":"Sections"},{"title":"RemoveTrailingSlash","content":"middleware - RemoveTrailingSlash","url":"/api-reference/pkg-middleware.html#func-RemoveTrailingSlash","tab":"API Reference","category":"Sections"},{"title":"RemoveTrailingSlashWithConfig","content":"middleware - RemoveTrailingSlashWithConfig","url":"/api-reference/pkg-middleware.html#func-RemoveTrailingSlashWithConfig","tab":"API Reference","category":"Sections"},{"title":"RequestID","content":"middleware - RequestID","url":"/api-reference/pkg-middleware.html#func-RequestID","tab":"API Reference","category":"Sections"},{"title":"RequestIDWithConfig","content":"middleware - RequestIDWithConfig","url":"/api-reference/pkg-middleware.html#func-RequestIDWithConfig","tab":"API Reference","category":"Sections"},{"title":"RequestLogger","content":"middleware - RequestLogger","url":"/api-reference/pkg-middleware.html#func-RequestLogger","tab":"API Reference","category":"Sections"},{"title":"RequestLoggerWithConfig","content":"middleware - RequestLoggerWithConfig","url":"/api-reference/pkg-middleware.html#func-RequestLoggerWithConfig","tab":"API Reference","category":"Sections"},{"title":"Rewrite","content":"middleware - Rewrite","url":"/api-reference/pkg-middleware.html#func-Rewrite","tab":"API Reference","category":"Sections"},{"title":"RewriteWithConfig","content":"middleware - RewriteWithConfig","url":"/api-reference/pkg-middleware.html#func-RewriteWithConfig","tab":"API Reference","category":"Sections"},{"title":"Secure","content":"middleware - Secure","url":"/api-reference/pkg-middleware.html#func-Secure","tab":"API Reference","category":"Sections"},{"title":"SecureWithConfig","content":"middleware - SecureWithConfig","url":"/api-reference/pkg-middleware.html#func-SecureWithConfig","tab":"API Reference","category":"Sections"},{"title":"Static","content":"middleware - Static","url":"/api-reference/pkg-middleware.html#func-Static","tab":"API Reference","category":"Sections"},{"title":"StaticWithConfig","content":"middleware - StaticWithConfig","url":"/api-reference/pkg-middleware.html#func-StaticWithConfig","tab":"API Reference","category":"Sections"},{"title":"WWWRedirect","content":"middleware - WWWRedirect","url":"/api-reference/pkg-middleware.html#func-WWWRedirect","tab":"API Reference","category":"Sections"},{"title":"WWWRedirectWithConfig","content":"middleware - WWWRedirectWithConfig","url":"/api-reference/pkg-middleware.html#func-WWWRedirectWithConfig","tab":"API Reference","category":"Sections"},{"title":"Types","content":"middleware - Types","url":"/api-reference/pkg-middleware.html#types","tab":"API Reference","category":"Sections"},{"title":"AddTrailingSlashConfig","content":"middleware - AddTrailingSlashConfig","url":"/api-reference/pkg-middleware.html#type-AddTrailingSlashConfig","tab":"API Reference","category":"Sections"},{"title":"BasicAuthConfig","content":"middleware - BasicAuthConfig","url":"/api-reference/pkg-middleware.html#type-BasicAuthConfig","tab":"API Reference","category":"Sections"},{"title":"BasicAuthValidator","content":"middleware - BasicAuthValidator","url":"/api-reference/pkg-middleware.html#type-BasicAuthValidator","tab":"API Reference","category":"Sections"},{"title":"BeforeFunc","content":"middleware - BeforeFunc","url":"/api-reference/pkg-middleware.html#type-BeforeFunc","tab":"API Reference","category":"Sections"},{"title":"BodyDumpConfig","content":"middleware - BodyDumpConfig","url":"/api-reference/pkg-middleware.html#type-BodyDumpConfig","tab":"API Reference","category":"Sections"},{"title":"BodyDumpHandler","content":"middleware - BodyDumpHandler","url":"/api-reference/pkg-middleware.html#type-BodyDumpHandler","tab":"API Reference","category":"Sections"},{"title":"BodyLimitConfig","content":"middleware - BodyLimitConfig","url":"/api-reference/pkg-middleware.html#type-BodyLimitConfig","tab":"API Reference","category":"Sections"},{"title":"CORSConfig","content":"middleware - CORSConfig","url":"/api-reference/pkg-middleware.html#type-CORSConfig","tab":"API Reference","category":"Sections"},{"title":"CSRFConfig","content":"middleware - CSRFConfig","url":"/api-reference/pkg-middleware.html#type-CSRFConfig","tab":"API Reference","category":"Sections"},{"title":"ContextTimeoutConfig","content":"middleware - ContextTimeoutConfig","url":"/api-reference/pkg-middleware.html#type-ContextTimeoutConfig","tab":"API Reference","category":"Sections"},{"title":"DecompressConfig","content":"middleware - DecompressConfig","url":"/api-reference/pkg-middleware.html#type-DecompressConfig","tab":"API Reference","category":"Sections"},{"title":"Decompressor","content":"middleware - Decompressor","url":"/api-reference/pkg-middleware.html#type-Decompressor","tab":"API Reference","category":"Sections"},{"title":"DefaultGzipDecompressPool","content":"middleware - DefaultGzipDecompressPool","url":"/api-reference/pkg-middleware.html#type-DefaultGzipDecompressPool","tab":"API Reference","category":"Sections"},{"title":"Extractor","content":"middleware - Extractor","url":"/api-reference/pkg-middleware.html#type-Extractor","tab":"API Reference","category":"Sections"},{"title":"ExtractorSource","content":"middleware - ExtractorSource","url":"/api-reference/pkg-middleware.html#type-ExtractorSource","tab":"API Reference","category":"Sections"},{"title":"GzipConfig","content":"middleware - GzipConfig","url":"/api-reference/pkg-middleware.html#type-GzipConfig","tab":"API Reference","category":"Sections"},{"title":"KeyAuthConfig","content":"middleware - KeyAuthConfig","url":"/api-reference/pkg-middleware.html#type-KeyAuthConfig","tab":"API Reference","category":"Sections"},{"title":"KeyAuthErrorHandler","content":"middleware - KeyAuthErrorHandler","url":"/api-reference/pkg-middleware.html#type-KeyAuthErrorHandler","tab":"API Reference","category":"Sections"},{"title":"KeyAuthValidator","content":"middleware - KeyAuthValidator","url":"/api-reference/pkg-middleware.html#type-KeyAuthValidator","tab":"API Reference","category":"Sections"},{"title":"MethodOverrideConfig","content":"middleware - MethodOverrideConfig","url":"/api-reference/pkg-middleware.html#type-MethodOverrideConfig","tab":"API Reference","category":"Sections"},{"title":"MethodOverrideGetter","content":"middleware - MethodOverrideGetter","url":"/api-reference/pkg-middleware.html#type-MethodOverrideGetter","tab":"API Reference","category":"Sections"},{"title":"PanicStackError","content":"middleware - PanicStackError","url":"/api-reference/pkg-middleware.html#type-PanicStackError","tab":"API Reference","category":"Sections"},{"title":"ProxyBalancer","content":"middleware - ProxyBalancer","url":"/api-reference/pkg-middleware.html#type-ProxyBalancer","tab":"API Reference","category":"Sections"},{"title":"ProxyConfig","content":"middleware - ProxyConfig","url":"/api-reference/pkg-middleware.html#type-ProxyConfig","tab":"API Reference","category":"Sections"},{"title":"ProxyTarget","content":"middleware - ProxyTarget","url":"/api-reference/pkg-middleware.html#type-ProxyTarget","tab":"API Reference","category":"Sections"},{"title":"RateLimiterConfig","content":"middleware - RateLimiterConfig","url":"/api-reference/pkg-middleware.html#type-RateLimiterConfig","tab":"API Reference","category":"Sections"},{"title":"RateLimiterMemoryStore","content":"middleware - RateLimiterMemoryStore","url":"/api-reference/pkg-middleware.html#type-RateLimiterMemoryStore","tab":"API Reference","category":"Sections"},{"title":"RateLimiterMemoryStoreConfig","content":"middleware - RateLimiterMemoryStoreConfig","url":"/api-reference/pkg-middleware.html#type-RateLimiterMemoryStoreConfig","tab":"API Reference","category":"Sections"},{"title":"RateLimiterStore","content":"middleware - RateLimiterStore","url":"/api-reference/pkg-middleware.html#type-RateLimiterStore","tab":"API Reference","category":"Sections"},{"title":"RateLimiterStoreContext","content":"middleware - RateLimiterStoreContext","url":"/api-reference/pkg-middleware.html#type-RateLimiterStoreContext","tab":"API Reference","category":"Sections"},{"title":"RecoverConfig","content":"middleware - RecoverConfig","url":"/api-reference/pkg-middleware.html#type-RecoverConfig","tab":"API Reference","category":"Sections"},{"title":"RedirectConfig","content":"middleware - RedirectConfig","url":"/api-reference/pkg-middleware.html#type-RedirectConfig","tab":"API Reference","category":"Sections"},{"title":"RemoveTrailingSlashConfig","content":"middleware - RemoveTrailingSlashConfig","url":"/api-reference/pkg-middleware.html#type-RemoveTrailingSlashConfig","tab":"API Reference","category":"Sections"},{"title":"RequestIDConfig","content":"middleware - RequestIDConfig","url":"/api-reference/pkg-middleware.html#type-RequestIDConfig","tab":"API Reference","category":"Sections"},{"title":"RequestLoggerConfig","content":"middleware - RequestLoggerConfig","url":"/api-reference/pkg-middleware.html#type-RequestLoggerConfig","tab":"API Reference","category":"Sections"},{"title":"RequestLoggerValues","content":"middleware - RequestLoggerValues","url":"/api-reference/pkg-middleware.html#type-RequestLoggerValues","tab":"API Reference","category":"Sections"},{"title":"RewriteConfig","content":"middleware - RewriteConfig","url":"/api-reference/pkg-middleware.html#type-RewriteConfig","tab":"API Reference","category":"Sections"},{"title":"SecureConfig","content":"middleware - SecureConfig","url":"/api-reference/pkg-middleware.html#type-SecureConfig","tab":"API Reference","category":"Sections"},{"title":"Skipper","content":"middleware - Skipper","url":"/api-reference/pkg-middleware.html#type-Skipper","tab":"API Reference","category":"Sections"},{"title":"StaticConfig","content":"middleware - StaticConfig","url":"/api-reference/pkg-middleware.html#type-StaticConfig","tab":"API Reference","category":"Sections"},{"title":"ValueExtractorError","content":"middleware - ValueExtractorError","url":"/api-reference/pkg-middleware.html#type-ValueExtractorError","tab":"API Reference","category":"Sections"},{"title":"ValuesExtractor","content":"middleware - ValuesExtractor","url":"/api-reference/pkg-middleware.html#type-ValuesExtractor","tab":"API Reference","category":"Sections"},{"title":"Visitor","content":"middleware - Visitor","url":"/api-reference/pkg-middleware.html#type-Visitor","tab":"API Reference","category":"Sections"},{"title":"const HeaderXRateLimitLimit","content":"Rate limit response headers set by stores that implement RateLimiterStoreContext.\n\nconst (\n\tHeaderXRateLimitLimit = \"X-RateLimit-Limit\"\n\tHeaderXRateLimitRemaining = \"X-RateLimit-Remaining\"\n)","url":"/api-reference/pkg-middleware.html#const-HeaderXRateLimitLimit","tab":"API Reference","category":"go constant"},{"title":"const HeaderXRateLimitRemaining","content":"Rate limit response headers set by stores that implement RateLimiterStoreContext.\n\nconst (\n\tHeaderXRateLimitLimit = \"X-RateLimit-Limit\"\n\tHeaderXRateLimitRemaining = \"X-RateLimit-Remaining\"\n)","url":"/api-reference/pkg-middleware.html#const-HeaderXRateLimitRemaining","tab":"API Reference","category":"go constant"},{"title":"const KB","content":"const (\n\n\t// KB is 1 KiloByte = 1024 bytes\n\tKB\n\t// MB is 1 Megabyte = 1_048_576 bytes\n\tMB\n\t// GB is 1 Gigabyte = 1_073_741_824 bytes\n\tGB\n\t// TB is 1 Terabyte = 1_099_511_627_776 bytes\n\tTB\n\t// PB is 1 Petabyte = 1_125_899_906_842_624 bytes\n\tPB\n\t// EB is 1 Exabyte = 1_152_921_504_606_847_000 bytes\n\tEB\n)","url":"/api-reference/pkg-middleware.html#const-KB","tab":"API Reference","category":"go constant"},{"title":"const MB","content":"const (\n\n\t// KB is 1 KiloByte = 1024 bytes\n\tKB\n\t// MB is 1 Megabyte = 1_048_576 bytes\n\tMB\n\t// GB is 1 Gigabyte = 1_073_741_824 bytes\n\tGB\n\t// TB is 1 Terabyte = 1_099_511_627_776 bytes\n\tTB\n\t// PB is 1 Petabyte = 1_125_899_906_842_624 bytes\n\tPB\n\t// EB is 1 Exabyte = 1_152_921_504_606_847_000 bytes\n\tEB\n)","url":"/api-reference/pkg-middleware.html#const-MB","tab":"API Reference","category":"go constant"},{"title":"const GB","content":"const (\n\n\t// KB is 1 KiloByte = 1024 bytes\n\tKB\n\t// MB is 1 Megabyte = 1_048_576 bytes\n\tMB\n\t// GB is 1 Gigabyte = 1_073_741_824 bytes\n\tGB\n\t// TB is 1 Terabyte = 1_099_511_627_776 bytes\n\tTB\n\t// PB is 1 Petabyte = 1_125_899_906_842_624 bytes\n\tPB\n\t// EB is 1 Exabyte = 1_152_921_504_606_847_000 bytes\n\tEB\n)","url":"/api-reference/pkg-middleware.html#const-GB","tab":"API Reference","category":"go constant"},{"title":"const TB","content":"const (\n\n\t// KB is 1 KiloByte = 1024 bytes\n\tKB\n\t// MB is 1 Megabyte = 1_048_576 bytes\n\tMB\n\t// GB is 1 Gigabyte = 1_073_741_824 bytes\n\tGB\n\t// TB is 1 Terabyte = 1_099_511_627_776 bytes\n\tTB\n\t// PB is 1 Petabyte = 1_125_899_906_842_624 bytes\n\tPB\n\t// EB is 1 Exabyte = 1_152_921_504_606_847_000 bytes\n\tEB\n)","url":"/api-reference/pkg-middleware.html#const-TB","tab":"API Reference","category":"go constant"},{"title":"const PB","content":"const (\n\n\t// KB is 1 KiloByte = 1024 bytes\n\tKB\n\t// MB is 1 Megabyte = 1_048_576 bytes\n\tMB\n\t// GB is 1 Gigabyte = 1_073_741_824 bytes\n\tGB\n\t// TB is 1 Terabyte = 1_099_511_627_776 bytes\n\tTB\n\t// PB is 1 Petabyte = 1_125_899_906_842_624 bytes\n\tPB\n\t// EB is 1 Exabyte = 1_152_921_504_606_847_000 bytes\n\tEB\n)","url":"/api-reference/pkg-middleware.html#const-PB","tab":"API Reference","category":"go constant"},{"title":"const EB","content":"const (\n\n\t// KB is 1 KiloByte = 1024 bytes\n\tKB\n\t// MB is 1 Megabyte = 1_048_576 bytes\n\tMB\n\t// GB is 1 Gigabyte = 1_073_741_824 bytes\n\tGB\n\t// TB is 1 Terabyte = 1_099_511_627_776 bytes\n\tTB\n\t// PB is 1 Petabyte = 1_125_899_906_842_624 bytes\n\tPB\n\t// EB is 1 Exabyte = 1_152_921_504_606_847_000 bytes\n\tEB\n)","url":"/api-reference/pkg-middleware.html#const-EB","tab":"API Reference","category":"go constant"},{"title":"const CSRFUsingSecFetchSite","content":"CSRFUsingSecFetchSite is a context key for CSRF middleware what is set when the client browser is using Sec-Fetch-Site\nheader and the request is deemed safe.\nIt is a dummy token value that can be used to render CSRF token for form by handlers.\n\nWe know that the client is using a browser that supports Sec-Fetch-Site header, so when the form is submitted in\nthe future with this dummy token value it is OK. Although the request is safe, the template rendered by the\nhandler may need this value to ren","url":"/api-reference/pkg-middleware.html#const-CSRFUsingSecFetchSite","tab":"API Reference","category":"go constant"},{"title":"const GZIPEncoding","content":"GZIPEncoding content-encoding header if set to \"gzip\", decompress body contents.\n\nconst GZIPEncoding string = \"gzip\"","url":"/api-reference/pkg-middleware.html#const-GZIPEncoding","tab":"API Reference","category":"go constant"},{"title":"const StatusCodeContextCanceled","content":"StatusCodeContextCanceled is a custom HTTP status code for situations\nwhere a client unexpectedly closed the connection to the server.\nAs there is no standard error code for \"client closed connection\", but\nvarious well-known HTTP clients and server implement this HTTP code we use\n499 too instead of the more problematic 5xx, which does not allow to detect this situation\n\nconst StatusCodeContextCanceled = 499","url":"/api-reference/pkg-middleware.html#const-StatusCodeContextCanceled","tab":"API Reference","category":"go constant"},{"title":"const ExtractorSourceHeader","content":"const (\n\t// ExtractorSourceHeader means value was extracted from request header\n\tExtractorSourceHeader ExtractorSource = \"header\"\n\t// ExtractorSourceQuery means value was extracted from request query parameters\n\tExtractorSourceQuery ExtractorSource = \"query\"\n\t// ExtractorSourcePathParam means value was extracted from route path parameters\n\tExtractorSourcePathParam ExtractorSource = \"param\"\n\t// ExtractorSourceCookie means value was extracted from request cookies\n\tExtractorSourceCookie ExtractorSo","url":"/api-reference/pkg-middleware.html#const-ExtractorSourceHeader","tab":"API Reference","category":"go constant"},{"title":"const ExtractorSourceQuery","content":"const (\n\t// ExtractorSourceHeader means value was extracted from request header\n\tExtractorSourceHeader ExtractorSource = \"header\"\n\t// ExtractorSourceQuery means value was extracted from request query parameters\n\tExtractorSourceQuery ExtractorSource = \"query\"\n\t// ExtractorSourcePathParam means value was extracted from route path parameters\n\tExtractorSourcePathParam ExtractorSource = \"param\"\n\t// ExtractorSourceCookie means value was extracted from request cookies\n\tExtractorSourceCookie ExtractorSo","url":"/api-reference/pkg-middleware.html#const-ExtractorSourceQuery","tab":"API Reference","category":"go constant"},{"title":"const ExtractorSourcePathParam","content":"const (\n\t// ExtractorSourceHeader means value was extracted from request header\n\tExtractorSourceHeader ExtractorSource = \"header\"\n\t// ExtractorSourceQuery means value was extracted from request query parameters\n\tExtractorSourceQuery ExtractorSource = \"query\"\n\t// ExtractorSourcePathParam means value was extracted from route path parameters\n\tExtractorSourcePathParam ExtractorSource = \"param\"\n\t// ExtractorSourceCookie means value was extracted from request cookies\n\tExtractorSourceCookie ExtractorSo","url":"/api-reference/pkg-middleware.html#const-ExtractorSourcePathParam","tab":"API Reference","category":"go constant"},{"title":"const ExtractorSourceCookie","content":"const (\n\t// ExtractorSourceHeader means value was extracted from request header\n\tExtractorSourceHeader ExtractorSource = \"header\"\n\t// ExtractorSourceQuery means value was extracted from request query parameters\n\tExtractorSourceQuery ExtractorSource = \"query\"\n\t// ExtractorSourcePathParam means value was extracted from route path parameters\n\tExtractorSourcePathParam ExtractorSource = \"param\"\n\t// ExtractorSourceCookie means value was extracted from request cookies\n\tExtractorSourceCookie ExtractorSo","url":"/api-reference/pkg-middleware.html#const-ExtractorSourceCookie","tab":"API Reference","category":"go constant"},{"title":"const ExtractorSourceForm","content":"const (\n\t// ExtractorSourceHeader means value was extracted from request header\n\tExtractorSourceHeader ExtractorSource = \"header\"\n\t// ExtractorSourceQuery means value was extracted from request query parameters\n\tExtractorSourceQuery ExtractorSource = \"query\"\n\t// ExtractorSourcePathParam means value was extracted from route path parameters\n\tExtractorSourcePathParam ExtractorSource = \"param\"\n\t// ExtractorSourceCookie means value was extracted from request cookies\n\tExtractorSourceCookie ExtractorSo","url":"/api-reference/pkg-middleware.html#const-ExtractorSourceForm","tab":"API Reference","category":"go constant"},{"title":"var DefaultCSRFConfig","content":"DefaultCSRFConfig is the default CSRF middleware config.\n\nvar DefaultCSRFConfig = CSRFConfig{\n\tSkipper: DefaultSkipper,\n\tTokenLength: 32,\n\tTokenLookup: \"header:\" + echo.HeaderXCSRFToken,\n\tContextKey: \"csrf\",\n\tCookieName: \"_csrf\",\n\tCookieMaxAge: 86400,\n\tCookieSameSite: http.SameSiteDefaultMode,\n}","url":"/api-reference/pkg-middleware.html#var-DefaultCSRFConfig","tab":"API Reference","category":"go variable"},{"title":"var DefaultKeyAuthConfig","content":"DefaultKeyAuthConfig is the default KeyAuth middleware config.\n\nvar DefaultKeyAuthConfig = KeyAuthConfig{\n\tSkipper: DefaultSkipper,\n\tKeyLookup: \"header:\" + echo.HeaderAuthorization + \":Bearer \",\n}","url":"/api-reference/pkg-middleware.html#var-DefaultKeyAuthConfig","tab":"API Reference","category":"go variable"},{"title":"var DefaultMethodOverrideConfig","content":"DefaultMethodOverrideConfig is the default MethodOverride middleware config.\n\nvar DefaultMethodOverrideConfig = MethodOverrideConfig{\n\tSkipper: DefaultSkipper,\n\tGetter: MethodFromHeader(echo.HeaderXHTTPMethodOverride),\n}","url":"/api-reference/pkg-middleware.html#var-DefaultMethodOverrideConfig","tab":"API Reference","category":"go variable"},{"title":"var DefaultProxyConfig","content":"DefaultProxyConfig is the default Proxy middleware config.\n\nvar DefaultProxyConfig = ProxyConfig{\n\tSkipper: DefaultSkipper,\n\tContextKey: \"target\",\n}","url":"/api-reference/pkg-middleware.html#var-DefaultProxyConfig","tab":"API Reference","category":"go variable"},{"title":"var DefaultRateLimiterConfig","content":"DefaultRateLimiterConfig defines default values for RateLimiterConfig\n\nvar DefaultRateLimiterConfig = RateLimiterConfig{\n\tSkipper: DefaultSkipper,\n\tIdentifierExtractor: func(ctx *echo.Context) (string, error) {\n\t\tid := ctx.RealIP()\n\t\treturn id, nil\n\t},\n\tErrorHandler: func(c *echo.Context, err error) error {\n\t\treturn ErrExtractorError.Wrap(err)\n\t},\n\tDenyHandler: func(c *echo.Context, identifier string, err error) error {\n\t\treturn ErrRateLimitExceeded.Wrap(err)\n\t},\n}","url":"/api-reference/pkg-middleware.html#var-DefaultRateLimiterConfig","tab":"API Reference","category":"go variable"},{"title":"var DefaultRateLimiterMemoryStoreConfig","content":"DefaultRateLimiterMemoryStoreConfig provides default configuration values for RateLimiterMemoryStore\n\nvar DefaultRateLimiterMemoryStoreConfig = RateLimiterMemoryStoreConfig{\n\tExpiresIn: 3 * time.Minute,\n}","url":"/api-reference/pkg-middleware.html#var-DefaultRateLimiterMemoryStoreConfig","tab":"API Reference","category":"go variable"},{"title":"var DefaultRecoverConfig","content":"DefaultRecoverConfig is the default Recover middleware config.\n\nvar DefaultRecoverConfig = RecoverConfig{\n\tSkipper: DefaultSkipper,\n\tStackSize: 4 << 10,\n\tDisableStackAll: false,\n\tDisablePrintStack: false,\n}","url":"/api-reference/pkg-middleware.html#var-DefaultRecoverConfig","tab":"API Reference","category":"go variable"},{"title":"var DefaultSecureConfig","content":"DefaultSecureConfig is the default Secure middleware config.\n\nvar DefaultSecureConfig = SecureConfig{\n\tSkipper: DefaultSkipper,\n\tXSSProtection: \"1; mode=block\",\n\tContentTypeNosniff: \"nosniff\",\n\tXFrameOptions: \"SAMEORIGIN\",\n\tHSTSPreloadEnabled: false,\n}","url":"/api-reference/pkg-middleware.html#var-DefaultSecureConfig","tab":"API Reference","category":"go variable"},{"title":"var DefaultStaticConfig","content":"DefaultStaticConfig is the default Static middleware config.\n\nvar DefaultStaticConfig = StaticConfig{\n\tSkipper: DefaultSkipper,\n\tIndex: \"index.html\",\n}","url":"/api-reference/pkg-middleware.html#var-DefaultStaticConfig","tab":"API Reference","category":"go variable"},{"title":"var ErrCSRFInvalid","content":"ErrCSRFInvalid is returned when CSRF check fails\n\nvar ErrCSRFInvalid = &echo.HTTPError{Code: http.StatusForbidden, Message: \"invalid csrf token\"}","url":"/api-reference/pkg-middleware.html#var-ErrCSRFInvalid","tab":"API Reference","category":"go variable"},{"title":"var ErrExtractorError","content":"ErrExtractorError denotes an error raised when extractor function is unsuccessful\n\nvar ErrExtractorError = echo.NewHTTPError(http.StatusForbidden, \"error while extracting identifier\")","url":"/api-reference/pkg-middleware.html#var-ErrExtractorError","tab":"API Reference","category":"go variable"},{"title":"var ErrInvalidKey","content":"ErrInvalidKey denotes an error raised when key value is invalid by validator\n\nvar ErrInvalidKey = echo.NewHTTPError(http.StatusUnauthorized, \"invalid key\")","url":"/api-reference/pkg-middleware.html#var-ErrInvalidKey","tab":"API Reference","category":"go variable"},{"title":"var ErrKeyMissing","content":"ErrKeyMissing denotes an error raised when key value could not be extracted from request\n\nvar ErrKeyMissing = echo.NewHTTPError(http.StatusUnauthorized, \"missing key\")","url":"/api-reference/pkg-middleware.html#var-ErrKeyMissing","tab":"API Reference","category":"go variable"},{"title":"var ErrRateLimitExceeded","content":"ErrRateLimitExceeded denotes an error raised when rate limit is exceeded\n\nvar ErrRateLimitExceeded = echo.NewHTTPError(http.StatusTooManyRequests, \"rate limit exceeded\")","url":"/api-reference/pkg-middleware.html#var-ErrRateLimitExceeded","tab":"API Reference","category":"go variable"},{"title":"var RedirectHTTPSConfig","content":"RedirectHTTPSConfig is the HTTPS Redirect middleware config.\n\nvar RedirectHTTPSConfig = RedirectConfig{/* contains filtered or unexported fields */}","url":"/api-reference/pkg-middleware.html#var-RedirectHTTPSConfig","tab":"API Reference","category":"go variable"},{"title":"var RedirectHTTPSWWWConfig","content":"RedirectHTTPSWWWConfig is the HTTPS WWW Redirect middleware config.\n\nvar RedirectHTTPSWWWConfig = RedirectConfig{/* contains filtered or unexported fields */}","url":"/api-reference/pkg-middleware.html#var-RedirectHTTPSWWWConfig","tab":"API Reference","category":"go variable"},{"title":"var RedirectNonHTTPSWWWConfig","content":"RedirectNonHTTPSWWWConfig is the non HTTPS WWW Redirect middleware config.\n\nvar RedirectNonHTTPSWWWConfig = RedirectConfig{/* contains filtered or unexported fields */}","url":"/api-reference/pkg-middleware.html#var-RedirectNonHTTPSWWWConfig","tab":"API Reference","category":"go variable"},{"title":"var RedirectNonWWWConfig","content":"RedirectNonWWWConfig is the non WWW Redirect middleware config.\n\nvar RedirectNonWWWConfig = RedirectConfig{/* contains filtered or unexported fields */}","url":"/api-reference/pkg-middleware.html#var-RedirectNonWWWConfig","tab":"API Reference","category":"go variable"},{"title":"var RedirectWWWConfig","content":"RedirectWWWConfig is the WWW Redirect middleware config.\n\nvar RedirectWWWConfig = RedirectConfig{/* contains filtered or unexported fields */}","url":"/api-reference/pkg-middleware.html#var-RedirectWWWConfig","tab":"API Reference","category":"go variable"},{"title":"func AddTrailingSlash() echo.MiddlewareFunc","content":"AddTrailingSlash returns a root level (before router) middleware which adds a\ntrailing slash to the request `URL#Path`.\n\nUsage `Echo#Pre(AddTrailingSlash())`\n\nfunc AddTrailingSlash() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-AddTrailingSlash","tab":"API Reference","category":"go function"},{"title":"func AddTrailingSlashWithConfig(config AddTrailingSlashConfig) echo.MiddlewareFunc","content":"AddTrailingSlashWithConfig returns an AddTrailingSlash middleware with config or panics on invalid configuration.\n\nfunc AddTrailingSlashWithConfig(config AddTrailingSlashConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-AddTrailingSlashWithConfig","tab":"API Reference","category":"go function"},{"title":"func BasicAuth(fn BasicAuthValidator) echo.MiddlewareFunc","content":"BasicAuth returns an BasicAuth middleware.\n\nFor valid credentials it calls the next handler.\nFor missing or invalid credentials, it sends \"401 - Unauthorized\" response.\n\nfunc BasicAuth(fn BasicAuthValidator) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-BasicAuth","tab":"API Reference","category":"go function"},{"title":"func BasicAuthWithConfig(config BasicAuthConfig) echo.MiddlewareFunc","content":"BasicAuthWithConfig returns an BasicAuthWithConfig middleware with config.\n\nfunc BasicAuthWithConfig(config BasicAuthConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-BasicAuthWithConfig","tab":"API Reference","category":"go function"},{"title":"func BodyDump(handler BodyDumpHandler) echo.MiddlewareFunc","content":"BodyDump returns a BodyDump middleware.\n\nBodyDump middleware captures the request and response payload and calls the\nregistered handler.\n\nSECURITY: By default, this limits dumped bodies to 5MB to prevent memory exhaustion\nattacks. To customize limits, use BodyDumpWithConfig. To disable limits (not recommended\nin production), explicitly set MaxRequestBytes and MaxResponseBytes to -1.\n\nfunc BodyDump(handler BodyDumpHandler) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-BodyDump","tab":"API Reference","category":"go function"},{"title":"func BodyDumpWithConfig(config BodyDumpConfig) echo.MiddlewareFunc","content":"BodyDumpWithConfig returns a BodyDump middleware with config.\nSee: `BodyDump()`.\n\nSECURITY: If MaxRequestBytes and MaxResponseBytes are not set (zero values), they default\nto 5MB each to prevent DoS attacks via large payloads. Set them explicitly to -1 to disable\nlimits if needed for your use case.\n\nfunc BodyDumpWithConfig(config BodyDumpConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-BodyDumpWithConfig","tab":"API Reference","category":"go function"},{"title":"func BodyLimit(limitBytes int64) echo.MiddlewareFunc","content":"BodyLimit returns a BodyLimit middleware.\n\nBodyLimit middleware sets the maximum allowed size for a request body, if the size exceeds the configured limit, it\nsends \"413 - Request Entity Too Large\" response. The BodyLimit is determined based on both `Content-Length` request\nheader and actual content read, which makes it super secure.\n\nfunc BodyLimit(limitBytes int64) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-BodyLimit","tab":"API Reference","category":"go function"},{"title":"func BodyLimitWithConfig(config BodyLimitConfig) echo.MiddlewareFunc","content":"BodyLimitWithConfig returns a BodyLimitWithConfig middleware. Middleware sets the maximum allowed size in bytes for\na request body, if the size exceeds the configured limit, it sends \"413 - Request Entity Too Large\" response.\nThe BodyLimitWithConfig is determined based on both `Content-Length` request header and actual content read, which\nmakes it super secure.\n\nfunc BodyLimitWithConfig(config BodyLimitConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-BodyLimitWithConfig","tab":"API Reference","category":"go function"},{"title":"func CORS(allowOrigins ...string) echo.MiddlewareFunc","content":"CORS returns a Cross-Origin Resource Sharing (CORS) middleware.\nSee also [MDN: Cross-Origin Resource Sharing (CORS)].\n\nOrigin consist of following parts: `scheme + \"://\" + host + optional \":\" + port`\nWildcard `*` can be used, but has to be set explicitly.\nExample: `https://example.com`, `http://example.com:8080`, `*`\n\nSecurity: Poorly configured CORS can compromise security because it allows\nrelaxation of the browser's Same-Origin policy. See [Exploiting CORS\nmisconfigurations for Bitcoins and ","url":"/api-reference/pkg-middleware.html#func-CORS","tab":"API Reference","category":"go function"},{"title":"func CORSWithConfig(config CORSConfig) echo.MiddlewareFunc","content":"CORSWithConfig returns a CORS middleware with config or panics on invalid configuration.\nSee: [CORS].\n\nfunc CORSWithConfig(config CORSConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-CORSWithConfig","tab":"API Reference","category":"go function"},{"title":"func CSRF() echo.MiddlewareFunc","content":"CSRF returns a Cross-Site Request Forgery (CSRF) middleware.\nSee: https://en.wikipedia.org/wiki/Cross-site_request_forgery\n\nfunc CSRF() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-CSRF","tab":"API Reference","category":"go function"},{"title":"func CSRFWithConfig(config CSRFConfig) echo.MiddlewareFunc","content":"CSRFWithConfig returns a CSRF middleware with config or panics on invalid configuration.\n\nfunc CSRFWithConfig(config CSRFConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-CSRFWithConfig","tab":"API Reference","category":"go function"},{"title":"func ContextTimeout(timeout time.Duration) echo.MiddlewareFunc","content":"ContextTimeout returns a middleware which returns error (503 Service Unavailable error) to client\nwhen underlying method returns context.DeadlineExceeded error.\n\nfunc ContextTimeout(timeout time.Duration) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-ContextTimeout","tab":"API Reference","category":"go function"},{"title":"func ContextTimeoutWithConfig(config ContextTimeoutConfig) echo.MiddlewareFunc","content":"ContextTimeoutWithConfig returns a Timeout middleware with config.\n\nfunc ContextTimeoutWithConfig(config ContextTimeoutConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-ContextTimeoutWithConfig","tab":"API Reference","category":"go function"},{"title":"func CreateExtractors(lookups string, limit uint) ([]ValuesExtractor, error)","content":"CreateExtractors creates ValuesExtractors from given lookups.\nlookups is a string in the form of \":\" or \":,:\" that is used\nto extract key from the request.\nPossible values:\n - \"header:\" or \"header::\"\n `` is argument value to cut/trim prefix of the extracted value. This is useful if header\n value has static prefix like `Authorization: ` where part that we\n want to cut is","url":"/api-reference/pkg-middleware.html#func-CreateExtractors","tab":"API Reference","category":"go function"},{"title":"func Decompress() echo.MiddlewareFunc","content":"Decompress decompresses request body based if content encoding type is set to \"gzip\" with default config\n\nSECURITY: By default, this limits decompressed data to 100MB to prevent zip bomb attacks.\nTo customize the limit, use DecompressWithConfig. To disable limits (not recommended in production),\nset MaxDecompressedSize to -1.\n\nfunc Decompress() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-Decompress","tab":"API Reference","category":"go function"},{"title":"func DecompressWithConfig(config DecompressConfig) echo.MiddlewareFunc","content":"DecompressWithConfig returns a decompress middleware with config or panics on invalid configuration.\n\nSECURITY: If MaxDecompressedSize is not set (zero value), it defaults to 100MB to prevent\nDoS attacks via zip bombs. Set to -1 to explicitly disable limits if needed for your use case.\n\nfunc DecompressWithConfig(config DecompressConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-DecompressWithConfig","tab":"API Reference","category":"go function"},{"title":"func DefaultSkipper(c *echo.Context) bool","content":"DefaultSkipper returns false which processes the middleware.\n\nfunc DefaultSkipper(c *echo.Context) bool","url":"/api-reference/pkg-middleware.html#func-DefaultSkipper","tab":"API Reference","category":"go function"},{"title":"func Gzip() echo.MiddlewareFunc","content":"Gzip returns a middleware which compresses HTTP response using gzip compression scheme.\n\nfunc Gzip() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-Gzip","tab":"API Reference","category":"go function"},{"title":"func GzipWithConfig(config GzipConfig) echo.MiddlewareFunc","content":"GzipWithConfig returns a middleware which compresses HTTP response using gzip compression scheme.\n\nfunc GzipWithConfig(config GzipConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-GzipWithConfig","tab":"API Reference","category":"go function"},{"title":"func HTTPSNonWWWRedirect() echo.MiddlewareFunc","content":"HTTPSNonWWWRedirect redirects http requests to https non www.\nFor example, http://www.labstack.com will be redirect to https://labstack.com.\n\nUsage `Echo#Pre(HTTPSNonWWWRedirect())`\n\nfunc HTTPSNonWWWRedirect() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-HTTPSNonWWWRedirect","tab":"API Reference","category":"go function"},{"title":"func HTTPSNonWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc","content":"HTTPSNonWWWRedirectWithConfig returns a HTTPS Non-WWW redirect middleware with config or panics on invalid configuration.\n\nfunc HTTPSNonWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-HTTPSNonWWWRedirectWithConfig","tab":"API Reference","category":"go function"},{"title":"func HTTPSRedirect() echo.MiddlewareFunc","content":"HTTPSRedirect redirects http requests to https.\nFor example, http://labstack.com will be redirect to https://labstack.com.\n\nUsage `Echo#Pre(HTTPSRedirect())`\n\nfunc HTTPSRedirect() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-HTTPSRedirect","tab":"API Reference","category":"go function"},{"title":"func HTTPSRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc","content":"HTTPSRedirectWithConfig returns a HTTPS redirect middleware with config or panics on invalid configuration.\n\nfunc HTTPSRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-HTTPSRedirectWithConfig","tab":"API Reference","category":"go function"},{"title":"func HTTPSWWWRedirect() echo.MiddlewareFunc","content":"HTTPSWWWRedirect redirects http requests to https www.\nFor example, http://labstack.com will be redirect to https://www.labstack.com.\n\nUsage `Echo#Pre(HTTPSWWWRedirect())`\n\nfunc HTTPSWWWRedirect() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-HTTPSWWWRedirect","tab":"API Reference","category":"go function"},{"title":"func HTTPSWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc","content":"HTTPSWWWRedirectWithConfig returns a HTTPS WWW redirect middleware with config or panics on invalid configuration.\n\nfunc HTTPSWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-HTTPSWWWRedirectWithConfig","tab":"API Reference","category":"go function"},{"title":"func KeyAuth(fn KeyAuthValidator) echo.MiddlewareFunc","content":"KeyAuth returns an KeyAuth middleware.\n\nFor valid key it calls the next handler.\nFor invalid key, it sends \"401 - Unauthorized\" response.\nFor missing key, it sends \"400 - Bad Request\" response.\n\nfunc KeyAuth(fn KeyAuthValidator) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-KeyAuth","tab":"API Reference","category":"go function"},{"title":"func KeyAuthWithConfig(config KeyAuthConfig) echo.MiddlewareFunc","content":"KeyAuthWithConfig returns an KeyAuth middleware or panics if configuration is invalid.\n\nFor first valid key it calls the next handler.\nFor invalid key, it sends \"401 - Unauthorized\" response.\nFor missing key, it sends \"400 - Bad Request\" response.\n\nfunc KeyAuthWithConfig(config KeyAuthConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-KeyAuthWithConfig","tab":"API Reference","category":"go function"},{"title":"func MethodFromForm(param string) MethodOverrideGetter","content":"MethodFromForm is a `MethodOverrideGetter` that gets overridden method from the\nform parameter.\n\nfunc MethodFromForm(param string) MethodOverrideGetter","url":"/api-reference/pkg-middleware.html#func-MethodFromForm","tab":"API Reference","category":"go function"},{"title":"func MethodFromHeader(header string) MethodOverrideGetter","content":"MethodFromHeader is a `MethodOverrideGetter` that gets overridden method from\nthe request header.\n\nfunc MethodFromHeader(header string) MethodOverrideGetter","url":"/api-reference/pkg-middleware.html#func-MethodFromHeader","tab":"API Reference","category":"go function"},{"title":"func MethodFromQuery(param string) MethodOverrideGetter","content":"MethodFromQuery is a `MethodOverrideGetter` that gets overridden method from\nthe query parameter.\n\nfunc MethodFromQuery(param string) MethodOverrideGetter","url":"/api-reference/pkg-middleware.html#func-MethodFromQuery","tab":"API Reference","category":"go function"},{"title":"func MethodOverride() echo.MiddlewareFunc","content":"MethodOverride returns a MethodOverride middleware.\nMethodOverride middleware checks for the overridden method from the request and\nuses it instead of the original method.\n\nFor security reasons, only `POST` method can be overridden.\n\nfunc MethodOverride() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-MethodOverride","tab":"API Reference","category":"go function"},{"title":"func MethodOverrideWithConfig(config MethodOverrideConfig) echo.MiddlewareFunc","content":"MethodOverrideWithConfig returns a Method Override middleware with config or panics on invalid configuration.\n\nfunc MethodOverrideWithConfig(config MethodOverrideConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-MethodOverrideWithConfig","tab":"API Reference","category":"go function"},{"title":"func NewRandomBalancer(targets []*ProxyTarget) ProxyBalancer","content":"NewRandomBalancer returns a random proxy balancer.\n\nfunc NewRandomBalancer(targets []*ProxyTarget) ProxyBalancer","url":"/api-reference/pkg-middleware.html#func-NewRandomBalancer","tab":"API Reference","category":"go function"},{"title":"func NewRateLimiterMemoryStore(rateLimit float64) (store *RateLimiterMemoryStore)","content":"NewRateLimiterMemoryStore returns an instance of RateLimiterMemoryStore with\nthe provided rate (as req/s).\nfor more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit.\n\nBurst and ExpiresIn will be set to default values.\n\nNote that if the provided rate is a float number and Burst is zero, Burst will be treated as the rounded up value of the rate.\n\nExample (with 20 requests/sec):\n\n\tlimiterStore := middleware.NewRateLimiterMemoryStore(20)\n\nfunc NewRateLimiterMemoryStore(r","url":"/api-reference/pkg-middleware.html#func-NewRateLimiterMemoryStore","tab":"API Reference","category":"go function"},{"title":"func NewRateLimiterMemoryStoreWithConfig(config RateLimiterMemoryStoreConfig) (store *RateLimiterMemoryStore)","content":"NewRateLimiterMemoryStoreWithConfig returns an instance of RateLimiterMemoryStore\nwith the provided configuration. Rate must be provided. Burst will be set to the rounded up value of\nthe configured rate if not provided or set to 0.\n\nThe built-in memory store is usually capable for modest loads. For higher loads other\nstore implementations should be considered.\n\nCharacteristics:\n* Concurrency above 100 parallel requests may causes measurable lock contention\n* A high number of different IP address","url":"/api-reference/pkg-middleware.html#func-NewRateLimiterMemoryStoreWithConfig","tab":"API Reference","category":"go function"},{"title":"func NewRoundRobinBalancer(targets []*ProxyTarget) ProxyBalancer","content":"NewRoundRobinBalancer returns a round-robin proxy balancer.\n\nfunc NewRoundRobinBalancer(targets []*ProxyTarget) ProxyBalancer","url":"/api-reference/pkg-middleware.html#func-NewRoundRobinBalancer","tab":"API Reference","category":"go function"},{"title":"func NonWWWRedirect() echo.MiddlewareFunc","content":"NonWWWRedirect redirects www requests to non www.\nFor example, http://www.labstack.com will be redirect to http://labstack.com.\n\nUsage `Echo#Pre(NonWWWRedirect())`\n\nfunc NonWWWRedirect() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-NonWWWRedirect","tab":"API Reference","category":"go function"},{"title":"func NonWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc","content":"NonWWWRedirectWithConfig returns a Non-WWW redirect middleware with config or panics on invalid configuration.\n\nfunc NonWWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-NonWWWRedirectWithConfig","tab":"API Reference","category":"go function"},{"title":"func Proxy(balancer ProxyBalancer) echo.MiddlewareFunc","content":"Proxy returns a Proxy middleware.\n\nProxy middleware forwards the request to upstream server using a configured load balancing technique.\n\nfunc Proxy(balancer ProxyBalancer) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-Proxy","tab":"API Reference","category":"go function"},{"title":"func ProxyWithConfig(config ProxyConfig) echo.MiddlewareFunc","content":"ProxyWithConfig returns a Proxy middleware or panics if configuration is invalid.\n\nProxy middleware forwards the request to upstream server using a configured load balancing technique.\n\nfunc ProxyWithConfig(config ProxyConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-ProxyWithConfig","tab":"API Reference","category":"go function"},{"title":"func RateLimiter(store RateLimiterStore) echo.MiddlewareFunc","content":"RateLimiter returns a rate limiting middleware\n\n\te := echo.New()\n\n\tlimiterStore := middleware.NewRateLimiterMemoryStore(20)\n\n\te.GET(\"/rate-limited\", func(c *echo.Context) error {\n\t\treturn c.String(http.StatusOK, \"test\")\n\t}, RateLimiter(limiterStore))\n\nfunc RateLimiter(store RateLimiterStore) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-RateLimiter","tab":"API Reference","category":"go function"},{"title":"func RateLimiterWithConfig(config RateLimiterConfig) echo.MiddlewareFunc","content":"RateLimiterWithConfig returns a rate limiting middleware\n\n\te := echo.New()\n\n\tconfig := middleware.RateLimiterConfig{\n\t\tSkipper: DefaultSkipper,\n\t\tStore: middleware.NewRateLimiterMemoryStore(\n\t\t\tmiddleware.RateLimiterMemoryStoreConfig{Rate: 10, Burst: 30, ExpiresIn: 3 * time.Minute}\n\t\t)\n\t\tIdentifierExtractor: func(ctx *echo.Context) (string, error) {\n\t\t\tid := ctx.RealIP()\n\t\t\treturn id, nil\n\t\t},\n\t\tErrorHandler: func(ctx *echo.Context, err error) error {\n\t\t\treturn context.JSON(http.StatusTooManyReq","url":"/api-reference/pkg-middleware.html#func-RateLimiterWithConfig","tab":"API Reference","category":"go function"},{"title":"func Recover() echo.MiddlewareFunc","content":"Recover returns a middleware which recovers from panics anywhere in the chain\nand handles the control to the centralized HTTPErrorHandler.\n\nfunc Recover() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-Recover","tab":"API Reference","category":"go function"},{"title":"func RecoverWithConfig(config RecoverConfig) echo.MiddlewareFunc","content":"RecoverWithConfig returns a Recovery middleware with config or panics on invalid configuration.\n\nfunc RecoverWithConfig(config RecoverConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-RecoverWithConfig","tab":"API Reference","category":"go function"},{"title":"func RemoveTrailingSlash() echo.MiddlewareFunc","content":"RemoveTrailingSlash returns a root level (before router) middleware which removes\na trailing slash from the request URI.\n\nUsage `Echo#Pre(RemoveTrailingSlash())`\n\nfunc RemoveTrailingSlash() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-RemoveTrailingSlash","tab":"API Reference","category":"go function"},{"title":"func RemoveTrailingSlashWithConfig(config RemoveTrailingSlashConfig) echo.MiddlewareFunc","content":"RemoveTrailingSlashWithConfig returns a RemoveTrailingSlash middleware with config or panics on invalid configuration.\n\nfunc RemoveTrailingSlashWithConfig(config RemoveTrailingSlashConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-RemoveTrailingSlashWithConfig","tab":"API Reference","category":"go function"},{"title":"func RequestID() echo.MiddlewareFunc","content":"RequestID returns a middleware that reads RequestIDConfig.TargetHeader (`X-Request-ID`) header value or when\nthe header value is empty, generates that value and sets request ID to response\nas RequestIDConfig.TargetHeader (`X-Request-Id`) value.\n\nfunc RequestID() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-RequestID","tab":"API Reference","category":"go function"},{"title":"func RequestIDWithConfig(config RequestIDConfig) echo.MiddlewareFunc","content":"RequestIDWithConfig returns a middleware with given valid config or panics on invalid configuration.\nThe middleware reads RequestIDConfig.TargetHeader (`X-Request-ID`) header value or when the header value is empty,\ngenerates that value and sets request ID to response as RequestIDConfig.TargetHeader (`X-Request-Id`) value.\n\nfunc RequestIDWithConfig(config RequestIDConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-RequestIDWithConfig","tab":"API Reference","category":"go function"},{"title":"func RequestLogger() echo.MiddlewareFunc","content":"RequestLogger creates Request Logger middleware with Echo default settings that uses Context.Logger() as logger.\n\nfunc RequestLogger() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-RequestLogger","tab":"API Reference","category":"go function"},{"title":"func RequestLoggerWithConfig(config RequestLoggerConfig) echo.MiddlewareFunc","content":"RequestLoggerWithConfig returns a RequestLogger middleware with config.\n\nfunc RequestLoggerWithConfig(config RequestLoggerConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-RequestLoggerWithConfig","tab":"API Reference","category":"go function"},{"title":"func Rewrite(rules map[string]string) echo.MiddlewareFunc","content":"Rewrite returns a Rewrite middleware.\n\nRewrite middleware rewrites the URL path based on the provided rules.\n\nfunc Rewrite(rules map[string]string) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-Rewrite","tab":"API Reference","category":"go function"},{"title":"func RewriteWithConfig(config RewriteConfig) echo.MiddlewareFunc","content":"RewriteWithConfig returns a Rewrite middleware or panics on invalid configuration.\n\nRewrite middleware rewrites the URL path based on the provided rules.\n\nfunc RewriteWithConfig(config RewriteConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-RewriteWithConfig","tab":"API Reference","category":"go function"},{"title":"func Secure() echo.MiddlewareFunc","content":"Secure returns a Secure middleware.\nSecure middleware provides protection against cross-site scripting (XSS) attack,\ncontent type sniffing, clickjacking, insecure connection and other code injection\nattacks.\n\nfunc Secure() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-Secure","tab":"API Reference","category":"go function"},{"title":"func SecureWithConfig(config SecureConfig) echo.MiddlewareFunc","content":"SecureWithConfig returns a Secure middleware with config or panics on invalid configuration.\n\nfunc SecureWithConfig(config SecureConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-SecureWithConfig","tab":"API Reference","category":"go function"},{"title":"func Static(root string) echo.MiddlewareFunc","content":"Static returns a Static middleware to serves static content from the provided root directory.\n\nfunc Static(root string) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-Static","tab":"API Reference","category":"go function"},{"title":"func StaticWithConfig(config StaticConfig) echo.MiddlewareFunc","content":"StaticWithConfig returns a Static middleware to serves static content or panics on invalid configuration.\n\nfunc StaticWithConfig(config StaticConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-StaticWithConfig","tab":"API Reference","category":"go function"},{"title":"func WWWRedirect() echo.MiddlewareFunc","content":"WWWRedirect redirects non www requests to www.\nFor example, http://labstack.com will be redirect to http://www.labstack.com.\n\nUsage `Echo#Pre(WWWRedirect())`\n\nfunc WWWRedirect() echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-WWWRedirect","tab":"API Reference","category":"go function"},{"title":"func WWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc","content":"WWWRedirectWithConfig returns a WWW redirect middleware with config or panics on invalid configuration.\n\nfunc WWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc","url":"/api-reference/pkg-middleware.html#func-WWWRedirectWithConfig","tab":"API Reference","category":"go function"},{"title":"type AddTrailingSlashConfig","content":"AddTrailingSlashConfig is the middleware config for adding trailing slash to the request.\n\ntype AddTrailingSlashConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// Status code to be used when redirecting the request.\n\t// Optional, but when provided the request is redirected using this code.\n\t// Valid status codes: [300...308]\n\tRedirectCode int\n}","url":"/api-reference/pkg-middleware.html#type-AddTrailingSlashConfig","tab":"API Reference","category":"go type"},{"title":"AddTrailingSlashConfig.ToMiddleware","content":"ToMiddleware converts AddTrailingSlashConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-AddTrailingSlashConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type BasicAuthConfig","content":"BasicAuthConfig defines the config for BasicAuthWithConfig middleware.\n\nSECURITY: The Validator function is responsible for securely comparing credentials.\nSee BasicAuthValidator documentation for guidance on preventing timing attacks.\n\ntype BasicAuthConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// Validator is a function to validate BasicAuthWithConfig credentials. Note: if request contains multiple basic auth headers\n\t// this function would be called onc","url":"/api-reference/pkg-middleware.html#type-BasicAuthConfig","tab":"API Reference","category":"go type"},{"title":"BasicAuthConfig.ToMiddleware","content":"ToMiddleware converts BasicAuthConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-BasicAuthConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type BasicAuthValidator","content":"BasicAuthValidator defines a function to validate BasicAuthWithConfig credentials.\n\nSECURITY WARNING: To prevent timing attacks that could allow attackers to enumerate\nvalid usernames or passwords, validator implementations MUST use constant-time\ncomparison for credential checking. Use crypto/subtle.ConstantTimeCompare instead\nof standard string equality (==) or switch statements.\n\nExample of SECURE implementation:\n\n\timport \"crypto/subtle\"\n\n\tvalidator := func(c *echo.Context, username, password ","url":"/api-reference/pkg-middleware.html#type-BasicAuthValidator","tab":"API Reference","category":"go type"},{"title":"type BeforeFunc","content":"BeforeFunc defines a function which is executed just before the middleware.\n\ntype BeforeFunc func(c *echo.Context)","url":"/api-reference/pkg-middleware.html#type-BeforeFunc","tab":"API Reference","category":"go type"},{"title":"type BodyDumpConfig","content":"BodyDumpConfig defines the config for BodyDump middleware.\n\ntype BodyDumpConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// Handler receives request, response payloads and handler error if there are any.\n\t// Required.\n\tHandler BodyDumpHandler\n\n\t// MaxRequestBytes limits how much of the request body to dump.\n\t// If the request body exceeds this limit, only the first MaxRequestBytes\n\t// are dumped. The handler callback receives truncated data.\n\t// Default: 5 *","url":"/api-reference/pkg-middleware.html#type-BodyDumpConfig","tab":"API Reference","category":"go type"},{"title":"BodyDumpConfig.ToMiddleware","content":"ToMiddleware converts BodyDumpConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-BodyDumpConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type BodyDumpHandler","content":"BodyDumpHandler receives the request and response payload.\n\ntype BodyDumpHandler func(c *echo.Context, reqBody []byte, resBody []byte, err error)","url":"/api-reference/pkg-middleware.html#type-BodyDumpHandler","tab":"API Reference","category":"go type"},{"title":"type BodyLimitConfig","content":"BodyLimitConfig defines the config for BodyLimitWithConfig middleware.\n\ntype BodyLimitConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// LimitBytes is maximum allowed size in bytes for a request body\n\tLimitBytes int64\n}","url":"/api-reference/pkg-middleware.html#type-BodyLimitConfig","tab":"API Reference","category":"go type"},{"title":"BodyLimitConfig.ToMiddleware","content":"ToMiddleware converts BodyLimitConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-BodyLimitConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type CORSConfig","content":"CORSConfig defines the config for CORS middleware.\n\ntype CORSConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// AllowOrigins determines the value of the Access-Control-Allow-Origin\n\t// response header. This header defines a list of origins that may access the\n\t// resource.\n\t//\n\t// Origin consist of following parts: `scheme + \"://\" + host + optional \":\" + port`\n\t// Wildcard can be used, but has to be set explicitly []string{\"*\"}\n\t// Example: `https://example","url":"/api-reference/pkg-middleware.html#type-CORSConfig","tab":"API Reference","category":"go type"},{"title":"CORSConfig.ToMiddleware","content":"ToMiddleware converts CORSConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-CORSConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type CSRFConfig","content":"CSRFConfig defines the config for CSRF middleware.\n\ntype CSRFConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\t// TrustedOrigins permits any request with `Sec-Fetch-Site` header whose `Origin` header\n\t// exactly matches a configured origin.\n\t// Values should be formatted as Origin header \"scheme://host[:port]\".\n\t//\n\t// See [Origin]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin\n\t// See [Sec-Fetch-Site]: https://cheatsheetseries.owasp.org/chea","url":"/api-reference/pkg-middleware.html#type-CSRFConfig","tab":"API Reference","category":"go type"},{"title":"CSRFConfig.ToMiddleware","content":"ToMiddleware converts CSRFConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-CSRFConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type ContextTimeoutConfig","content":"ContextTimeoutConfig defines the config for ContextTimeout middleware.\n\ntype ContextTimeoutConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// ErrorHandler is a function when error arises in middeware execution.\n\tErrorHandler func(c *echo.Context, err error) error\n\n\t// Timeout configures a timeout for the middleware\n\tTimeout time.Duration\n}","url":"/api-reference/pkg-middleware.html#type-ContextTimeoutConfig","tab":"API Reference","category":"go type"},{"title":"ContextTimeoutConfig.ToMiddleware","content":"ToMiddleware converts Config to middleware.\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-ContextTimeoutConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type DecompressConfig","content":"DecompressConfig defines the config for Decompress middleware.\n\ntype DecompressConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// GzipDecompressPool defines an interface to provide the sync.Pool used to create/store Gzip readers\n\tGzipDecompressPool Decompressor\n\n\t// MaxDecompressedSize limits the maximum size of decompressed request body in bytes.\n\t// If the decompressed body exceeds this limit, the middleware returns HTTP 413 error.\n\t// This prevents zip bo","url":"/api-reference/pkg-middleware.html#type-DecompressConfig","tab":"API Reference","category":"go type"},{"title":"DecompressConfig.ToMiddleware","content":"ToMiddleware converts DecompressConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-DecompressConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type Decompressor","content":"Decompressor is used to get the sync.Pool used by the middleware to get Gzip readers\n\ntype Decompressor interface {\n\t// contains filtered or unexported methods\n}","url":"/api-reference/pkg-middleware.html#type-Decompressor","tab":"API Reference","category":"go type"},{"title":"type DefaultGzipDecompressPool","content":"DefaultGzipDecompressPool is the default implementation of Decompressor interface\n\ntype DefaultGzipDecompressPool struct {\n}","url":"/api-reference/pkg-middleware.html#type-DefaultGzipDecompressPool","tab":"API Reference","category":"go type"},{"title":"type Extractor","content":"Extractor is used to extract data from *echo.Context\n\ntype Extractor func(c *echo.Context) (string, error)","url":"/api-reference/pkg-middleware.html#type-Extractor","tab":"API Reference","category":"go type"},{"title":"type ExtractorSource","content":"ExtractorSource is type to indicate source for extracted value\n\ntype ExtractorSource string","url":"/api-reference/pkg-middleware.html#type-ExtractorSource","tab":"API Reference","category":"go type"},{"title":"type GzipConfig","content":"GzipConfig defines the config for Gzip middleware.\n\ntype GzipConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// Gzip compression level.\n\t// Optional. Default value -1.\n\tLevel int\n\n\t// Length threshold before gzip compression is applied.\n\t// Optional. Default value 0.\n\t//\n\t// Most of the time you will not need to change the default. Compressing\n\t// a short response might increase the transmitted data because of the\n\t// gzip format overhead. Compressing the re","url":"/api-reference/pkg-middleware.html#type-GzipConfig","tab":"API Reference","category":"go type"},{"title":"GzipConfig.ToMiddleware","content":"ToMiddleware converts GzipConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-GzipConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type KeyAuthConfig","content":"KeyAuthConfig defines the config for KeyAuth middleware.\n\nSECURITY: The Validator function is responsible for securely comparing API keys.\nSee KeyAuthValidator documentation for guidance on preventing timing attacks.\n\ntype KeyAuthConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// KeyLookup is a string in the form of \":\" or \":,:\" that is used\n\t// to extract key from the request.\n\t// Optional. Default value \"header:Aut","url":"/api-reference/pkg-middleware.html#type-KeyAuthConfig","tab":"API Reference","category":"go type"},{"title":"KeyAuthConfig.ToMiddleware","content":"ToMiddleware converts KeyAuthConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-KeyAuthConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type KeyAuthErrorHandler","content":"KeyAuthErrorHandler defines a function which is executed for an invalid key.\n\ntype KeyAuthErrorHandler func(c *echo.Context, err error) error","url":"/api-reference/pkg-middleware.html#type-KeyAuthErrorHandler","tab":"API Reference","category":"go type"},{"title":"type KeyAuthValidator","content":"KeyAuthValidator defines a function to validate KeyAuth credentials.\n\nSECURITY WARNING: To prevent timing attacks that could allow attackers to enumerate\nvalid API keys, validator implementations MUST use constant-time comparison.\nUse crypto/subtle.ConstantTimeCompare instead of standard string equality (==)\nor switch statements.\n\nExample of SECURE implementation:\n\n\timport \"crypto/subtle\"\n\n\tvalidator := func(c *echo.Context, key string, source ExtractorSource) (bool, error) {\n\t // Fetch valid","url":"/api-reference/pkg-middleware.html#type-KeyAuthValidator","tab":"API Reference","category":"go type"},{"title":"type MethodOverrideConfig","content":"MethodOverrideConfig defines the config for MethodOverride middleware.\n\ntype MethodOverrideConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// Getter is a function that gets overridden method from the request.\n\t// Optional. Default values MethodFromHeader(echo.HeaderXHTTPMethodOverride).\n\tGetter MethodOverrideGetter\n}","url":"/api-reference/pkg-middleware.html#type-MethodOverrideConfig","tab":"API Reference","category":"go type"},{"title":"MethodOverrideConfig.ToMiddleware","content":"ToMiddleware converts MethodOverrideConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-MethodOverrideConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type MethodOverrideGetter","content":"MethodOverrideGetter is a function that gets overridden method from the request\n\ntype MethodOverrideGetter func(c *echo.Context) string","url":"/api-reference/pkg-middleware.html#type-MethodOverrideGetter","tab":"API Reference","category":"go type"},{"title":"type PanicStackError","content":"PanicStackError is an error type that wraps an error along with its stack trace.\nIt is returned when config.DisablePrintStack is set to false.\n\ntype PanicStackError struct {\n\tStack []byte\n\tErr error\n}","url":"/api-reference/pkg-middleware.html#type-PanicStackError","tab":"API Reference","category":"go type"},{"title":"PanicStackError.Error","content":"func Error) Error() string","url":"/api-reference/pkg-middleware.html#method-PanicStackError-Error","tab":"API Reference","category":"go method"},{"title":"PanicStackError.Unwrap","content":"func Unwrap() error","url":"/api-reference/pkg-middleware.html#method-PanicStackError-Unwrap","tab":"API Reference","category":"go method"},{"title":"type ProxyBalancer","content":"ProxyBalancer defines an interface to implement a load balancing technique.\n\ntype ProxyBalancer interface {\n\tAddTarget(target *ProxyTarget) bool\n\tRemoveTarget(targetName string) bool\n\tNext(c *echo.Context) (*ProxyTarget, error)\n}","url":"/api-reference/pkg-middleware.html#type-ProxyBalancer","tab":"API Reference","category":"go type"},{"title":"type ProxyConfig","content":"ProxyConfig defines the config for Proxy middleware.\n\ntype ProxyConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// Balancer defines a load balancing technique.\n\t// Required.\n\tBalancer ProxyBalancer\n\n\t// RetryCount defines the number of times a failed proxied request should be retried\n\t// using the next available ProxyTarget. Defaults to 0, meaning requests are never retried.\n\tRetryCount int\n\n\t// RetryFilter defines a function used to determine if a failed re","url":"/api-reference/pkg-middleware.html#type-ProxyConfig","tab":"API Reference","category":"go type"},{"title":"ProxyConfig.ToMiddleware","content":"ToMiddleware converts ProxyConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-ProxyConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type ProxyTarget","content":"ProxyTarget defines the upstream target.\n\ntype ProxyTarget struct {\n\tName string\n\tURL *url.URL\n\tMeta map[string]any\n}","url":"/api-reference/pkg-middleware.html#type-ProxyTarget","tab":"API Reference","category":"go type"},{"title":"type RateLimiterConfig","content":"RateLimiterConfig defines the configuration for the rate limiter\n\ntype RateLimiterConfig struct {\n\tSkipper Skipper\n\tBeforeFunc BeforeFunc\n\t// IdentifierExtractor uses *echo.Context to extract the identifier for a visitor\n\tIdentifierExtractor Extractor\n\t// Store defines a store for the rate limiter\n\tStore RateLimiterStore\n\t// ErrorHandler provides a handler to be called when IdentifierExtractor returns an error\n\tErrorHandler func(c *echo.Context, err error) error\n\t// DenyHandler provides a han","url":"/api-reference/pkg-middleware.html#type-RateLimiterConfig","tab":"API Reference","category":"go type"},{"title":"RateLimiterConfig.ToMiddleware","content":"ToMiddleware converts RateLimiterConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-RateLimiterConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type RateLimiterMemoryStore","content":"RateLimiterMemoryStore is the built-in store implementation for RateLimiter\n\ntype RateLimiterMemoryStore struct {\n\t// contains filtered or unexported fields\n}","url":"/api-reference/pkg-middleware.html#type-RateLimiterMemoryStore","tab":"API Reference","category":"go type"},{"title":"RateLimiterMemoryStore.Allow","content":"Allow implements RateLimiterStore.Allow\n\nfunc Allow(identifier string) (bool, error)","url":"/api-reference/pkg-middleware.html#method-RateLimiterMemoryStore-Allow","tab":"API Reference","category":"go method"},{"title":"RateLimiterMemoryStore.AllowContext","content":"AllowContext implements RateLimiterStoreContext: it makes the allow/deny decision\nand sets the X-RateLimit-* (and Retry-After when denied) response headers.\n\nfunc AllowContext(c *echo.Context, identifier string) (bool, error)","url":"/api-reference/pkg-middleware.html#method-RateLimiterMemoryStore-AllowContext","tab":"API Reference","category":"go method"},{"title":"type RateLimiterMemoryStoreConfig","content":"RateLimiterMemoryStoreConfig represents configuration for RateLimiterMemoryStore\n\ntype RateLimiterMemoryStoreConfig struct {\n\tRate float64 // Rate of requests allowed to pass as req/s. For more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit.\n\tBurst int // Burst is maximum number of requests to pass at the same moment. It additionally allows a number of requests to pass when rate limit is reached.\n\tExpiresIn time.Duration // ExpiresIn is the","url":"/api-reference/pkg-middleware.html#type-RateLimiterMemoryStoreConfig","tab":"API Reference","category":"go type"},{"title":"type RateLimiterStore","content":"RateLimiterStore is the interface to be implemented by custom stores.\n\ntype RateLimiterStore interface {\n\tAllow(identifier string) (bool, error)\n}","url":"/api-reference/pkg-middleware.html#type-RateLimiterStore","tab":"API Reference","category":"go type"},{"title":"type RateLimiterStoreContext","content":"RateLimiterStoreContext is an optional interface a RateLimiterStore may implement.\nWhen the configured store implements it, the rate limiter calls AllowContext\n(with the request context) instead of Allow, allowing the store to set response\nheaders such as Retry-After or X-RateLimit-* on the allow/deny decision.\n\ntype RateLimiterStoreContext interface {\n\tAllowContext(c *echo.Context, identifier string) (bool, error)\n}","url":"/api-reference/pkg-middleware.html#type-RateLimiterStoreContext","tab":"API Reference","category":"go type"},{"title":"type RecoverConfig","content":"RecoverConfig defines the config for Recover middleware.\n\ntype RecoverConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// Size of the stack to be printed.\n\t// Optional. Default value 4KB.\n\tStackSize int\n\n\t// DisableStackAll disables formatting stack traces of all other goroutines\n\t// into buffer after the trace for the current goroutine.\n\t// Optional. Default value false.\n\tDisableStackAll bool\n\n\t// DisablePrintStack disables printing stack trace.\n\t// Optional","url":"/api-reference/pkg-middleware.html#type-RecoverConfig","tab":"API Reference","category":"go type"},{"title":"RecoverConfig.ToMiddleware","content":"ToMiddleware converts RecoverConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-RecoverConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type RedirectConfig","content":"RedirectConfig defines the config for Redirect middleware.\n\ntype RedirectConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper\n\n\t// Status code to be used when redirecting the request.\n\t// Optional. Default value http.StatusMovedPermanently.\n\tCode int\n\t// contains filtered or unexported fields\n}","url":"/api-reference/pkg-middleware.html#type-RedirectConfig","tab":"API Reference","category":"go type"},{"title":"RedirectConfig.ToMiddleware","content":"ToMiddleware converts RedirectConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-RedirectConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type RemoveTrailingSlashConfig","content":"RemoveTrailingSlashConfig is the middleware config for removing trailing slash from the request.\n\ntype RemoveTrailingSlashConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// Status code to be used when redirecting the request.\n\t// Optional, but when provided the request is redirected using this code.\n\tRedirectCode int\n}","url":"/api-reference/pkg-middleware.html#type-RemoveTrailingSlashConfig","tab":"API Reference","category":"go type"},{"title":"RemoveTrailingSlashConfig.ToMiddleware","content":"ToMiddleware converts RemoveTrailingSlashConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-RemoveTrailingSlashConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type RequestIDConfig","content":"RequestIDConfig defines the config for RequestID middleware.\n\ntype RequestIDConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// Generator defines a function to generate an ID.\n\t// Optional. Default value random.String(32).\n\tGenerator func() string\n\n\t// RequestIDHandler defines a function which is executed for a request id.\n\tRequestIDHandler func(c *echo.Context, requestID string)\n\n\t// TargetHeader defines what header to look for to populate the id.\n\t// Option","url":"/api-reference/pkg-middleware.html#type-RequestIDConfig","tab":"API Reference","category":"go type"},{"title":"RequestIDConfig.ToMiddleware","content":"ToMiddleware converts RequestIDConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-RequestIDConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type RequestLoggerConfig","content":"RequestLoggerConfig is configuration for Request Logger middleware.\n\ntype RequestLoggerConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// BeforeNextFunc defines a function that is called before next middleware or handler is called in chain.\n\tBeforeNextFunc func(c *echo.Context)\n\t// LogValuesFunc defines a function that is called with values extracted by logger from request/response.\n\t// Mandatory.\n\tLogValuesFunc func(c *echo.Context, v RequestLoggerValues) e","url":"/api-reference/pkg-middleware.html#type-RequestLoggerConfig","tab":"API Reference","category":"go type"},{"title":"RequestLoggerConfig.ToMiddleware","content":"ToMiddleware converts RequestLoggerConfig into middleware or returns an error for invalid configuration.\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-RequestLoggerConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type RequestLoggerValues","content":"RequestLoggerValues contains extracted values from logger.\n\ntype RequestLoggerValues struct {\n\t// StartTime is time recorded before next middleware/handler is executed.\n\tStartTime time.Time\n\t// Latency is duration it took to execute rest of the handler chain (next(c) call).\n\tLatency time.Duration\n\t// Protocol is request protocol (i.e. `HTTP/1.1` or `HTTP/2`)\n\tProtocol string\n\t// RemoteIP is request remote IP. See `echo.Context.RealIP()` for implementation details.\n\tRemoteIP string\n\t// Host is re","url":"/api-reference/pkg-middleware.html#type-RequestLoggerValues","tab":"API Reference","category":"go type"},{"title":"type RewriteConfig","content":"RewriteConfig defines the config for Rewrite middleware.\n\ntype RewriteConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// Rules defines the URL path rewrite rules. The values captured in asterisk can be\n\t// retrieved by index e.g. $1, $2 and so on.\n\t// Example:\n\t// \"/old\": \"/new\",\n\t// \"/api/*\": \"/$1\",\n\t// \"/js/*\": \"/public/javascripts/$1\",\n\t// \"/users/*/orders/*\": \"/user/$1/order/$2\",\n\t// Required.\n\tRules map[string]string\n","url":"/api-reference/pkg-middleware.html#type-RewriteConfig","tab":"API Reference","category":"go type"},{"title":"RewriteConfig.ToMiddleware","content":"ToMiddleware converts RewriteConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-RewriteConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type SecureConfig","content":"SecureConfig defines the config for Secure middleware.\n\ntype SecureConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// XSSProtection provides protection against cross-site scripting attack (XSS)\n\t// by setting the `X-XSS-Protection` header.\n\t// Optional. Default value \"1; mode=block\".\n\tXSSProtection string\n\n\t// ContentTypeNosniff provides protection against overriding Content-Type\n\t// header by setting the `X-Content-Type-Options` header.\n\t// Optional. Defaul","url":"/api-reference/pkg-middleware.html#type-SecureConfig","tab":"API Reference","category":"go type"},{"title":"SecureConfig.ToMiddleware","content":"ToMiddleware converts SecureConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-SecureConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type Skipper","content":"Skipper defines a function to skip middleware. Returning true skips processing the middleware.\n\ntype Skipper func(c *echo.Context) bool","url":"/api-reference/pkg-middleware.html#type-Skipper","tab":"API Reference","category":"go type"},{"title":"type StaticConfig","content":"StaticConfig defines the config for Static middleware.\n\ntype StaticConfig struct {\n\t// Skipper defines a function to skip middleware.\n\tSkipper Skipper\n\n\t// Root directory from where the static content is served (relative to given Filesystem).\n\t// `Root: \".\"` means root folder from Filesystem.\n\t// Required.\n\tRoot string\n\n\t// Filesystem provides access to the static content.\n\t// Optional. Defaults to echo.Filesystem (serves files from `.` folder where executable is started)\n\tFilesystem fs.FS\n\n\t// ","url":"/api-reference/pkg-middleware.html#type-StaticConfig","tab":"API Reference","category":"go type"},{"title":"StaticConfig.ToMiddleware","content":"ToMiddleware converts StaticConfig to middleware or returns an error for invalid configuration\n\nfunc ToMiddleware() (echo.MiddlewareFunc, error)","url":"/api-reference/pkg-middleware.html#method-StaticConfig-ToMiddleware","tab":"API Reference","category":"go method"},{"title":"type ValueExtractorError","content":"ValueExtractorError is error type when middleware extractor is unable to extract value from lookups\n\ntype ValueExtractorError struct {\n\t// contains filtered or unexported fields\n}","url":"/api-reference/pkg-middleware.html#type-ValueExtractorError","tab":"API Reference","category":"go type"},{"title":"ValueExtractorError.Error","content":"Error returns errors text\n\nfunc Error) Error() string","url":"/api-reference/pkg-middleware.html#method-ValueExtractorError-Error","tab":"API Reference","category":"go method"},{"title":"type ValuesExtractor","content":"ValuesExtractor defines a function for extracting values (keys/tokens) from the given context.\n\ntype ValuesExtractor func(c *echo.Context) ([]string, ExtractorSource, error)","url":"/api-reference/pkg-middleware.html#type-ValuesExtractor","tab":"API Reference","category":"go type"},{"title":"type Visitor","content":"Visitor signifies a unique user's limiter details\n\ntype Visitor struct {\n\t*rate.Limiter\n\t// contains filtered or unexported fields\n}","url":"/api-reference/pkg-middleware.html#type-Visitor","tab":"API Reference","category":"go type"},{"title":"API Reference","content":"github.com/labstack/echo/v5","url":"/api-reference.html","tab":"API Reference","category":"Pages"}] \ No newline at end of file diff --git a/docs/api-reference/sitemap.xml b/docs/api-reference/sitemap.xml new file mode 100644 index 000000000..303270bf3 --- /dev/null +++ b/docs/api-reference/sitemap.xml @@ -0,0 +1,8 @@ + + + + /api-reference/package-root.html + /api-reference/pkg-echotest.html + /api-reference/pkg-middleware.html + /api-reference.html + \ No newline at end of file diff --git a/docs/api-reference/sourcey.css b/docs/api-reference/sourcey.css new file mode 100644 index 000000000..0dd4e50c2 --- /dev/null +++ b/docs/api-reference/sourcey.css @@ -0,0 +1,2474 @@ +/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;--font-mono:ui-monospace, "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-600:oklch(57.7% .245 27.325);--color-red-800:oklch(44.4% .177 26.899);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-900:oklch(40.8% .123 38.172);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-400:oklch(85.2% .199 91.936);--color-green-100:oklch(96.2% .044 156.743);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-900:oklch(37.8% .077 168.94);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-600:oklch(51.1% .262 276.966);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-700:oklch(49.6% .265 301.924);--color-rose-50:oklch(96.9% .015 12.422);--color-rose-100:oklch(94.1% .03 12.58);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-600:oklch(58.6% .253 17.585);--color-rose-800:oklch(45.5% .188 13.697);--color-rose-900:oklch(41% .159 10.272);--color-gray-50:245 245 250;--color-gray-100:241 241 245;--color-gray-200:225 225 229;--color-gray-300:209 209 213;--color-gray-400:161 161 165;--color-gray-500:115 115 119;--color-gray-600:83 83 87;--color-gray-700:65 65 69;--color-gray-800:40 40 44;--color-gray-900:25 25 30;--color-gray-950:13 13 17;--color-stone-50:250 250 249;--color-stone-100:245 245 244;--color-stone-200:231 229 228;--color-stone-400:168 162 158;--color-stone-500:120 113 108;--color-stone-600:87 83 78;--color-stone-700:68 64 60;--color-stone-900:oklch(21.6% .006 56.043);--color-stone-950:12 10 9;--color-white:#fff;--spacing:.25rem;--container-2xl:42rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--leading-tight:1.25;--radius-md:.375rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--radius:.75rem;--sidebar-width:18rem;--header-height:7rem;--toc-width:19rem;--toc-inner-width:16.5rem;--content-padding:2.5rem;--content-max-width:44rem;--color-primary:99 102 241;--color-primary-light:129 140 248;--color-primary-dark:79 70 229;--color-primary-ink:79 70 229;--color-background-light:255 255 255;--color-background-dark:11 12 16;--color-code-block-light:255 255 255;--color-code-block-dark:11 12 14;--color-success:34 197 94;--color-overlay:0 0 0;--color-border-dark-subtle:255 255 255;--color-surface-dark-tint:255 255 255;--method-get:#16a34a;--method-post:#2563eb;--method-put:#d97706;--method-delete:#dc2626;--method-patch:#9333ea;--method-tool:#9333ea;--method-resource:#16a34a;--method-prompt:#2563eb}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.top-0{top:0}.top-3{top:calc(var(--spacing) * 3)}.top-\[2\.75rem\]{top:2.75rem}.top-full{top:100%}.right-0{right:0}.right-4{right:calc(var(--spacing) * 4)}.right-auto{right:auto}.bottom-0{bottom:0}.left-0{left:0}.left-1\/2{left:50%}.-z-10{z-index:calc(10 * -1)}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-\[21\]{z-index:21}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.mx-4{margin-inline:calc(var(--spacing) * 4)}.mx-auto{margin-inline:auto}.my-1{margin-block:var(--spacing)}.prose{color:var(--tw-prose-body);max-width:65ch}.prose :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);margin-top:1.2em;margin-bottom:1.2em;font-size:1.25em;line-height:1.6}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);font-weight:500;text-decoration:underline}.prose :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em;list-style-type:decimal}.prose :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}.prose :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em;list-style-type:disc}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-counters);font-weight:400}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.prose :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.25em;font-weight:600}.prose :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.prose :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-quotes);border-inline-start-width:.25rem;border-inline-start-color:var(--tw-prose-quote-borders);quotes:"“""”""‘""’";margin-top:1.6em;margin-bottom:1.6em;padding-inline-start:1em;font-style:italic;font-weight:500}.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}.prose :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}.prose :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:0;margin-bottom:.888889em;font-size:2.25em;font-weight:800;line-height:1.11111}.prose :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:900}.prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:2em;margin-bottom:1em;font-size:1.5em;font-weight:700;line-height:1.33333}.prose :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:800}.prose :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.6em;margin-bottom:.6em;font-size:1.25em;font-weight:600;line-height:1.6}.prose :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:700}.prose :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.5em;margin-bottom:.5em;font-weight:600;line-height:1.5}.prose :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:700}.prose :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em;display:block}.prose :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-kbd);box-shadow:0 0 0 1px var(--tw-prose-kbd-shadows), 0 3px 0 var(--tw-prose-kbd-shadows);padding-top:.1875em;padding-inline-end:.375em;padding-bottom:.1875em;border-radius:.3125rem;padding-inline-start:.375em;font-family:inherit;font-size:.875em;font-weight:500}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-size:.875em;font-weight:600}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before,.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:"`"}.prose :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em}.prose :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em}.prose :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);padding-top:.857143em;padding-inline-end:1.14286em;padding-bottom:.857143em;border-radius:.375rem;margin-top:1.71429em;margin-bottom:1.71429em;padding-inline-start:1.14286em;font-size:.875em;font-weight:400;line-height:1.71429;overflow-x:auto}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit;background-color:#0000;border-width:0;border-radius:0;padding:0}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before,.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:none}.prose :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){table-layout:auto;width:100%;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.71429}.prose :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.prose :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);vertical-align:bottom;padding-inline-end:.571429em;padding-bottom:.571429em;padding-inline-start:.571429em;font-weight:600}.prose :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.prose :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}.prose :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}.prose :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.prose :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}.prose :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}.prose :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);margin-top:.857143em;font-size:.875em;line-height:1.42857}.prose{--tw-prose-body:oklch(37.3% .034 259.733);--tw-prose-headings:oklch(21% .034 264.665);--tw-prose-lead:oklch(44.6% .03 256.802);--tw-prose-links:oklch(21% .034 264.665);--tw-prose-bold:oklch(21% .034 264.665);--tw-prose-counters:oklch(55.1% .027 264.364);--tw-prose-bullets:oklch(87.2% .01 258.338);--tw-prose-hr:oklch(92.8% .006 264.531);--tw-prose-quotes:oklch(21% .034 264.665);--tw-prose-quote-borders:oklch(92.8% .006 264.531);--tw-prose-captions:oklch(55.1% .027 264.364);--tw-prose-kbd:oklch(21% .034 264.665);--tw-prose-kbd-shadows:oklab(21% -.00316127 -.0338527/.1);--tw-prose-code:oklch(21% .034 264.665);--tw-prose-pre-code:oklch(92.8% .006 264.531);--tw-prose-pre-bg:oklch(27.8% .033 256.848);--tw-prose-th-borders:oklch(87.2% .01 258.338);--tw-prose-td-borders:oklch(92.8% .006 264.531);--tw-prose-invert-body:oklch(87.2% .01 258.338);--tw-prose-invert-headings:#fff;--tw-prose-invert-lead:oklch(70.7% .022 261.325);--tw-prose-invert-links:#fff;--tw-prose-invert-bold:#fff;--tw-prose-invert-counters:oklch(70.7% .022 261.325);--tw-prose-invert-bullets:oklch(44.6% .03 256.802);--tw-prose-invert-hr:oklch(37.3% .034 259.733);--tw-prose-invert-quotes:oklch(96.7% .003 264.542);--tw-prose-invert-quote-borders:oklch(37.3% .034 259.733);--tw-prose-invert-captions:oklch(70.7% .022 261.325);--tw-prose-invert-kbd:#fff;--tw-prose-invert-kbd-shadows:#ffffff1a;--tw-prose-invert-code:#fff;--tw-prose-invert-pre-code:oklch(87.2% .01 258.338);--tw-prose-invert-pre-bg:#00000080;--tw-prose-invert-th-borders:oklch(44.6% .03 256.802);--tw-prose-invert-td-borders:oklch(37.3% .034 259.733);font-size:1rem;line-height:1.75}.prose :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;padding-inline-start:1.625em}.prose :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.571429em;padding-inline-end:.571429em;padding-bottom:.571429em;padding-inline-start:.571429em}.prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.prose-sm{font-size:.875rem;line-height:1.71429}.prose-sm :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.14286em;margin-bottom:1.14286em}.prose-sm :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.888889em;margin-bottom:.888889em;font-size:1.28571em;line-height:1.55556}.prose-sm :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.33333em;margin-bottom:1.33333em;padding-inline-start:1.11111em}.prose-sm :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:.8em;font-size:2.14286em;line-height:1.2}.prose-sm :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.6em;margin-bottom:.8em;font-size:1.42857em;line-height:1.4}.prose-sm :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.55556em;margin-bottom:.444444em;font-size:1.28571em;line-height:1.55556}.prose-sm :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.42857em;margin-bottom:.571429em;line-height:1.42857}.prose-sm :where(img):not(:where([class~=not-prose],[class~=not-prose] *)),.prose-sm :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.71429em;margin-bottom:1.71429em}.prose-sm :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose-sm :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.71429em;margin-bottom:1.71429em}.prose-sm :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.142857em;padding-inline-end:.357143em;padding-bottom:.142857em;border-radius:.3125rem;padding-inline-start:.357143em;font-size:.857143em}.prose-sm :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.857143em}.prose-sm :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.9em}.prose-sm :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.888889em}.prose-sm :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.666667em;padding-inline-end:1em;padding-bottom:.666667em;border-radius:.25rem;margin-top:1.66667em;margin-bottom:1.66667em;padding-inline-start:1em;font-size:.857143em;line-height:1.66667}.prose-sm :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)),.prose-sm :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.14286em;margin-bottom:1.14286em;padding-inline-start:1.57143em}.prose-sm :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.285714em;margin-bottom:.285714em}.prose-sm :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)),.prose-sm :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.428571em}.prose-sm :where(.prose-sm>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.571429em;margin-bottom:.571429em}.prose-sm :where(.prose-sm>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.14286em}.prose-sm :where(.prose-sm>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.14286em}.prose-sm :where(.prose-sm>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.14286em}.prose-sm :where(.prose-sm>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.14286em}.prose-sm :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.571429em;margin-bottom:.571429em}.prose-sm :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.14286em;margin-bottom:1.14286em}.prose-sm :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.14286em}.prose-sm :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.285714em;padding-inline-start:1.57143em}.prose-sm :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2.85714em;margin-bottom:2.85714em}.prose-sm :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose-sm :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose-sm :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose-sm :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){font-size:.857143em;line-height:1.5}.prose-sm :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:1em;padding-bottom:.666667em;padding-inline-start:1em}.prose-sm :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose-sm :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose-sm :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.666667em;padding-inline-end:1em;padding-bottom:.666667em;padding-inline-start:1em}.prose-sm :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose-sm :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose-sm :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.71429em;margin-bottom:1.71429em}.prose-sm :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose-sm :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.666667em;font-size:.857143em;line-height:1.33333}.prose-sm :where(.prose-sm>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose-sm :where(.prose-sm>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.-mt-10{margin-top:calc(var(--spacing) * -10)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-8{margin-top:calc(var(--spacing) * 8)}.mt-12{margin-top:calc(var(--spacing) * 12)}.mt-16{margin-top:calc(var(--spacing) * 16)}.mr-0\.5{margin-right:calc(var(--spacing) * .5)}.mb-0{margin-bottom:0}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.mb-14{margin-bottom:calc(var(--spacing) * 14)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.box-border{box-sizing:border-box}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-\[26px\]{width:26px;height:26px}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-\[1\.5px\]{height:1.5px}.h-\[1lh\]{height:1lh}.h-full{height:100%}.max-h-full{max-height:100%}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-8{width:calc(var(--spacing) * 8)}.w-\[16\.5rem\]{width:16.5rem}.w-\[18rem\]{width:18rem}.w-\[19rem\]{width:19rem}.w-\[28rem\]{width:28rem}.w-auto{width:auto}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[28rem\]{max-width:28rem}.max-w-\[92rem\]{max-width:92rem}.max-w-none{max-width:none}.min-w-0{min-width:0}.min-w-4{min-width:calc(var(--spacing) * 4)}.min-w-\[42px\]{min-width:42px}.min-w-\[43px\]{min-width:43px}.min-w-\[120px\]{min-width:120px}.min-w-\[140px\]{min-width:140px}.flex-1{flex:1}.flex-none{flex:none}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-8{gap:calc(var(--spacing) * 8)}.gap-12{gap:calc(var(--spacing) * 12)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-px>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(1px * var(--tw-space-y-reverse));margin-block-end:calc(1px * calc(1 - var(--tw-space-y-reverse)))}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}:where(.space-x-2\.5>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-3>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 3) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-4>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 4) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-6>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 6) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-x-reverse)))}.gap-y-1{row-gap:var(--spacing)}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded-\[var\(--radius\)\]{border-radius:var(--radius)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-\[rgb\(var\(--color-gray-100\)\)\]{border-color:rgb(var(--color-gray-100))}.border-\[rgb\(var\(--color-gray-200\)\/0\.7\)\]{border-color:rgb(var(--color-gray-200)/.7)}.border-\[rgb\(var\(--color-gray-500\)\/0\.08\)\]{border-color:rgb(var(--color-gray-500)/.08)}.border-\[rgb\(var\(--color-stone-200\)\)\]{border-color:rgb(var(--color-stone-200))}.bg-\[rgb\(var\(--color-background-light\)\)\]{background-color:rgb(var(--color-background-light))}.bg-\[rgb\(var\(--color-code-block-light\)\)\]{background-color:rgb(var(--color-code-block-light))}.bg-\[rgb\(var\(--color-gray-100\)\/0\.5\)\]{background-color:rgb(var(--color-gray-100)/.5)}.bg-\[rgb\(var\(--color-primary\)\)\]{background-color:rgb(var(--color-primary))}.bg-\[rgb\(var\(--color-primary-dark\)\)\]{background-color:rgb(var(--color-primary-dark))}.bg-amber-100{background-color:var(--color-amber-100)}.bg-amber-100\/50{background-color:#fef3c680}@supports (color:color-mix(in lab, red, red)){.bg-amber-100\/50{background-color:color-mix(in oklab, var(--color-amber-100) 50%, transparent)}}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-100\/50{background-color:#dbeafe80}@supports (color:color-mix(in lab, red, red)){.bg-blue-100\/50{background-color:color-mix(in oklab, var(--color-blue-100) 50%, transparent)}}.bg-blue-400\/20{background-color:#54a2ff33}@supports (color:color-mix(in lab, red, red)){.bg-blue-400\/20{background-color:color-mix(in oklab, var(--color-blue-400) 20%, transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-gray-400\/20{background-color:color-mix(in srgb, 161 161 165 20%, transparent)}@supports (color:color-mix(in lab, red, red)){.bg-gray-400\/20{background-color:color-mix(in oklab, var(--color-gray-400) 20%, transparent)}}.bg-green-100{background-color:var(--color-green-100)}.bg-green-100\/50{background-color:#dcfce780}@supports (color:color-mix(in lab, red, red)){.bg-green-100\/50{background-color:color-mix(in oklab, var(--color-green-100) 50%, transparent)}}.bg-green-400\/20{background-color:#05df7233}@supports (color:color-mix(in lab, red, red)){.bg-green-400\/20{background-color:color-mix(in oklab, var(--color-green-400) 20%, transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-orange-100{background-color:var(--color-orange-100)}.bg-purple-400\/20{background-color:#c07eff33}@supports (color:color-mix(in lab, red, red)){.bg-purple-400\/20{background-color:color-mix(in oklab, var(--color-purple-400) 20%, transparent)}}.bg-purple-500{background-color:var(--color-purple-500)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-100\/50{background-color:#ffe2e280}@supports (color:color-mix(in lab, red, red)){.bg-red-100\/50{background-color:color-mix(in oklab, var(--color-red-100) 50%, transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[rgb\(var\(--color-background-light\)\)\]{--tw-gradient-from:rgb(var(--color-background-light));--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.object-contain{object-fit:contain}.p-2{padding:calc(var(--spacing) * 2)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-12{padding-inline:calc(var(--spacing) * 12)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-3\.5{padding-block:calc(var(--spacing) * 3.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-8{padding-block:calc(var(--spacing) * 8)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-10{padding-top:calc(var(--spacing) * 10)}.pt-\[8\.5rem\]{padding-top:8.5rem}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pb-2\.5{padding-bottom:calc(var(--spacing) * 2.5)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-10{padding-bottom:calc(var(--spacing) * 10)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-3\.5{padding-left:calc(var(--spacing) * 3.5)}.pl-10{padding-left:calc(var(--spacing) * 10)}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[0\.55rem\]{font-size:.55rem}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-\[1\.35rem\]{--tw-leading:1.35rem;line-height:1.35rem}.leading-none{--tw-leading:1;line-height:1}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\[0\.14em\]{--tw-tracking:.14em;letter-spacing:.14em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.break-words{overflow-wrap:break-word}.\[word-break\:break-word\]{word-break:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.text-\[rgb\(var\(--color-gray-400\)\)\]{color:rgb(var(--color-gray-400))}.text-\[rgb\(var\(--color-gray-500\)\)\]{color:rgb(var(--color-gray-500))}.text-\[rgb\(var\(--color-gray-600\)\)\]{color:rgb(var(--color-gray-600))}.text-\[rgb\(var\(--color-gray-700\)\)\]{color:rgb(var(--color-gray-700))}.text-\[rgb\(var\(--color-gray-800\)\)\]{color:rgb(var(--color-gray-800))}.text-\[rgb\(var\(--color-gray-900\)\)\]{color:rgb(var(--color-gray-900))}.text-\[rgb\(var\(--color-primary\)\)\]{color:rgb(var(--color-primary))}.text-\[rgb\(var\(--color-primary-ink\)\)\]{color:rgb(var(--color-primary-ink))}.text-\[rgb\(var\(--color-stone-400\)\)\]{color:rgb(var(--color-stone-400))}.text-\[rgb\(var\(--color-stone-500\)\)\]{color:rgb(var(--color-stone-500))}.text-\[rgb\(var\(--color-stone-600\)\)\]{color:rgb(var(--color-stone-600))}.text-\[rgb\(var\(--color-stone-950\)\)\]{color:rgb(var(--color-stone-950))}.text-amber-600{color:var(--color-amber-600)}.text-amber-900{color:var(--color-amber-900)}.text-blue-600{color:var(--color-blue-600)}.text-blue-700{color:var(--color-blue-700)}.text-blue-800{color:var(--color-blue-800)}.text-gray-700{color:var(--color-gray-700)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-orange-900{color:var(--color-orange-900)}.text-purple-700{color:var(--color-purple-700)}.text-red-600{color:var(--color-red-600)}.text-red-800{color:var(--color-red-800)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.no-underline{text-decoration-line:none}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-0{opacity:0}.opacity-90{opacity:.9}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-\[rgb\(var\(--color-gray-400\)\/0\.3\)\]{--tw-ring-color:rgb(var(--color-gray-400)/.3)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-0{outline-style:var(--tw-outline-style);outline-width:0}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.prose-gray{--tw-prose-body:oklch(37.3% .034 259.733);--tw-prose-headings:oklch(21% .034 264.665);--tw-prose-lead:oklch(44.6% .03 256.802);--tw-prose-links:oklch(21% .034 264.665);--tw-prose-bold:oklch(21% .034 264.665);--tw-prose-counters:oklch(55.1% .027 264.364);--tw-prose-bullets:oklch(87.2% .01 258.338);--tw-prose-hr:oklch(92.8% .006 264.531);--tw-prose-quotes:oklch(21% .034 264.665);--tw-prose-quote-borders:oklch(92.8% .006 264.531);--tw-prose-captions:oklch(55.1% .027 264.364);--tw-prose-kbd:oklch(21% .034 264.665);--tw-prose-kbd-shadows:oklab(21% -.00316127 -.0338527/.1);--tw-prose-code:oklch(21% .034 264.665);--tw-prose-pre-code:oklch(92.8% .006 264.531);--tw-prose-pre-bg:oklch(27.8% .033 256.848);--tw-prose-th-borders:oklch(87.2% .01 258.338);--tw-prose-td-borders:oklch(92.8% .006 264.531);--tw-prose-invert-body:oklch(87.2% .01 258.338);--tw-prose-invert-headings:#fff;--tw-prose-invert-lead:oklch(70.7% .022 261.325);--tw-prose-invert-links:#fff;--tw-prose-invert-bold:#fff;--tw-prose-invert-counters:oklch(70.7% .022 261.325);--tw-prose-invert-bullets:oklch(44.6% .03 256.802);--tw-prose-invert-hr:oklch(37.3% .034 259.733);--tw-prose-invert-quotes:oklch(96.7% .003 264.542);--tw-prose-invert-quote-borders:oklch(37.3% .034 259.733);--tw-prose-invert-captions:oklch(70.7% .022 261.325);--tw-prose-invert-kbd:#fff;--tw-prose-invert-kbd-shadows:#ffffff1a;--tw-prose-invert-code:#fff;--tw-prose-invert-pre-code:oklch(87.2% .01 258.338);--tw-prose-invert-pre-bg:#00000080;--tw-prose-invert-th-borders:oklch(44.6% .03 256.802);--tw-prose-invert-td-borders:oklch(37.3% .034 259.733)}.select-none{-webkit-user-select:none;user-select:none}.\[text-shadow\:-0\.2px_0_0_currentColor\,0\.2px_0_0_currentColor\]{text-shadow:-.2px 0,.2px 0}@media (hover:hover){.group-hover\:bg-\[rgb\(var\(--color-gray-200\)\)\]:is(:where(.group):hover *){background-color:rgb(var(--color-gray-200))}.group-hover\:bg-\[rgb\(var\(--color-stone-200\)\/0\.5\)\]:is(:where(.group):hover *){background-color:rgb(var(--color-stone-200)/.5)}.group-hover\:text-\[rgb\(var\(--color-primary\)\)\]:is(:where(.group):hover *){color:rgb(var(--color-primary))}.group-hover\:text-\[rgb\(var\(--color-primary-ink\)\)\]:is(:where(.group):hover *){color:rgb(var(--color-primary-ink))}.group-hover\:opacity-90:is(:where(.group):hover *){opacity:.9}.group-hover\/copy\:text-\[rgb\(var\(--color-stone-500\)\)\]:is(:where(.group\/copy):hover *){color:rgb(var(--color-stone-500))}.peer-hover\:opacity-100:is(:where(.peer):hover~*){opacity:1}}.first\:mt-0:first-child{margin-top:0}@media (hover:hover){.hover\:border-\[rgb\(var\(--color-primary\)\/0\.4\)\]:hover{border-color:rgb(var(--color-primary)/.4)}.hover\:bg-\[rgb\(var\(--color-stone-100\)\)\]:hover{background-color:rgb(var(--color-stone-100))}.hover\:text-\[rgb\(var\(--color-gray-600\)\)\]:hover{color:rgb(var(--color-gray-600))}.hover\:text-\[rgb\(var\(--color-gray-700\)\)\]:hover{color:rgb(var(--color-gray-700))}.hover\:text-\[rgb\(var\(--color-gray-800\)\)\]:hover{color:rgb(var(--color-gray-800))}.hover\:text-\[rgb\(var\(--color-gray-900\)\)\]:hover{color:rgb(var(--color-gray-900))}.hover\:underline:hover{text-decoration-line:underline}.hover\:ring-\[rgb\(var\(--color-gray-600\)\/0\.3\)\]:hover{--tw-ring-color:rgb(var(--color-gray-600)/.3)}}@media (width>=40rem){.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}}@media (width>=64rem){.lg\:sticky{position:sticky}.lg\:mx-0{margin-inline:0}.lg\:mt-8{margin-top:calc(var(--spacing) * 8)}.lg\:-ml-12{margin-left:calc(var(--spacing) * -12)}.lg\:block{display:block}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:flex-row{flex-direction:row}.lg\:px-8{padding-inline:calc(var(--spacing) * 8)}.lg\:px-12{padding-inline:calc(var(--spacing) * 12)}.lg\:pt-10{padding-top:calc(var(--spacing) * 10)}.lg\:pl-\[23\.7rem\]{padding-left:23.7rem}}@media (width>=80rem){.xl\:block{display:block}.xl\:flex{display:flex}.xl\:hidden{display:none}.xl\:w-\[calc\(100\%-28rem\)\]{width:calc(100% - 28rem)}.xl\:flex-col{flex-direction:column}.xl\:flex-row{flex-direction:row}}.dark\:block:where(.dark,.dark *){display:block}.dark\:hidden:where(.dark,.dark *){display:none}.dark\:border-\[rgb\(255_255_255\/0\.1\)\]:where(.dark,.dark *){border-color:#ffffff1a}.dark\:border-\[rgb\(var\(--color-border-dark-subtle\)\/0\.1\)\]:where(.dark,.dark *){border-color:rgb(var(--color-border-dark-subtle)/.1)}.dark\:border-\[rgb\(var\(--color-gray-300\)\/0\.06\)\]:where(.dark,.dark *){border-color:rgb(var(--color-gray-300)/.06)}.dark\:border-\[rgb\(var\(--color-gray-300\)\/0\.08\)\]:where(.dark,.dark *){border-color:rgb(var(--color-gray-300)/.08)}.dark\:border-\[rgb\(var\(--color-gray-800\)\)\]:where(.dark,.dark *){border-color:rgb(var(--color-gray-800))}.dark\:border-\[rgb\(var\(--color-gray-800\)\/0\.5\)\]:where(.dark,.dark *){border-color:rgb(var(--color-gray-800)/.5)}.dark\:bg-\[rgb\(var\(--color-background-dark\)\)\]:where(.dark,.dark *){background-color:rgb(var(--color-background-dark))}.dark\:bg-\[rgb\(var\(--color-code-block-dark\)\)\]:where(.dark,.dark *){background-color:rgb(var(--color-code-block-dark))}.dark\:bg-\[rgb\(var\(--color-primary-light\)\)\]:where(.dark,.dark *){background-color:rgb(var(--color-primary-light))}.dark\:bg-\[rgb\(var\(--color-stone-900\)\)\]:where(.dark,.dark *){background-color:rgb(var(--color-stone-900))}.dark\:bg-\[rgb\(var\(--color-surface-dark-tint\)\/0\.05\)\]:where(.dark,.dark *){background-color:rgb(var(--color-surface-dark-tint)/.05)}.dark\:bg-amber-400\/10:where(.dark,.dark *){background-color:#fcbb001a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-amber-400) 10%, transparent)}}.dark\:bg-blue-400:where(.dark,.dark *){background-color:var(--color-blue-400)}.dark\:bg-blue-400\/10:where(.dark,.dark *){background-color:#54a2ff1a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-blue-400) 10%, transparent)}}.dark\:bg-blue-400\/20:where(.dark,.dark *){background-color:#54a2ff33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-blue-400\/20:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-blue-400) 20%, transparent)}}.dark\:bg-green-400:where(.dark,.dark *){background-color:var(--color-green-400)}.dark\:bg-green-400\/10:where(.dark,.dark *){background-color:#05df721a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-green-400) 10%, transparent)}}.dark\:bg-green-400\/20:where(.dark,.dark *){background-color:#05df7233}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-400\/20:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-green-400) 20%, transparent)}}.dark\:bg-orange-400\/20:where(.dark,.dark *){background-color:#ff8b1a33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-orange-400\/20:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-orange-400) 20%, transparent)}}.dark\:bg-purple-400:where(.dark,.dark *){background-color:var(--color-purple-400)}.dark\:bg-purple-400\/20:where(.dark,.dark *){background-color:#c07eff33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-purple-400\/20:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-purple-400) 20%, transparent)}}.dark\:bg-red-400\/10:where(.dark,.dark *){background-color:#ff65681a}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-400\/10:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-red-400) 10%, transparent)}}.dark\:bg-red-400\/20:where(.dark,.dark *){background-color:#ff656833}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-400\/20:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-red-400) 20%, transparent)}}.dark\:bg-yellow-400\/20:where(.dark,.dark *){background-color:#fac80033}@supports (color:color-mix(in lab, red, red)){.dark\:bg-yellow-400\/20:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-yellow-400) 20%, transparent)}}.dark\:from-\[rgb\(var\(--color-background-dark\)\)\]:where(.dark,.dark *){--tw-gradient-from:rgb(var(--color-background-dark));--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.dark\:text-\[rgb\(255_255_255\/0\.4\)\]:where(.dark,.dark *){color:#fff6}.dark\:text-\[rgb\(var\(--color-gray-50\)\)\]:where(.dark,.dark *){color:rgb(var(--color-gray-50))}.dark\:text-\[rgb\(var\(--color-gray-200\)\)\]:where(.dark,.dark *){color:rgb(var(--color-gray-200))}.dark\:text-\[rgb\(var\(--color-gray-300\)\)\]:where(.dark,.dark *){color:rgb(var(--color-gray-300))}.dark\:text-\[rgb\(var\(--color-gray-400\)\)\]:where(.dark,.dark *){color:rgb(var(--color-gray-400))}.dark\:text-\[rgb\(var\(--color-gray-500\)\)\]:where(.dark,.dark *){color:rgb(var(--color-gray-500))}.dark\:text-\[rgb\(var\(--color-primary-light\)\)\]:where(.dark,.dark *){color:rgb(var(--color-primary-light))}.dark\:text-\[rgb\(var\(--color-stone-50\)\)\]:where(.dark,.dark *){color:rgb(var(--color-stone-50))}.dark\:text-\[rgb\(var\(--color-stone-400\)\)\]:where(.dark,.dark *){color:rgb(var(--color-stone-400))}.dark\:text-amber-300:where(.dark,.dark *){color:var(--color-amber-300)}.dark\:text-blue-300:where(.dark,.dark *){color:var(--color-blue-300)}.dark\:text-blue-400:where(.dark,.dark *){color:var(--color-blue-400)}.dark\:text-gray-400:where(.dark,.dark *){color:var(--color-gray-400)}.dark\:text-green-300:where(.dark,.dark *){color:var(--color-green-300)}.dark\:text-green-400:where(.dark,.dark *){color:var(--color-green-400)}.dark\:text-orange-300:where(.dark,.dark *){color:var(--color-orange-300)}.dark\:text-purple-400:where(.dark,.dark *){color:var(--color-purple-400)}.dark\:text-red-300:where(.dark,.dark *){color:var(--color-red-300)}.dark\:text-yellow-300:where(.dark,.dark *){color:var(--color-yellow-300)}.dark\:ring-\[rgb\(var\(--color-gray-600\)\/0\.3\)\]:where(.dark,.dark *){--tw-ring-color:rgb(var(--color-gray-600)/.3)}.dark\:brightness-110:where(.dark,.dark *){--tw-brightness:brightness(110%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.dark\:prose-invert:where(.dark,.dark *){--tw-prose-body:var(--tw-prose-invert-body);--tw-prose-headings:var(--tw-prose-invert-headings);--tw-prose-lead:var(--tw-prose-invert-lead);--tw-prose-links:var(--tw-prose-invert-links);--tw-prose-bold:var(--tw-prose-invert-bold);--tw-prose-counters:var(--tw-prose-invert-counters);--tw-prose-bullets:var(--tw-prose-invert-bullets);--tw-prose-hr:var(--tw-prose-invert-hr);--tw-prose-quotes:var(--tw-prose-invert-quotes);--tw-prose-quote-borders:var(--tw-prose-invert-quote-borders);--tw-prose-captions:var(--tw-prose-invert-captions);--tw-prose-kbd:var(--tw-prose-invert-kbd);--tw-prose-kbd-shadows:var(--tw-prose-invert-kbd-shadows);--tw-prose-code:var(--tw-prose-invert-code);--tw-prose-pre-code:var(--tw-prose-invert-pre-code);--tw-prose-pre-bg:var(--tw-prose-invert-pre-bg);--tw-prose-th-borders:var(--tw-prose-invert-th-borders);--tw-prose-td-borders:var(--tw-prose-invert-td-borders)}@media (hover:hover){.dark\:group-hover\:bg-\[rgb\(var\(--color-gray-700\)\)\]:where(.dark,.dark *):is(:where(.group):hover *){background-color:rgb(var(--color-gray-700))}.dark\:group-hover\:bg-\[rgb\(var\(--color-stone-700\)\/0\.7\)\]:where(.dark,.dark *):is(:where(.group):hover *){background-color:rgb(var(--color-stone-700)/.7)}.dark\:group-hover\:text-\[rgb\(var\(--color-primary-light\)\)\]:where(.dark,.dark *):is(:where(.group):hover *){color:rgb(var(--color-primary-light))}.dark\:group-hover\/copy\:text-\[rgb\(255_255_255\/0\.6\)\]:where(.dark,.dark *):is(:where(.group\/copy):hover *){color:#fff9}.dark\:hover\:border-\[rgb\(var\(--color-primary-light\)\/0\.3\)\]:where(.dark,.dark *):hover{border-color:rgb(var(--color-primary-light)/.3)}.dark\:hover\:bg-\[rgb\(255_255_255\/0\.05\)\]:where(.dark,.dark *):hover{background-color:#ffffff0d}.dark\:hover\:text-\[rgb\(var\(--color-gray-200\)\)\]:where(.dark,.dark *):hover{color:rgb(var(--color-gray-200))}.dark\:hover\:text-\[rgb\(var\(--color-gray-300\)\)\]:where(.dark,.dark *):hover{color:rgb(var(--color-gray-300))}.dark\:hover\:ring-\[rgb\(var\(--color-gray-500\)\/0\.3\)\]:where(.dark,.dark *):hover{--tw-ring-color:rgb(var(--color-gray-500)/.3)}.dark\:hover\:brightness-125:where(.dark,.dark *):hover{--tw-brightness:brightness(125%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false} +/*$vite$:1*/ +/** + * Sourcey — Component styles. + * + * Layout and OpenAPI components use Tailwind classes in .tsx files. + * Markdown-generated components (code blocks, cards, steps, accordions, + * callouts, tabs) use semantic class names styled here — no Tailwind + * utilities in generated HTML. + */ + +/* ── Page Description (display font) ─────────────────────────────── */ + +#sourcey .page-description { + font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif; + font-size: 1.125rem; + line-height: 1.35; + font-style: italic; + color: rgb(var(--color-gray-600)); +} +@media (min-width: 1024px) { + #sourcey .page-description { + font-size: 1.375rem; + line-height: 1.4; + } +} +.dark #sourcey .page-description { + color: rgb(var(--color-gray-400)); +} + +/* ── Page Top Gradient ────────────────────────────────────────────── */ + +#sourcey #page::before { + content: ""; + position: fixed; + top: 0; + left: 0; + right: 0; + height: 400px; + background: linear-gradient(to bottom, rgb(var(--color-primary) / 0.03), transparent); + pointer-events: none; + z-index: -1; +} +.dark #sourcey #page::before { + background: none; +} + +/* ── Scroll Offset (clears fixed navbar on anchor clicks) ──────────── */ + +[data-traverse-target], +h1[id], +h2[id], +h3[id], +h4[id], +h5[id], +h6[id] { + scroll-margin-top: var(--header-height, 7rem); +} + +/* ── Focus ─────────────────────────────────────────────────────────── */ + +#sourcey button:focus-visible { + outline: 2px solid rgb(var(--color-primary)); + outline-offset: 2px; +} + +/* ── Shiki Dual-Theme (defaultColor: false) ───────────────────────── */ +/* Shiki outputs --shiki-light and --shiki-dark CSS vars on each span. */ +/* Light mode: use --shiki-light. Dark mode: use --shiki-dark. */ + +.shiki, +.shiki span { + color: var(--shiki-light); + background-color: transparent !important; +} + +.dark .shiki, +.dark .shiki span { + color: var(--shiki-dark); +} + +.shiki pre { + background-color: transparent !important; + margin: 0; +} + +.shiki code { + font-family: inherit; + background: transparent; + border: none; + padding: 0; +} + +/* ── Responsive Tables ────────────────────────────────────────────── */ + +#sourcey .table-wrap { + overflow-x: auto; + -webkit-overflow-scrolling: touch; +} +#sourcey .table-wrap table { + margin: 0; +} +#sourcey .prose :where(thead th):not(:where([class~="not-prose"], [class~="not-prose"] *)) { + padding-top: 0.571429em; +} + +/* ── Prose Video (::video directive) ──────────────────────────────── */ + +#sourcey .prose-video { + position: relative; + width: 100%; + padding-bottom: 56.25%; /* 16:9 */ + margin: 1.5rem 0; + border-radius: var(--radius); + overflow: hidden; +} +#sourcey .prose-video iframe, +#sourcey .prose-video video { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +/* ── Prose Iframe (::iframe directive) ────────────────────────────── */ + +#sourcey .prose-iframe { + width: 100%; + margin: 1.5rem 0; + border-radius: var(--radius); + overflow: hidden; + border: 1px solid rgb(var(--color-stone-950) / 0.1); +} +.dark #sourcey .prose-iframe { + border-color: rgb(255 255 255 / 0.1); +} +#sourcey .prose-iframe iframe { + width: 100%; + height: 100%; + display: block; +} + +/* ── Inline Code (not-prose containers lose Tailwind prose styling) ── */ + +#sourcey .not-prose :not(pre) > code { + font-size: 0.875em; + font-weight: 600; + color: var(--tw-prose-code); +} +#sourcey .not-prose :not(pre) > code::before, +#sourcey .not-prose :not(pre) > code::after { + content: "`"; +} + +/* ── Prose Code Block (fenced code in markdown pages) ─────────────── */ + +#sourcey .prose-code-block { + position: relative; + border-radius: var(--radius); + border: 1px solid rgb(var(--color-stone-950) / 0.1); + margin: 1.25rem 0 2rem; + overflow: hidden; + color: rgb(var(--color-stone-950)); +} +.dark #sourcey .prose-code-block { + border-color: rgb(255 255 255 / 0.1); + color: rgb(var(--color-stone-50)); +} + +#sourcey .prose-code-copy { + position: absolute; + top: 0.75rem; + right: 1rem; + z-index: 10; +} + +#sourcey .prose-code-copy .copy-btn { + display: flex; + align-items: center; + justify-content: center; + width: 26px; + height: 26px; + border-radius: 0.375rem; + border: none; + background: transparent; + cursor: pointer; + color: rgb(var(--color-stone-400)); + transition: color 0.15s; +} +#sourcey .prose-code-copy .copy-btn:hover { + color: rgb(var(--color-stone-500)); +} +.dark #sourcey .prose-code-copy .copy-btn { + color: rgb(255 255 255 / 0.4); +} +.dark #sourcey .prose-code-copy .copy-btn:hover { + color: rgb(255 255 255 / 0.6); +} + +#sourcey .prose-code-copy .copy-btn svg { + width: 1rem; + height: 1rem; +} + +#sourcey .prose-code-content { + padding: 0.875rem 1rem; + border-radius: var(--radius); + background: rgb(var(--color-code-block-light)); + overflow-x: auto; + font-variant-ligatures: none; +} +.dark #sourcey .prose-code-content { + background: rgb(var(--color-code-block-dark)); +} + +#sourcey .prose-code-content pre { + margin: 0; + font-family: var(--font-mono); + font-size: 0.875rem; + line-height: 1.5rem; + white-space: pre; +} + +/* ── Nav Links ────────────────────────────────────────────────────── */ + +#sourcey .nav-group-label { + display: block; + padding: 0 0.75rem 0.25rem 1rem; + margin-bottom: 0.625rem; + font-size: inherit; + font-weight: 600; + color: rgb(var(--color-gray-900)); +} +.dark #sourcey .nav-group-label { + color: rgb(var(--color-gray-200)); +} +#sourcey .nav-group-link { + cursor: pointer; + border-radius: 0.75rem; + text-decoration: none; + transition: + color 0.15s, + background-color 0.15s; +} +#sourcey .nav-group-link:hover { + color: rgb(var(--color-primary-ink)); +} +.dark #sourcey .nav-group-link:hover { + color: rgb(var(--color-primary-light)); +} +#sourcey .nav-group-link.active { + color: rgb(var(--color-primary-ink)); +} +.dark #sourcey .nav-group-link.active { + color: rgb(var(--color-primary-light)); +} + +#sourcey .nav-tab-label { + display: block; + padding: 0.5rem 0.75rem 0.25rem 1rem; + font-size: 0.75rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.05em; + color: rgb(var(--color-gray-400)); +} +.dark #sourcey .nav-tab-label { + color: rgb(var(--color-gray-500)); +} + +#sourcey .nav-link { + display: flex; + align-items: flex-start; + padding: 0.375rem 0.75rem 0.375rem 1rem; + gap: 0.75rem; + cursor: pointer; + text-align: left; + overflow-wrap: break-word; + hyphens: auto; + border-radius: 0.75rem; + width: 100%; + color: rgb(var(--color-gray-700)); + transition: + color 0.15s, + background-color 0.15s; +} +.dark #sourcey .nav-link { + color: rgb(var(--color-gray-400)); +} +#sourcey .nav-link:hover { + color: rgb(var(--color-gray-900)); + background: rgb(var(--color-gray-100) / 0.6); +} +.dark #sourcey .nav-link:hover { + color: rgb(var(--color-gray-300)); + background: rgb(var(--color-gray-800) / 0.4); +} +#sourcey .nav-link.active { + color: rgb(var(--color-primary-ink)); + background: rgb(var(--color-primary) / 0.08); + text-shadow: + -0.2px 0 0 currentColor, + 0.2px 0 0 currentColor; +} +.dark #sourcey .nav-link.active { + color: rgb(var(--color-primary-light)); + background: rgb(var(--color-primary-light) / 0.08); +} + +/* ── TOC Active State ─────────────────────────────────────────────── */ + +#sourcey #toc .toc-item { + border-left: 2px solid rgb(var(--color-gray-200)); + padding-left: 0.75rem; + transition: + color 0.15s, + border-color 0.15s; +} +#sourcey #toc ul ul .toc-item { + margin-left: 0.75rem; + border-left: none; +} +.dark #sourcey #toc .toc-item { + border-left-color: rgb(var(--color-gray-700)); +} +#sourcey #toc .toc-item.active { + color: rgb(var(--color-primary-ink)); + border-left-color: rgb(var(--color-primary-ink)); + font-weight: 500; +} +.dark #sourcey #toc .toc-item.active { + color: rgb(var(--color-primary-light)); + border-left-color: rgb(var(--color-primary-light)); +} + +/* ── Code Block Panels (language dropdown + response tabs) ─────────── */ + +#sourcey .code-lang-panel { + display: none; +} +#sourcey .code-lang-panel.active { + display: block; +} + +#sourcey .lang-icon { + width: 0.875rem; + height: 0.875rem; + flex-shrink: 0; + vertical-align: -0.125rem; +} + +#sourcey .lang-icon[data-lang] { + display: inline-block; + background: currentColor; + -webkit-mask-size: contain; + mask-size: contain; + -webkit-mask-repeat: no-repeat; + mask-repeat: no-repeat; + -webkit-mask-position: center; + mask-position: center; +} + +#sourcey .response-panel { + display: none; +} +#sourcey .response-panel.active { + display: block; +} + +/* ── Response Tabs (status code tabs on code block) ───────────────── */ + +#sourcey .response-tab { + color: rgb(var(--color-gray-500)); + transition: color 0.15s; +} +.dark #sourcey .response-tab { + color: rgb(var(--color-gray-400)); +} + +#sourcey .response-tab.active { + color: rgb(var(--color-primary-ink)); +} +.dark #sourcey .response-tab.active { + color: rgb(var(--color-primary-light)); +} + +/* Active response tab underline */ +#sourcey .response-tab.active::after { + content: ""; + position: absolute; + right: 0; + bottom: -0.375rem; + left: 0; + height: 2px; + border-radius: 9999px; + background: rgb(var(--color-primary)); +} +.dark #sourcey .response-tab.active::after { + background: rgb(var(--color-primary-light)); +} + +/* ── Copy Button Feedback ─────────────────────────────────────────── */ + +#sourcey .copy-btn.copied { + color: rgb(var(--color-success)); +} + +/* ── Schema Utilities (used by SchemaView.tsx) ─────────────────────── */ + +/* ── Collapsible child attributes ── */ + +#sourcey .schema-expandable { + margin-top: 1rem; + border: 1px solid rgb(var(--color-gray-200) / 0.7); + border-radius: 0.75rem; +} +.dark #sourcey .schema-expandable { + border-color: rgb(255 255 255 / 0.1); +} + +#sourcey .schema-expandable-toggle { + display: flex; + align-items: center; + gap: 0.75rem; + padding: 0.75rem 1rem; + font-size: 0.875rem; + font-weight: 400; + color: rgb(var(--color-gray-600)); + cursor: pointer; + list-style: none; + user-select: none; +} +#sourcey .schema-expandable-toggle::-webkit-details-marker { + display: none; +} +.dark #sourcey .schema-expandable-toggle { + color: rgb(var(--color-gray-300)); +} +#sourcey .schema-expandable-toggle:hover { + background: rgb(var(--color-gray-100) / 0.5); + color: rgb(var(--color-gray-900)); + border-radius: 0.75rem; +} +.dark #sourcey .schema-expandable-toggle:hover { + background: rgb(255 255 255 / 0.05); + color: rgb(var(--color-gray-200)); +} + +#sourcey .schema-expandable-icon { + width: 0.625rem; + height: 0.625rem; + flex-shrink: 0; + transition: transform 75ms; + color: rgb(var(--color-gray-400)); +} +#sourcey details[open] > .schema-expandable-toggle > .schema-expandable-icon { + transform: rotate(90deg); +} + +#sourcey .schema-expandable-content { + padding: 0 1rem 0.5rem; + border-top: 1px solid rgb(var(--color-gray-100)); +} +.dark #sourcey .schema-expandable-content { + border-top-color: rgb(255 255 255 / 0.1); +} + +/* Legacy schema-nested — kept for variant nesting */ +#sourcey .schema-nested { + padding-left: 1rem; + border-left: 2px solid rgb(var(--color-gray-200)); + margin-top: 0.25rem; + margin-bottom: 0.25rem; +} +.dark #sourcey .schema-nested { + border-left-color: rgb(var(--color-gray-800)); +} + +#sourcey .schema-variant-option { + padding-left: 1rem; + border-left: 2px solid rgb(var(--color-gray-200)); + margin-bottom: 0.5rem; +} +.dark #sourcey .schema-variant-option { + border-left-color: rgb(var(--color-gray-800)); +} + +#sourcey .schema-variant-label { + font-size: 0.75rem; + font-weight: 600; + letter-spacing: 0.05em; + color: rgb(var(--color-gray-400)); + margin-bottom: 0.25rem; +} + +/* ── Type Display (used by SchemaDatatype.tsx) ─────────────────────── */ + +#sourcey .json-property-type { + display: inline-flex; + align-items: center; + font-style: normal; + font-weight: 500; + font-size: 0.75rem; + line-height: 1; + white-space: nowrap; + color: rgb(var(--color-gray-600)); + background: rgb(var(--color-gray-100) / 0.5); + padding: 0.25rem 0.5rem; + border-radius: 0.375rem; +} +.dark #sourcey .json-property-type { + background: rgb(var(--color-surface-dark-tint) / 0.05); + color: rgb(var(--color-gray-200)); +} + +#sourcey .json-property-format { + font-size: 0.75rem; + color: rgb(var(--color-gray-400)); +} + +#sourcey .json-property-enum { + display: inline-flex; + align-items: baseline; + gap: 0.25rem; + flex-wrap: wrap; +} + +#sourcey .json-property-enum-item, +#sourcey .json-property-default-value, +#sourcey .json-property-range { + display: inline-flex; + align-items: center; + font-size: 0.6875rem; + font-family: var(--font-mono); + line-height: 1; + white-space: nowrap; + color: rgb(var(--color-gray-500)); + background: rgb(var(--color-gray-100) / 0.5); + padding: 0.125rem 0.375rem; + border-radius: 9999px; +} +.dark #sourcey .json-property-enum-item, +.dark #sourcey .json-property-default-value, +.dark #sourcey .json-property-range { + background: rgb(var(--color-surface-dark-tint) / 0.05); + color: rgb(var(--color-gray-400)); +} + +#sourcey .json-property-enum-item { + color: rgb(var(--color-gray-700)); +} +.dark #sourcey .json-property-enum-item { + color: rgb(var(--color-gray-300)); +} + +#sourcey .json-property-default-value::before { + content: "= "; + color: rgb(var(--color-gray-400)); +} + +/* ── Parameter/Schema List (used by SchemaView.tsx, Parameters.tsx) ── */ + +#sourcey .param-item { + padding: 1rem 0; + border-bottom: 1px solid rgb(var(--color-gray-100)); +} +.dark #sourcey .param-item { + border-bottom-color: rgb(var(--color-gray-800)); +} + +#sourcey .param-item:last-child { + border-bottom: none; +} + +#sourcey .param-header { + display: flex; + align-items: baseline; + gap: 0.5rem; + flex-wrap: wrap; +} + +#sourcey .param-name { + font-family: var(--font-mono); + font-size: 0.875rem; + font-weight: 600; + color: rgb(var(--color-primary-ink)); + background: transparent; + border: none; + padding: 0; +} +.dark #sourcey .param-name { + color: rgb(var(--color-primary-light)); +} + +#sourcey .param-type { + display: inline-flex; + align-items: baseline; + gap: 0.375rem; +} + +#sourcey .param-in { + display: inline-flex; + align-items: center; + padding: 0.125rem 0.5rem; + font-size: 0.75rem; + font-weight: 500; + border-radius: 0.375rem; + background: rgb(var(--color-gray-100) / 0.5); + color: rgb(var(--color-gray-600)); + margin-left: auto; +} +.dark #sourcey .param-in { + background: rgb(var(--color-surface-dark-tint) / 0.05); + color: rgb(var(--color-gray-200)); +} + +#sourcey .param-description { + padding-top: 0.5rem; + font-size: 0.875rem; + color: rgb(var(--color-gray-700)); +} +.dark #sourcey .param-description { + color: rgb(var(--color-gray-400)); +} + +/* ── Steps (numbered step list with vertical connector) ────────────── */ + +#sourcey .steps { + margin-left: 0.875rem; + margin-top: 1rem; + margin-bottom: 1.5rem; +} + +#sourcey .steps .step-item { + position: relative; + display: flex; + align-items: flex-start; + padding-bottom: 1.25rem; +} + +#sourcey .steps .step-item::before { + content: ""; + position: absolute; + left: 13px; + top: 2.75rem; + bottom: 0; + width: 1px; + background: rgb(var(--color-gray-200) / 0.7); +} +.dark #sourcey .steps .step-item::before { + background: rgb(255 255 255 / 0.1); +} + +#sourcey .steps .step-item:last-child::before { + background: linear-gradient(to bottom, rgb(var(--color-gray-200) / 0.7), transparent); +} +.dark #sourcey .steps .step-item:last-child::before { + background: linear-gradient(to bottom, rgb(255 255 255 / 0.1), transparent); +} + +#sourcey .steps .step-number { + position: relative; + display: flex; + align-items: center; + justify-content: center; + width: 1.75rem; + height: 1.75rem; + flex-shrink: 0; + border-radius: 9999px; + background: rgb(var(--color-gray-50)); + font-size: 0.75rem; + font-weight: 600; + color: rgb(var(--color-gray-900)); + margin-top: 0.5rem; +} +.dark #sourcey .steps .step-number { + background: rgb(255 255 255 / 0.1); + color: rgb(var(--color-gray-50)); +} + +#sourcey .steps .step-body { + padding-left: 1rem; + flex: 1; + overflow: hidden; +} + +#sourcey .steps .step-title { + margin-top: 0.5rem; + font-weight: 600; + color: rgb(var(--color-gray-900)); +} +.dark #sourcey .steps .step-title { + color: rgb(var(--color-gray-200)); +} + +#sourcey .steps .step-content { + margin-top: 0.25rem; +} + +#sourcey .steps .step-content p { + margin: 0.25rem 0; +} + +/* ── Card Group (icon cards in a grid) ─────────────────────────────── */ + +#sourcey .card-group { + display: grid; + gap: 1rem; + margin-top: 1.25rem; + margin-bottom: 2rem; +} +@media (min-width: 640px) { + #sourcey .card-group[data-cols="2"] { + grid-template-columns: repeat(2, 1fr); + } + #sourcey .card-group[data-cols="3"] { + grid-template-columns: repeat(3, 1fr); + } + #sourcey .card-group[data-cols="4"] { + grid-template-columns: repeat(4, 1fr); + } +} + +#sourcey .card-item { + display: block; + position: relative; + border: 1px solid rgb(var(--color-gray-950) / 0.1); + border-radius: var(--radius); + padding: 1.25rem 1.5rem; + background: rgb(var(--color-background-light)); + text-decoration: none; + color: inherit; + cursor: pointer; + overflow: hidden; + transition: border-color 0.15s; +} +.dark #sourcey .card-item { + border-color: rgb(255 255 255 / 0.1); + background: rgb(var(--color-background-dark)); +} + +#sourcey .card-item:hover { + border-color: rgb(var(--color-primary)); +} +.dark #sourcey .card-item:hover { + border-color: rgb(var(--color-primary-light)); +} + +#sourcey .card-icon { + width: 1.5rem; + height: 1.5rem; + flex-shrink: 0; + color: rgb(var(--color-primary)); + margin-bottom: 0.75rem; +} +.dark #sourcey .card-icon { + color: rgb(var(--color-primary-light)); +} + +#sourcey .card-item-title { + font-size: 1rem; + font-weight: 600; + color: rgb(var(--color-gray-800)); + margin: 0 0 0.25rem; +} +.dark #sourcey .card-item-title { + color: #fff; +} + +#sourcey .card-item-content { + margin-top: 0.25rem; + font-size: 1rem; + line-height: 1.5; + color: rgb(var(--color-gray-600)); +} +.dark #sourcey .card-item-content { + color: rgb(var(--color-gray-400)); +} + +#sourcey .card-item-content p { + margin: 0; +} + +/* ── Accordion (expandable details) ────────────────────────────────── */ + +#sourcey .accordion-group { + margin-top: 0; + margin-bottom: 0.75rem; + border-radius: var(--radius); + border: 1px solid rgb(var(--color-gray-200) / 0.7); + overflow: hidden; +} +.dark #sourcey .accordion-group { + border-color: rgb(var(--color-gray-800) / 0.5); +} + +#sourcey .accordion-item { + border-bottom: 1px solid rgb(var(--color-gray-200) / 0.7); + background: rgb(var(--color-background-light)); +} +.dark #sourcey .accordion-item { + border-bottom-color: rgb(var(--color-gray-800) / 0.5); + background: rgb(var(--color-code-block-dark)); +} + +#sourcey .accordion-item:last-child { + border-bottom: none; +} + +#sourcey .accordion-trigger { + display: flex; + align-items: center; + gap: 0.5rem; + width: 100%; + padding: 1rem 1.25rem; + cursor: pointer; + font-weight: 500; + color: rgb(var(--color-gray-900)); + list-style: none; +} +#sourcey .accordion-trigger::-webkit-details-marker { + display: none; +} +.dark #sourcey .accordion-trigger { + color: rgb(var(--color-gray-200)); +} + +#sourcey .accordion-trigger:hover { + background: rgb(var(--color-gray-100)); +} +.dark #sourcey .accordion-trigger:hover { + background: rgb(var(--color-gray-800)); +} + +#sourcey .accordion-trigger::before { + content: ""; + display: inline-block; + width: 0.75rem; + height: 0.75rem; + flex-shrink: 0; + background: rgb(var(--color-gray-700)); + mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 512'%3E%3Cpath d='M246.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-9.2-9.2-22.9-11.9-34.9-6.9s-19.8 16.6-19.8 29.6l0 256c0 12.9 7.8 24.6 19.8 29.6s25.7 2.2 34.9-6.9l128-128z'/%3E%3C/svg%3E"); + mask-repeat: no-repeat; + mask-position: center; + mask-size: contain; + transition: transform 0.15s; +} +.dark #sourcey .accordion-trigger::before { + background: rgb(var(--color-gray-400)); +} + +#sourcey .accordion-item[open] > .accordion-trigger::before { + transform: rotate(90deg); +} + +#sourcey .accordion-content { + padding: 0 1.25rem 1rem 2.5rem; + color: rgb(var(--color-gray-700)); +} +.dark #sourcey .accordion-content { + color: rgb(var(--color-gray-400)); +} + +#sourcey .accordion-content p { + margin: 0.25rem 0; +} + +/* ── Callouts (:::note, :::warning, :::tip, :::info) ───────────────── */ + +#sourcey .callout { + margin: 1.25rem 0; + border: none; + border-left: 2px solid; + border-radius: 0; + padding: 0.875rem 1rem; + font-size: 0.875rem; + line-height: 1.6; + color: rgb(var(--color-gray-700)); + border-left-color: rgb(var(--color-gray-300)); +} +.dark #sourcey .callout { + border-left-color: rgb(var(--color-gray-700)); + color: rgb(var(--color-gray-400)); +} + +#sourcey .callout-title { + font-weight: 600; + font-size: 0.8125rem; + text-transform: uppercase; + letter-spacing: 0.04em; +} + +/* Remove bottom margin when no content follows */ +#sourcey .callout-title:last-child { + margin-bottom: 0; +} + +#sourcey .callout-content { + margin-top: 0.375rem; +} + +#sourcey .callout-content p { + margin: 0.25rem 0; +} + +#sourcey .callout-content p:last-child { + margin-bottom: 0; +} + +/* Note — blue */ +#sourcey .callout-note { + border-left-color: #3b82f6; +} +.dark #sourcey .callout-note { + border-left-color: #60a5fa; +} +#sourcey .callout-note .callout-title { + color: #3b82f6; +} +.dark #sourcey .callout-note .callout-title { + color: #60a5fa; +} + +/* Warning — amber */ +#sourcey .callout-warning { + border-left-color: #f59e0b; +} +.dark #sourcey .callout-warning { + border-left-color: #fbbf24; +} +#sourcey .callout-warning .callout-title { + color: #f59e0b; +} +.dark #sourcey .callout-warning .callout-title { + color: #fbbf24; +} + +/* ── Changelog ───────────────────────────────────────────────────── */ + +#sourcey .sourcey-changelog-page { + width: 100%; +} + +#sourcey .sourcey-changelog-header { + margin-bottom: 2rem; +} + +#sourcey .sourcey-changelog-description { + margin-top: 0.75rem; + font-size: 1.05rem; + line-height: 1.7; + color: rgb(var(--color-gray-600)); + max-width: 65ch; + text-wrap: pretty; +} + +.dark #sourcey .sourcey-changelog-description { + color: rgb(var(--color-gray-400)); +} + +#sourcey .sourcey-changelog-description a { + color: rgb(var(--color-primary-ink)); + text-decoration: none; + border-bottom: 1px solid rgb(var(--color-primary-ink) / 0.3); +} + +#sourcey .sourcey-changelog-description a:hover { + border-bottom-color: rgb(var(--color-primary-ink)); +} + +.dark #sourcey .sourcey-changelog-description a { + color: rgb(var(--color-primary-light)); + border-bottom-color: rgb(var(--color-primary-light) / 0.3); +} + +.dark #sourcey .sourcey-changelog-description a:hover { + border-bottom-color: rgb(var(--color-primary-light)); +} + +#sourcey .sourcey-changelog-description code { + font-size: 0.92em; + padding: 0.05rem 0.3rem; + border-radius: 0.25rem; + background: rgb(var(--color-gray-100)); + color: rgb(var(--color-gray-800)); +} + +.dark #sourcey .sourcey-changelog-description code { + background: rgb(255 255 255 / 0.08); + color: rgb(var(--color-gray-200)); +} + +#sourcey .sourcey-changelog-list { + display: flex; + flex-direction: column; + gap: 1rem; +} + +#sourcey .sourcey-changelog-version { + border: 1px solid rgb(var(--color-gray-200) / 0.8); + border-radius: 1rem; + padding: 1.25rem 1.25rem 1rem; + background: linear-gradient(180deg, rgb(var(--color-gray-50) / 0.75), rgb(255 255 255)); +} + +.dark #sourcey .sourcey-changelog-version { + border-color: rgb(var(--color-gray-800) / 0.8); + background: linear-gradient(180deg, rgb(255 255 255 / 0.03), rgb(255 255 255 / 0.015)); +} + +#sourcey .sourcey-changelog-version-unreleased { + border-color: rgb(var(--color-primary) / 0.18); + border-left: 3px solid rgb(var(--color-primary)); + padding-left: calc(1.25rem - 2px); + background: linear-gradient( + 180deg, + rgb(var(--color-primary) / 0.04), + rgb(var(--color-primary) / 0.015) + ); +} + +.dark #sourcey .sourcey-changelog-version-unreleased { + border-color: rgb(var(--color-primary-light) / 0.22); + border-left-color: rgb(var(--color-primary-light)); + background: linear-gradient( + 180deg, + rgb(var(--color-primary-light) / 0.06), + rgb(var(--color-primary-light) / 0.02) + ); +} + +#sourcey .sourcey-changelog-version-header { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 1rem; + margin-bottom: 1rem; +} + +@media (max-width: 768px) { + #sourcey .sourcey-changelog-version-header { + flex-direction: column; + } +} + +#sourcey .sourcey-changelog-version-heading { + display: flex; + align-items: center; + gap: 0.5rem; + flex-wrap: wrap; +} + +#sourcey .sourcey-changelog-version-link { + font-size: 1.25rem; + font-weight: 700; + color: rgb(var(--color-gray-900)); + text-decoration: none; +} + +.dark #sourcey .sourcey-changelog-version-link { + color: rgb(var(--color-gray-200)); +} + +#sourcey .sourcey-changelog-version-link:hover { + color: rgb(var(--color-primary-ink)); +} + +.dark #sourcey .sourcey-changelog-version-link:hover { + color: rgb(var(--color-primary-light)); +} + +#sourcey .sourcey-changelog-version-meta { + display: flex; + align-items: center; + gap: 0.75rem; + font-size: 0.925rem; + color: rgb(var(--color-gray-500)); +} + +.dark #sourcey .sourcey-changelog-version-meta { + color: rgb(var(--color-gray-400)); +} + +#sourcey .sourcey-changelog-compare-link { + color: rgb(var(--color-primary-ink)); + text-decoration: none; +} + +.dark #sourcey .sourcey-changelog-compare-link { + color: rgb(var(--color-primary-light)); +} + +#sourcey .sourcey-changelog-pill { + display: inline-flex; + align-items: center; + border-radius: 999px; + padding: 0.15rem 0.5rem; + font-size: 0.72rem; + font-weight: 700; + letter-spacing: 0.03em; +} + +#sourcey .sourcey-changelog-pill-yanked { + background: rgb(239 68 68 / 0.12); + color: rgb(185 28 28); +} + +.dark #sourcey .sourcey-changelog-pill-yanked { + background: rgb(248 113 113 / 0.15); + color: rgb(252 165 165); +} + +#sourcey .sourcey-changelog-pill-pre { + background: rgb(var(--color-gray-100)); + color: rgb(var(--color-gray-600)); +} + +.dark #sourcey .sourcey-changelog-pill-pre { + background: rgb(255 255 255 / 0.08); + color: rgb(var(--color-gray-300)); +} + +#sourcey .sourcey-changelog-pill-next { + background: rgb(var(--color-primary) / 0.1); + color: rgb(var(--color-primary-ink)); + text-transform: uppercase; + letter-spacing: 0.06em; + font-size: 0.68rem; +} + +.dark #sourcey .sourcey-changelog-pill-next { + background: rgb(var(--color-primary-light) / 0.14); + color: rgb(var(--color-primary-light)); +} + +#sourcey .sourcey-changelog-summary { + margin-bottom: 1rem; +} + +#sourcey .sourcey-changelog-summary p:first-child { + margin-top: 0; +} + +#sourcey .sourcey-changelog-sections { + display: flex; + flex-direction: column; + gap: 0.875rem; +} + +#sourcey .sourcey-changelog-section { + display: flex; + flex-direction: column; + gap: 0.5rem; +} + +#sourcey .sourcey-changelog-section-header { + display: flex; + align-items: center; + gap: 0.5rem; +} + +#sourcey .sourcey-changelog-entry-list { + margin: 0; + padding-left: 1.25rem; + color: rgb(var(--color-gray-700)); +} + +.dark #sourcey .sourcey-changelog-entry-list { + color: rgb(var(--color-gray-300)); +} + +#sourcey .sourcey-changelog-entry-list li { + margin: 0.35rem 0; +} + +#sourcey .sourcey-changelog-entry-list li > p { + margin: 0; +} + +#sourcey .sourcey-changelog-badge { + text-transform: none; +} + +#sourcey .sourcey-changelog-badge-added { + background: rgb(var(--color-success) / 0.12); + color: rgb(21 128 61); +} + +.dark #sourcey .sourcey-changelog-badge-added { + background: rgb(var(--color-success) / 0.16); + color: rgb(134 239 172); +} + +#sourcey .sourcey-changelog-badge-changed { + background: rgb(var(--color-primary) / 0.12); + color: rgb(var(--color-primary-ink)); +} + +.dark #sourcey .sourcey-changelog-badge-changed { + background: rgb(var(--color-primary-light) / 0.12); + color: rgb(var(--color-primary-light)); +} + +#sourcey .sourcey-changelog-badge-fixed { + background: rgb(245 158 11 / 0.14); + color: rgb(180 83 9); +} + +.dark #sourcey .sourcey-changelog-badge-fixed { + background: rgb(251 191 36 / 0.16); + color: rgb(253 224 71); +} + +#sourcey .sourcey-changelog-badge-removed, +#sourcey .sourcey-changelog-badge-security { + background: rgb(239 68 68 / 0.12); + color: rgb(185 28 28); +} + +.dark #sourcey .sourcey-changelog-badge-removed, +.dark #sourcey .sourcey-changelog-badge-security { + background: rgb(248 113 113 / 0.16); + color: rgb(252 165 165); +} + +#sourcey .sourcey-changelog-badge-deprecated, +#sourcey .sourcey-changelog-badge-other { + background: rgb(var(--color-gray-100)); + color: rgb(var(--color-gray-600)); +} + +.dark #sourcey .sourcey-changelog-badge-deprecated, +.dark #sourcey .sourcey-changelog-badge-other { + background: rgb(255 255 255 / 0.08); + color: rgb(var(--color-gray-300)); +} + +/* Tip — green */ +#sourcey .callout-tip { + border-left-color: #22c55e; +} +.dark #sourcey .callout-tip { + border-left-color: #4ade80; +} +#sourcey .callout-tip .callout-title { + color: #22c55e; +} +.dark #sourcey .callout-tip .callout-title { + color: #4ade80; +} + +/* Info — violet */ +#sourcey .callout-info { + border-left-color: #8b5cf6; +} +.dark #sourcey .callout-info { + border-left-color: #a78bfa; +} +#sourcey .callout-info .callout-title { + color: #8b5cf6; +} +.dark #sourcey .callout-info .callout-title { + color: #a78bfa; +} + +/* ── Directive Tabs (:::tabs, :::code-group) ───────────────────────── */ + +#sourcey .directive-tabs { + margin: 1.25rem 0; + border: 1px solid rgb(var(--color-stone-950) / 0.1); + border-radius: var(--radius); + overflow: hidden; +} +.dark #sourcey .directive-tabs { + border-color: rgb(255 255 255 / 0.1); +} + +#sourcey .directive-tab-bar { + display: flex; + gap: 0; + border-bottom: 1px solid rgb(var(--color-stone-200)); + background: rgb(var(--color-stone-50)); + padding: 0 0.25rem; +} +.dark #sourcey .directive-tab-bar { + border-bottom-color: rgb(255 255 255 / 0.06); + background: rgb(var(--color-code-block-dark)); +} + +#sourcey .directive-tab { + position: relative; + padding: 0.625rem 1rem; + font-size: 0.8125rem; + font-weight: 500; + color: rgb(var(--color-stone-500)); + background: transparent; + border: none; + cursor: pointer; + transition: color 0.15s; +} +#sourcey .directive-tab:hover { + color: rgb(var(--color-gray-900)); +} +.dark #sourcey .directive-tab:hover { + color: rgb(var(--color-gray-300)); +} + +#sourcey .directive-tab.active { + color: rgb(var(--color-primary-ink)); +} +.dark #sourcey .directive-tab.active { + color: rgb(var(--color-primary-light)); +} + +#sourcey .directive-tab.active::after { + content: ""; + position: absolute; + right: 0.5rem; + bottom: -1px; + left: 0.5rem; + height: 2px; + border-radius: 9999px; + background: rgb(var(--color-primary)); +} +.dark #sourcey .directive-tab.active::after { + background: rgb(var(--color-primary-light)); +} + +#sourcey .directive-tab-panel { + display: none; + padding: 1rem 1.25rem; +} + +#sourcey .directive-tab-panel.active { + display: block; +} + +/* Code group: tighter padding, code blocks fill the panel */ +#sourcey .directive-code-group .directive-tab-panel { + padding: 0; +} + +#sourcey .directive-code-group .directive-tab-panel pre { + margin: 0; + border-radius: 0; +} + +/* Strip nested code block chrome inside tab panels */ +#sourcey .directive-tabs .prose-code-block { + border: none; + border-radius: 0; + margin: 0; +} + +#sourcey .directive-tabs .prose-code-block .prose-code-copy { + display: none; +} + +/* ── Mobile navigation drawer (dialog) ────────────────────────────── */ + +.mobile-nav-dialog { + padding: 0; + border: none; + max-width: 20rem; + width: 80%; + height: 100%; + max-height: 100%; + margin: 0; + overflow-y: auto; + font-family: var(--font-sans); + font-size: 0.875rem; + line-height: 1.5rem; + background: rgb(var(--color-background-light)); + color: rgb(var(--color-gray-500)); +} +.mobile-nav-dialog[open] { + display: flex; + flex-direction: column; +} +.dark .mobile-nav-dialog { + background: rgb(var(--color-background-dark)); + color: rgb(var(--color-gray-400)); +} +.mobile-nav-dialog::backdrop { + background: rgb(0 0 0 / 0.25); + backdrop-filter: blur(2px); +} +.mobile-nav-dialog[open] { + animation: drawer-slide-in 0.2s ease-out; +} +.mobile-nav-dialog[open]::backdrop { + animation: drawer-fade-in 0.2s ease-out; +} + +/* ── Drawer group dropdown ─────────────────────────────────────────── */ + +.drawer-dropdown { + position: relative; +} + +.drawer-dropdown-trigger { + position: relative; + z-index: 11; + display: flex; + align-items: center; + justify-content: space-between; + gap: 0.5rem; + width: 100%; + padding: 0.625rem 1.125rem; + border-radius: var(--radius, 0.5rem); + font-size: 1rem; + font-weight: 600; + font-family: var(--font-sans); + color: rgb(var(--color-gray-900)); + background: rgb(var(--color-background-light)); + border: none; + box-shadow: inset 0 0 0 1px rgb(var(--color-gray-200)); + cursor: pointer; + text-align: left; +} +.dark .drawer-dropdown-trigger { + color: rgb(var(--color-gray-200)); + background: rgb(var(--color-background-dark)); + box-shadow: inset 0 0 0 1px rgb(var(--color-gray-600)); +} +.drawer-dropdown-trigger[aria-expanded="true"] { + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + box-shadow: + inset 1px 0 0 rgb(var(--color-gray-200)), + inset -1px 0 0 rgb(var(--color-gray-200)), + inset 0 1px 0 rgb(var(--color-gray-200)); +} +.dark .drawer-dropdown-trigger[aria-expanded="true"] { + box-shadow: + inset 1px 0 0 rgb(var(--color-gray-600)), + inset -1px 0 0 rgb(var(--color-gray-600)), + inset 0 1px 0 rgb(var(--color-gray-600)); +} + +.drawer-dropdown-chevron { + color: rgb(var(--color-gray-400)); + transition: transform 0.15s ease; + flex-shrink: 0; +} +.drawer-dropdown-trigger[aria-expanded="true"] .drawer-dropdown-chevron { + transform: rotate(180deg); +} + +.drawer-dropdown-list { + position: absolute; + top: 100%; + left: 0; + right: 0; + z-index: 10; + list-style: none; + margin: 0; + padding: 0.375rem 0; + border-radius: 0 0 var(--radius, 0.5rem) var(--radius, 0.5rem); + background: rgb(var(--color-background-light)); + border: none; + box-shadow: + inset 1px 0 0 rgb(var(--color-gray-200)), + inset -1px 0 0 rgb(var(--color-gray-200)), + inset 0 -1px 0 rgb(var(--color-gray-200)), + 0 6px 16px rgb(0 0 0 / 0.08); +} +.dark .drawer-dropdown-list { + background: rgb(var(--color-background-dark)); + box-shadow: + inset 1px 0 0 rgb(var(--color-gray-600)), + inset -1px 0 0 rgb(var(--color-gray-600)), + inset 0 -1px 0 rgb(var(--color-gray-600)), + 0 6px 16px rgb(0 0 0 / 0.3); +} + +.drawer-dropdown-item { + display: block; + width: 100%; + padding: 0.5rem 1.125rem; + font-size: 1rem; + font-family: var(--font-sans); + text-align: left; + color: rgb(var(--color-gray-600)); + background: none; + border: none; + cursor: pointer; +} +.drawer-dropdown-item:hover { + background: rgb(var(--color-gray-50)); +} +.dark .drawer-dropdown-item { + color: rgb(var(--color-gray-400)); +} +.dark .drawer-dropdown-item:hover { + background: rgb(var(--color-gray-800)); +} +.drawer-dropdown-item.active { + color: rgb(var(--color-primary-ink)); + font-weight: 500; +} +.dark .drawer-dropdown-item.active { + color: rgb(var(--color-primary-light)); +} + +/* Drawer nav items — larger touch targets */ +#sourcey .mobile-nav-dialog .nav-link, +#sourcey .mobile-nav-dialog .nav-link:hover, +#sourcey .mobile-nav-dialog .nav-link.active { + padding-top: 0.5rem; + padding-bottom: 0.5rem; +} +.mobile-nav-dialog ul { + display: flex; + flex-direction: column; + gap: 0.125rem; +} + +@keyframes drawer-slide-in { + from { + transform: translateX(-100%); + } + to { + transform: translateX(0); + } +} +@keyframes drawer-fade-in { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +/* ── Code group cards (API right-hand panels) ─────────────────────── */ + +#sourcey .code-group { + position: relative; + display: flex; + flex-direction: column; + /* Visible so an open header dropdown menu is not clipped by the card; the + code body's rounded corners are clipped by .code-card-body instead. */ + overflow: visible; + border-radius: var(--radius); + border: 1px solid rgb(var(--color-stone-950) / 0.1); +} +.dark #sourcey .code-group { + border-color: rgb(255 255 255 / 0.1); +} + +#sourcey .code-group > div:first-child { + background: rgb(var(--color-stone-50)); + border-top-left-radius: var(--radius); + border-top-right-radius: var(--radius); +} +.dark #sourcey .code-group > div:first-child { + background: rgb(255 255 255 / 0.03); +} + +/* Clips the code panels' rounded bottom corners now that the card itself does + not clip. Horizontal code scrolling stays on the inner body element. */ +#sourcey .code-card-body { + overflow: hidden; + border-bottom-left-radius: var(--radius); + border-bottom-right-radius: var(--radius); +} + +#sourcey .code-lang-menu { + max-height: min(18rem, calc(100vh - var(--header-height, 0px) - 2rem)); + overflow-y: auto; + overscroll-behavior: contain; +} + +/* ── Print/PDF output ─────────────────────────────────────────────── */ + +@media print { + @page { + margin: 0.7in; + } + + html, + body, + #sourcey, + #sourcey #page, + #sourcey #docs { + background: #fff !important; + color: #111827 !important; + } + + #sourcey #page::before, + #sourcey #navbar, + #sourcey #toc, + #sourcey #search-dialog, + #sourcey .mobile-nav-dialog, + #sourcey .copy-btn, + #sourcey .prose-code-copy, + #sourcey .code-lang-dropdown { + display: none !important; + } + + #sourcey .max-w-\[92rem\], + #sourcey .max-w-3xl { + max-width: none !important; + margin: 0 !important; + padding: 0 !important; + } + + #sourcey #docs { + padding-top: 0 !important; + } + + #sourcey #docs > .flex, + #sourcey #docs [class*="lg:flex-row"], + #sourcey #docs [class*="xl:flex-row"] { + display: block !important; + } + + #sourcey #content-area { + width: 100% !important; + max-width: none !important; + margin: 0 !important; + padding: 0 !important; + } + + #sourcey #sidebar { + display: block !important; + position: static !important; + inset: auto !important; + width: auto !important; + margin: 0 0 1.5rem !important; + padding: 0 0 1rem !important; + border-bottom: 1px solid #e5e7eb; + } + + #sourcey #sidebar > div { + position: static !important; + inset: auto !important; + overflow: visible !important; + padding: 0 !important; + } + + #sourcey #sidebar .sticky { + display: none !important; + } + + #sourcey #sidebar #nav::before { + content: "Table of Contents"; + display: block; + margin: 0 0 0.75rem; + font-size: 0.875rem; + font-weight: 700; + color: #111827; + } + + #sourcey #sidebar .nav-group-label, + #sourcey #sidebar .nav-link { + color: #111827 !important; + background: transparent !important; + } + + #sourcey #sidebar .nav-link { + padding: 0.125rem 0 !important; + } + + #sourcey #docs article aside { + display: none !important; + } + + #sourcey #docs [class*="lg:hidden"], + #sourcey #docs [class*="xl:hidden"] { + display: block !important; + } + + #sourcey .code-group, + #sourcey .prose-code-block, + #sourcey .param-item, + #sourcey .schema-expandable, + #sourcey .sourcey-changelog-version { + break-inside: avoid; + } + + #sourcey .code-group, + #sourcey .prose-code-block, + #sourcey .prose-code-content, + #sourcey .code-card-body, + #sourcey .code-card-body > div, + #sourcey .code-card-body .font-mono { + background: #fff !important; + color: #111827 !important; + } + + #sourcey a { + color: #111827 !important; + text-decoration: underline; + } +} + +/* ── Selection ─────────────────────────────────────────────────────── */ + +#sourcey ::selection { + background: rgb(var(--color-primary) / 0.12); +} + +/* ── Search Dialog ────────────────────────────────────────────────── */ + +#sourcey #search-dialog { + display: none; + position: fixed; + inset: 0; + z-index: 500; + background: transparent; +} + +#sourcey #search-dialog.open { + display: block; +} + +#sourcey .search-dialog-inner { + position: absolute; + background: rgb(var(--color-background-light)); + border-radius: var(--radius); + border: 1px solid rgb(var(--color-gray-200) / 0.7); + box-shadow: 0 8px 32px rgb(var(--color-overlay) / 0.12); + overflow: hidden; +} +.dark #sourcey .search-dialog-inner { + background: rgb(var(--color-gray-900)); + border-color: rgb(var(--color-gray-700) / 0.5); + box-shadow: 0 8px 32px rgb(var(--color-overlay) / 0.4); +} + +#sourcey .search-input-row { + display: flex; + align-items: center; + gap: 0.625rem; + padding: 0.75rem 1rem; + border-bottom: 1px solid rgb(var(--color-gray-200)); +} +.dark #sourcey .search-input-row { + border-bottom-color: rgb(var(--color-gray-800)); +} + +#sourcey .search-input-icon { + width: 1.125rem; + height: 1.125rem; + flex-shrink: 0; + color: rgb(var(--color-gray-400)); +} + +#sourcey #search-input { + width: 100%; + border: none; + font-family: var(--font-sans); + font-size: 0.9375rem; + color: rgb(var(--color-gray-900)); + background: transparent; + outline: none; +} +.dark #sourcey #search-input { + color: rgb(var(--color-gray-100)); +} + +#sourcey #search-input::placeholder { + color: rgb(var(--color-gray-400)); +} + +#sourcey #search-results { + max-height: 50vh; + overflow-y: auto; + padding: 0.25rem; +} + +#sourcey .search-category { + padding: 0.5rem 0.75rem 0.25rem; + font-size: 0.6875rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.05em; + color: rgb(var(--color-gray-400)); +} + +#sourcey .search-footer { + display: flex; + align-items: center; + gap: 1rem; + padding: 0.5rem 0.75rem; + border-top: 1px solid rgb(var(--color-gray-200)); + font-size: 0.6875rem; + color: rgb(var(--color-gray-400)); +} +.dark #sourcey .search-footer { + border-top-color: rgb(var(--color-gray-800)); +} + +#sourcey .search-footer-hint { + display: flex; + align-items: center; + gap: 0.25rem; +} + +#sourcey .search-footer kbd, +#sourcey #search-open kbd { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 1.25rem; + height: 1.125rem; + padding: 0 0.25rem; + font-family: var(--font-sans); + font-size: 0.625rem; + font-weight: 500; + border-radius: 0.25rem; + border: 1px solid rgb(var(--color-gray-200)); + background: rgb(var(--color-gray-50)); + color: rgb(var(--color-gray-500)); +} +.dark #sourcey .search-footer kbd, +.dark #sourcey #search-open kbd { + border-color: rgb(var(--color-gray-700)); + background: rgb(var(--color-gray-800)); + color: rgb(var(--color-gray-400)); +} + +#sourcey .search-result { + display: flex; + align-items: baseline; + gap: 0.5rem; + padding: 0.5rem 0.75rem; + text-decoration: none; + color: rgb(var(--color-gray-700)); + border-radius: 0.375rem; + cursor: pointer; + transition: background 0.1s; +} +.dark #sourcey .search-result { + color: rgb(var(--color-gray-400)); +} + +#sourcey .search-result:hover, +#sourcey .search-result.active { + background: rgb(var(--color-primary) / 0.06); + color: rgb(var(--color-gray-900)); +} +.dark #sourcey .search-result:hover, +.dark #sourcey .search-result.active { + background: rgb(var(--color-primary-light) / 0.08); + color: rgb(var(--color-gray-200)); +} + +#sourcey .search-result-main { + display: flex; + align-items: baseline; + gap: 0.375rem; + flex: 1; + min-width: 0; +} + +#sourcey .search-result-method { + display: inline-flex; + align-items: center; + padding: 0.125rem 0.375rem; + font-size: 0.625rem; + font-weight: 700; + line-height: 1; + letter-spacing: 0.04em; + text-transform: uppercase; + white-space: nowrap; + border: 1px solid transparent; + border-radius: 3px; + color: rgb(var(--color-background-light)); + flex-shrink: 0; +} + +#sourcey .search-result-method.method-get { + background: var(--method-get); +} +#sourcey .search-result-method.method-post { + background: var(--method-post); +} +#sourcey .search-result-method.method-put { + background: var(--method-put); +} +#sourcey .search-result-method.method-delete { + background: var(--method-delete); +} +#sourcey .search-result-method.method-patch { + background: var(--method-patch); +} +#sourcey .search-result-method.method-tool { + background: var(--method-tool); +} +#sourcey .search-result-method.method-resource { + background: var(--method-resource); +} +#sourcey .search-result-method.method-prompt { + background: var(--method-prompt); +} + +#sourcey .search-result-path { + font-family: var(--font-mono); + font-size: 0.8125rem; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +#sourcey .search-result-summary { + font-size: 0.8125rem; + color: rgb(var(--color-gray-500)); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +#sourcey .search-result-tag { + font-size: 0.6875rem; + color: rgb(var(--color-gray-400)); + white-space: nowrap; + flex-shrink: 0; +} + +#sourcey .search-loading { + padding: 1rem; + color: rgb(var(--color-gray-500)); + font-size: 0.8125rem; +} + +/* ── Godoc rendering ─────────────────────────────────────────────── */ + +#sourcey .godoc-import, +#sourcey .godoc-import-path { + font-size: 0.8125rem; + color: rgb(var(--color-gray-500)); + margin: 0.25rem 0 1.5rem; +} + +#sourcey .godoc-import code, +#sourcey .godoc-import-path code { + font-family: var(--font-mono); + background: rgba(var(--color-gray-100), 0.6); + padding: 0.125rem 0.375rem; + border-radius: 3px; +} + +#sourcey .godoc-source { + margin: -0.25rem 0 0.625rem; + font-size: 0.75rem; + color: rgb(var(--color-gray-500)); +} + +#sourcey .godoc-source a { + color: inherit; + text-decoration: none; +} + +#sourcey .godoc-source a:hover { + color: rgb(var(--color-primary-ink)); +} + +#sourcey .godoc-toc { + margin: 1.5rem 0 2.5rem; + padding: 0.875rem 1rem; + border: 1px solid rgb(var(--color-gray-200)); + border-radius: 6px; + background: rgba(var(--color-gray-50), 0.5); +} + +#sourcey .godoc-toc h4 { + margin: 0 0 0.5rem; + font-size: 0.6875rem; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.04em; + color: rgb(var(--color-gray-500)); +} + +#sourcey .godoc-toc ul { + list-style: none; + margin: 0; + padding: 0; + font-size: 0.8125rem; +} + +#sourcey .godoc-toc li { + margin: 0.125rem 0; +} + +#sourcey .godoc-toc li.godoc-toc-sub { + padding-left: 1rem; + font-family: var(--font-mono); + font-size: 0.75rem; + color: rgb(var(--color-gray-600)); +} + +#sourcey .godoc-toc a { + color: inherit; + text-decoration: none; + border-bottom: 1px dotted transparent; +} + +#sourcey .godoc-toc a:hover { + color: rgb(var(--color-primary)); + border-bottom-color: currentColor; +} + +#sourcey .godoc-symbol { + font-family: var(--font-mono); + font-size: 0.95rem; + font-weight: 600; + margin: 1.75rem 0 0.5rem; + color: rgb(var(--color-gray-900)); + scroll-margin-top: 5rem; +} + +#sourcey .godoc-doc { + margin: 0.5rem 0 0.75rem; + color: rgb(var(--color-gray-700)); + font-size: 0.9375rem; + line-height: 1.65; +} + +#sourcey .godoc-doc p:first-child { + margin-top: 0; +} + +#sourcey .godoc-doc p:last-child { + margin-bottom: 0; +} + +#sourcey .godoc-value, +#sourcey .godoc-func, +#sourcey .godoc-type { + margin: 1rem 0 1.5rem; + scroll-margin-top: 5rem; +} + +#sourcey .godoc-type { + border-top: 1px solid rgb(var(--color-gray-200)); + padding-top: 1.25rem; + margin-top: 2rem; +} + +#sourcey .godoc-anchor { + display: block; + height: 0; + scroll-margin-top: 5rem; +} + +#sourcey .godoc-fields { + margin: 0.75rem 0 1rem; + padding: 0; + border: 1px solid rgb(var(--color-gray-200)); + border-radius: 6px; + background: rgba(var(--color-gray-50), 0.4); +} + +#sourcey .godoc-fields > summary { + cursor: pointer; + padding: 0.5rem 0.875rem; + font-size: 0.75rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.04em; + color: rgb(var(--color-gray-600)); + list-style: none; +} + +#sourcey .godoc-fields > summary::-webkit-details-marker { + display: none; +} + +#sourcey .godoc-fields > ul { + list-style: none; + margin: 0; + padding: 0; + border-top: 1px solid rgb(var(--color-gray-200)); +} + +#sourcey .godoc-field { + padding: 0.625rem 0.875rem; + border-bottom: 1px solid rgb(var(--color-gray-200)); + font-size: 0.875rem; +} + +#sourcey .godoc-field:last-child { + border-bottom: none; +} + +#sourcey .godoc-field-sig { + font-family: var(--font-mono); + font-size: 0.8125rem; + font-weight: 600; + color: rgb(var(--color-gray-900)); + background: transparent; + padding: 0; +} + +#sourcey .godoc-field-type { + font-weight: 400; + color: rgb(var(--color-gray-700)); +} + +#sourcey .godoc-tag { + font-family: var(--font-mono); + font-size: 0.75rem; + color: rgb(var(--color-gray-500)); + background: transparent; + padding: 0; + margin-left: 0.5rem; +} + +#sourcey .godoc-field-doc { + margin-top: 0.25rem; + font-size: 0.8125rem; + color: rgb(var(--color-gray-600)); + line-height: 1.55; +} + +#sourcey .godoc-example { + margin: 0.75rem 0 1.25rem; + padding: 0; + border: 1px solid rgb(var(--color-gray-200)); + border-radius: 6px; + background: rgba(var(--color-gray-50), 0.4); +} + +#sourcey .godoc-example > summary { + cursor: pointer; + padding: 0.5rem 0.875rem; + font-size: 0.75rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.04em; + color: rgb(var(--color-gray-600)); + list-style: none; +} + +#sourcey .godoc-example > summary::-webkit-details-marker { + display: none; +} + +#sourcey .godoc-example > summary::before { + content: "▸ "; + color: rgb(var(--color-gray-400)); + margin-right: 0.25rem; +} + +#sourcey .godoc-example[open] > summary::before { + content: "▾ "; +} + +#sourcey .godoc-example > pre, +#sourcey .godoc-example > .godoc-doc, +#sourcey .godoc-example > p { + margin: 0.5rem 0.875rem; +} + +#sourcey .godoc-example-output-label { + margin: 0.5rem 0.875rem 0; + font-size: 0.6875rem; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.04em; + color: rgb(var(--color-gray-500)); +} + +#sourcey .godoc-func .godoc-symbol, +#sourcey .godoc-type .godoc-symbol { + word-break: break-word; +} + +/* ── Rust API rendering (rustdoc adapter) ────────────────────────── */ +/* Shared API primitives (api-*) introduced for rustdoc and reusable + by godoc/doxygen in a follow-on retrofit. Class names mirror + rustdoc's DOM so deep-links from a rustdoc URL line up with + sourcey output. */ + +#sourcey .rust-item { + border-top: 1px solid rgb(var(--color-gray-200)); + padding-top: 1rem; + margin-top: 1.25rem; +} +.dark #sourcey .rust-item { + border-top-color: rgb(var(--color-gray-800)); +} + +#sourcey .code-header, +#sourcey .rust-signature { + font-family: + ui-monospace, "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace; + font-size: 0.9375rem; + color: rgb(var(--color-gray-900)); + white-space: pre-wrap; + word-break: break-word; +} +.dark #sourcey .code-header, +.dark #sourcey .rust-signature { + color: rgb(var(--color-gray-100)); +} + +#sourcey .rust-signature .kw { + color: rgb(var(--color-rose-600)); + font-weight: 600; +} +.dark #sourcey .rust-signature .kw { + color: rgb(var(--color-rose-300)); +} + +#sourcey .rust-signature .ident { + color: rgb(var(--color-indigo-600)); +} +.dark #sourcey .rust-signature .ident { + color: rgb(var(--color-indigo-300)); +} + +#sourcey .rust-signature .lifetime { + color: rgb(var(--color-amber-700)); + font-style: italic; +} +.dark #sourcey .rust-signature .lifetime { + color: rgb(var(--color-amber-300)); +} + +#sourcey .api-rightside, +#sourcey .rightside { + float: right; + font-size: 0.8125rem; + color: rgb(var(--color-gray-500)); +} + +#sourcey .api-since, +#sourcey .since { + font-feature-settings: "tnum"; +} + +#sourcey .api-srclink, +#sourcey .srclink { + color: rgb(var(--color-indigo-600)); + text-decoration: none; +} +#sourcey .api-srclink:hover, +#sourcey .srclink:hover { + text-decoration: underline; +} +.dark #sourcey .api-srclink, +.dark #sourcey .srclink { + color: rgb(var(--color-indigo-300)); +} + +#sourcey .docblock, +#sourcey .rust-doc { + color: rgb(var(--color-gray-700)); + margin-top: 0.5rem; +} +.dark #sourcey .docblock, +.dark #sourcey .rust-doc { + color: rgb(var(--color-gray-300)); +} + +#sourcey .stab, +#sourcey .api-stab { + display: block; + margin: 0.5rem 0; + padding: 0.5rem 0.75rem; + border-radius: 0.375rem; + font-size: 0.875rem; + border: 1px solid transparent; +} +#sourcey .stab.unstable, +#sourcey .api-stab-unstable { + background-color: rgb(var(--color-amber-50)); + border-color: rgb(var(--color-amber-200)); + color: rgb(var(--color-amber-900)); +} +#sourcey .stab.deprecated, +#sourcey .api-stab-deprecated { + background-color: rgb(var(--color-rose-50)); + border-color: rgb(var(--color-rose-200)); + color: rgb(var(--color-rose-900)); +} +#sourcey .stab.portability, +#sourcey .api-stab-portability { + background-color: rgb(var(--color-emerald-50)); + border-color: rgb(var(--color-emerald-200)); + color: rgb(var(--color-emerald-900)); +} +.dark #sourcey .stab.unstable, +.dark #sourcey .api-stab-unstable { + background-color: rgba(251, 191, 36, 0.08); + border-color: rgba(251, 191, 36, 0.25); + color: rgb(var(--color-amber-200)); +} +.dark #sourcey .stab.deprecated, +.dark #sourcey .api-stab-deprecated { + background-color: rgba(244, 63, 94, 0.08); + border-color: rgba(244, 63, 94, 0.25); + color: rgb(var(--color-rose-200)); +} +.dark #sourcey .stab.portability, +.dark #sourcey .api-stab-portability { + background-color: rgba(16, 185, 129, 0.08); + border-color: rgba(16, 185, 129, 0.25); + color: rgb(var(--color-emerald-200)); +} + +/* Collapsible trait-impl block. Chevron pattern mirrors .godoc-example so the + disclosure reads the same across adapters. */ +#sourcey .api-toggle { + margin: 0.75rem 0; + border: 1px solid rgb(var(--color-gray-200)); + border-radius: 6px; + background: rgba(var(--color-gray-50), 0.4); +} +.dark #sourcey .api-toggle { + border-color: rgb(var(--color-gray-800)); +} +#sourcey .api-toggle > summary { + cursor: pointer; + padding: 0.5rem 0.875rem; + list-style: none; + font-family: var(--font-mono); + font-size: 0.8125rem; + color: rgb(var(--color-gray-700)); +} +.dark #sourcey .api-toggle > summary { + color: rgb(var(--color-gray-300)); +} +#sourcey .api-toggle > summary::-webkit-details-marker { + display: none; +} +#sourcey .api-toggle > summary::before { + content: "▸ "; + color: rgb(var(--color-gray-400)); + margin-right: 0.25rem; +} +#sourcey .api-toggle[open] > summary::before { + content: "▾ "; +} +/* The impl header lives inside the summary; keep it inline with the chevron + and strip heading margins. */ +#sourcey .api-toggle > summary .rust-impl-header { + display: inline; + margin: 0; + font-size: inherit; +} +#sourcey .api-toggle-body { + padding: 0.25rem 0.875rem 0.5rem; + border-top: 1px solid rgb(var(--color-gray-200)); +} +.dark #sourcey .api-toggle-body { + border-top-color: rgb(var(--color-gray-800)); +} +/* Marker / auto / blanket trait impls: a quiet list, not expandable boxes. */ +#sourcey .rust-impl-rows { + margin: 0.5rem 0 0.75rem; +} +#sourcey .rust-impl-row { + padding: 0.2rem 0; +} +#sourcey .rust-impl-row .rust-impl-header { + display: inline; + margin: 0; + font-size: 0.8125rem; + font-weight: 400; + color: rgb(var(--color-gray-600)); +} +.dark #sourcey .rust-impl-row .rust-impl-header { + color: rgb(var(--color-gray-400)); +} + +#sourcey .anchor, +#sourcey .api-anchor { + margin-left: 0.4rem; + color: rgb(var(--color-gray-400)); + text-decoration: none; + opacity: 0; + transition: opacity 0.1s ease; +} +#sourcey .section-header:hover .anchor, +#sourcey .section-header:hover .api-anchor, +#sourcey .code-header:hover .anchor, +#sourcey .code-header:hover .api-anchor { + opacity: 1; +} + +/* Inherent-impl methods and trait members render inline as their own sections. + Code (signatures, doctests) flows through the shared Shiki code block, so no + bespoke code styling lives here. */ +#sourcey .rust-member { + margin: 0.75rem 0; +} +#sourcey .rust-method-header { + margin: 0.5rem 0 0.25rem; +} +#sourcey .rust-doctest { + margin: 0.75rem 0; +} + +#sourcey .rust-doctest-badges { + display: flex; + flex-wrap: wrap; + gap: 0.25rem; + margin-bottom: 0.25rem; +} +#sourcey .rust-doctest-badge { + display: inline-block; + padding: 0.05rem 0.4rem; + font-size: 0.6875rem; + font-weight: 600; + border-radius: 0.25rem; + background-color: rgb(var(--color-gray-100)); + color: rgb(var(--color-gray-700)); + text-transform: lowercase; + letter-spacing: 0.02em; +} +.dark #sourcey .rust-doctest-badge { + background-color: rgb(var(--color-gray-800)); + color: rgb(var(--color-gray-300)); +} +#sourcey .rust-doctest-badge-should_panic, +#sourcey .rust-doctest-badge-compile_fail { + background-color: rgb(var(--color-rose-100)); + color: rgb(var(--color-rose-800)); +} +#sourcey .rust-doctest-badge-no_run, +#sourcey .rust-doctest-badge-ignore { + background-color: rgb(var(--color-amber-100)); + color: rgb(var(--color-amber-800)); +} + +#sourcey .rust-doctest-controls { + display: flex; + gap: 0.5rem; + margin-top: 0.5rem; + font-size: 0.8125rem; +} +#sourcey .rust-doctest-run, +#sourcey .rust-doctest-toggle-hidden { + cursor: pointer; + padding: 0.2rem 0.6rem; + border-radius: 0.375rem; + border: 1px solid rgb(var(--color-gray-300)); + background-color: rgb(var(--color-white)); + color: rgb(var(--color-gray-800)); + text-decoration: none; + line-height: 1; +} +#sourcey .rust-doctest-run:hover, +#sourcey .rust-doctest-toggle-hidden:hover { + background-color: rgb(var(--color-gray-50)); +} +.dark #sourcey .rust-doctest-run, +.dark #sourcey .rust-doctest-toggle-hidden { + background-color: rgb(var(--color-gray-900)); + border-color: rgb(var(--color-gray-700)); + color: rgb(var(--color-gray-200)); +} + +/* On the aggregated doctests page the code block already renders as a card, so + the section itself stays borderless. Just space the entries and accent the + heading so they don't read as cards within cards. */ +#sourcey .rust-doctests-index .rust-doctest { + margin: 1.5rem 0; +} +#sourcey .rust-doctests-index .rust-doctest > h3 { + padding-left: 0.625rem; + border-left: 3px solid rgb(var(--color-emerald-500)); +} +.dark #sourcey .rust-doctests-index .rust-doctest > h3 { + border-left-color: rgb(var(--color-emerald-400)); +} diff --git a/docs/api-reference/sourcey.js b/docs/api-reference/sourcey.js new file mode 100644 index 000000000..d0dc64577 --- /dev/null +++ b/docs/api-reference/sourcey.js @@ -0,0 +1 @@ +(function(){(function(){function e(e){try{return window.sessionStorage.getItem(e)}catch{return null}}function t(e,t){try{window.sessionStorage.setItem(e,t)}catch{}}function n(e){try{window.sessionStorage.removeItem(e)}catch{}}function r(e){var t=(e||`/`).replace(/\/+$/,``)||`/`;return t=t.replace(/\/index(?:\.html)?$/,``)||`/`,t=t.replace(/\.html$/,``),t||`/`}function i(e){if(!e.length)return null;for(var t=e.map(function(e){return r(e).split(`/`).filter(Boolean)}),n=[],i=0;i=document.body.scrollHeight-10){var l=c[c.length-1];i=n.length?l.getAttribute(`data-traverse-target`):l.id}i&&d(i)}}var _=!1;window.addEventListener(`scroll`,function(){_||(_=!0,requestAnimationFrame(function(){g(),_=!1}))},{passive:!0});var v=window.location.hash.slice(1)||new URLSearchParams(window.location.search).get(`target`);v&&document.getElementById(v)?(d(v),requestAnimationFrame(function(){f(v,`instant`)})):g(),window.addEventListener(`hashchange`,function(){var e=window.location.hash.slice(1);e&&(d(e,!0),f(e,`smooth`))})}window.location.hash.slice(1)||new URLSearchParams(window.location.search).get(`target`)?requestAnimationFrame(e):`requestIdleCallback`in window?window.requestIdleCallback(e,{timeout:250}):window.addEventListener(`load`,e,{once:!0})})(),(function(){function e(){var e=null;document.addEventListener(`click`,function(e){var r=e.target.closest(`.code-lang-trigger`);if(document.querySelectorAll(`.code-lang-menu`).forEach(function(e){if(!r||!e.parentElement.contains(r)){t(e);var n=e.parentElement.querySelector(`.code-lang-trigger`);n&&n.setAttribute(`aria-expanded`,`false`)}}),r){e.stopPropagation();var i=r.nextElementSibling;if(i){var a=!i.classList.contains(`hidden`);a?t(i):(i.classList.remove(`hidden`),n(r,i)),r.setAttribute(`aria-expanded`,a?`false`:`true`)}}}),document.addEventListener(`click`,function(n){var r=n.target.closest(`.code-lang-option`);if(r){var a=r.closest(`.code-lang-dropdown`),o=!!(a&&a.hasAttribute(`data-lang-sync`)),s=r.textContent.trim(),c=r.closest(`.code-lang-menu`);if(c){t(c);var l=c.parentElement.querySelector(`.code-lang-trigger`);l&&l.setAttribute(`aria-expanded`,`false`)}var u=window.scrollY;if(i(r),o&&s!==e){e=s;var d=r.closest(`.code-group`);document.querySelectorAll(`.code-group`).forEach(function(e){e===d||!e.querySelector(`.code-lang-dropdown[data-lang-sync]`)||e.querySelectorAll(`.code-lang-option`).forEach(function(e){e.textContent.trim()===s&&i(e)})})}window.scrollTo(0,u)}});function t(e){e.classList.add(`hidden`),e.style.position=``,e.style.top=``,e.style.right=``,e.style.bottom=``,e.style.maxHeight=``}function n(e,t){var n=e.getBoundingClientRect(),r=4,i=8,a=window.innerHeight-n.bottom-i,o=n.top-i,s=a<160&&o>a;t.style.position=`fixed`,t.style.right=Math.max(i,window.innerWidth-n.right)+`px`,t.style.maxHeight=Math.max(96,Math.floor((s?o:a)-r))+`px`,s?(t.style.top=``,t.style.bottom=Math.max(i,window.innerHeight-n.top+r)+`px`):(t.style.bottom=``,t.style.top=Math.min(window.innerHeight-i,n.bottom+r)+`px`)}function r(e){var t=e.closest(`[data-response-dropdown]`);if(t){var n=t.getAttribute(`data-response-dropdown`),r=t.closest(`.code-group`),i=r&&r.querySelector(`.response-panel[data-response-panel="`+n+`"]`);if(i)return i}return e.closest(`.code-lang-scope`)||e.closest(`.code-group`)}function i(e){var t=e.closest(`.code-lang-dropdown`),n=r(e),i=e.getAttribute(`data-lang-index`);if(t){var a=t.querySelector(`.code-lang-label`);t.querySelectorAll(`.code-lang-option`).forEach(function(e){var n=e.getAttribute(`data-lang-index`)===i;if(e.setAttribute(`aria-selected`,n?`true`:`false`),e.className=e.className.replace(/(dark:)?text-\[rgb\([^\]]+\)\]/g,``).trim(),n){e.classList.add(`text-[rgb(var(--color-primary))]`,`dark:text-[rgb(var(--color-primary-light))]`),a&&(a.textContent=e.textContent.trim());var r=t.querySelector(`.code-lang-trigger .code-lang-icon`),o=e.querySelector(`.lang-icon`);r&&o&&(r.innerHTML=o.outerHTML)}else e.classList.add(`text-[rgb(var(--color-stone-600))]`,`dark:text-[rgb(var(--color-stone-400))]`)})}n&&n.querySelectorAll(`.code-lang-panel`).forEach(function(e){e.classList.toggle(`active`,e.getAttribute(`data-lang-panel`)===i)})}document.addEventListener(`click`,function(e){var t=e.target.closest(`.response-tab`);if(t){var n=t.closest(`.response-tabs`),r=t.getAttribute(`data-response-index`),i=window.scrollY;n.querySelectorAll(`.response-tab`).forEach(function(e){var t=e.getAttribute(`data-response-index`)===r;e.classList.toggle(`active`,t),e.setAttribute(`aria-selected`,t?`true`:`false`)}),n.querySelectorAll(`.response-panel`).forEach(function(e){e.classList.toggle(`active`,e.getAttribute(`data-response-panel`)===r)}),n.querySelectorAll(`[data-response-dropdown]`).forEach(function(e){e.classList.toggle(`hidden`,e.getAttribute(`data-response-dropdown`)!==r)}),window.scrollTo(0,i)}}),document.addEventListener(`click`,function(e){var t=e.target.closest(`.copy-btn`);if(t){var n=t.closest(`.code-group`)||t.closest(`.prose-code-block`);if(n){var r=n.querySelectorAll(`.code-lang-panel.active, .response-panel.active`),i=r.length?r[r.length-1]:null,a=i?i.querySelector(`code, .code-block, .font-mono`):n.querySelector(`code, .code-block, .font-mono`);if(a){var o=a.textContent||``;navigator.clipboard.writeText(o).then(function(){t.classList.add(`copied`);var e=t.nextElementSibling;e&&e.classList.contains(`copy-tooltip`)&&(e.textContent=`Copied!`),setTimeout(function(){t.classList.remove(`copied`),e&&e.classList.contains(`copy-tooltip`)&&(e.textContent=`Copy`)},2e3)})}}}}),document.addEventListener(`click`,function(e){var t=e.target.closest(`.rust-doctest-toggle-hidden`);if(t){var n=t.getAttribute(`data-target`),r=t.getAttribute(`data-display`),i=n?document.getElementById(n.replace(/^#/,``)):null,a=r?document.getElementById(r.replace(/^#/,``)):null;!i||!a||(i.hasAttribute(`hidden`)?(i.removeAttribute(`hidden`),a.setAttribute(`hidden`,``),t.textContent=`Hide hidden lines`):(i.setAttribute(`hidden`,``),a.removeAttribute(`hidden`),t.textContent=`Show hidden lines`))}}),document.addEventListener(`keydown`,function(e){e.key===`Escape`&&document.querySelectorAll(`.code-lang-menu`).forEach(function(e){e.classList.add(`hidden`);var t=e.parentElement.querySelector(`.code-lang-trigger`);t&&t.setAttribute(`aria-expanded`,`false`)})}),document.addEventListener(`click`,function(e){var t=e.target.closest(`.directive-tab`);if(t){var n=t.getAttribute(`data-tab-group`),r=t.getAttribute(`data-tab-index`),i=window.scrollY;document.querySelectorAll(`.directive-tab[data-tab-group="`+n+`"]`).forEach(function(e){e.classList.toggle(`active`,e.getAttribute(`data-tab-index`)===r)}),document.querySelectorAll(`.directive-tab-panel[data-tab-group="`+n+`"]`).forEach(function(e){e.classList.toggle(`active`,e.getAttribute(`data-tab-index`)===r)}),window.scrollTo(0,i)}})}`requestIdleCallback`in window?window.requestIdleCallback(e,{timeout:250}):window.addEventListener(`load`,e,{once:!0})})(),(function(){var e=`sourcey-theme`,t=document.getElementById(`theme-toggle`),n=document.documentElement;function r(){var t=localStorage.getItem(e);return t===`dark`||t===`light`?t:`light`}function i(e){e===`dark`?n.classList.add(`dark`):n.classList.remove(`dark`),n.style.colorScheme=e,t&&(t.setAttribute(`aria-label`,e===`dark`?`Switch to light mode`:`Switch to dark mode`),t.setAttribute(`title`,e===`dark`?`Light mode`:`Dark mode`))}i(r()),t&&t.addEventListener(`click`,function(){var t=n.classList.contains(`dark`)?`light`:`dark`;localStorage.setItem(e,t),i(t)})})(),(function(){function e(){var e=document.getElementById(`search-dialog`),t=document.getElementById(`search-input`),n=document.getElementById(`search-results`),r=document.getElementById(`search-open`);if(!e||!t||!n)return;var i=[],a=-1,o=[],s=!1,c=document.querySelector(`meta[name="sourcey-search"]`);function l(e){if(s){e();return}if(!c){s=!0,e();return}var t=c.getAttribute(`content`);fetch(t).then(function(e){return e.json()}).then(function(t){i=t.map(function(e){var t=e.title||``,n=e.qualifiedName||``,r=e.owner||``,i=e.tab||``;return{url:e.url,method:e.method||``,path:e.path||``,title:t,summary:n||t,tag:r||i,content:e.content||``,category:e.category||``,featured:!!e.featured,symbolKind:e.symbolKind||``,owner:r,ownerKind:e.ownerKind||``,namespace:e.namespace||``,qualifiedName:n,titleLower:t.toLowerCase(),pathLower:(e.path||``).toLowerCase(),qualifiedLower:n.toLowerCase(),ownerLower:r.toLowerCase(),searchText:[e.method||``,e.path||``,t,n,r,e.ownerKind||``,e.namespace||``,e.symbolKind||``,e.content||``,i].join(` `).toLowerCase()}}),s=!0,e()}).catch(function(){s=!0,e()})}var u=e.querySelector(`.search-dialog-inner`);function d(){if(!(!r||!u)){var e=r.getBoundingClientRect();u.style.position=`absolute`,u.style.top=e.top-4+`px`;var t=Math.min(e.width*.5,200);u.style.left=e.left-t/2+`px`,u.style.width=e.width+t+`px`,u.style.maxWidth=`none`,u.style.transform=`none`,u.style.margin=`0`}}function f(){d(),e.classList.add(`open`),t.value=``,t.focus(),s?m(``):(n.innerHTML=`
Loading…
`,l(function(){m(``)})),document.addEventListener(`keydown`,b)}function p(){e.classList.remove(`open`),document.removeEventListener(`keydown`,b)}function m(e){var t=e.toLowerCase().trim();if(t){var n=t.split(/\s+/);o=i.map(function(e){return{entry:e,score:h(e,t,n)}}).filter(function(e){return e.score>0});var r={Pages:0,Endpoints:1,Models:2,Functions:3,Types:4,Enums:5,"Enum Values":6,Variables:7,Friends:8,Properties:9,Members:10,Sections:20};o.sort(function(e,t){return t.score===e.score?(r[e.entry.category]||19)-(r[t.entry.category]||19):t.score-e.score}),o=o.map(function(e){return e.entry}).slice(0,50)}else{var s=i.filter(function(e){return e.featured}),c=i.filter(function(e){return!e.featured&&e.category!==`Sections`});o=s.concat(c).slice(0,30)}a=o.length?0:-1,g()}function h(e,t,n){if(!n.every(function(t){return e.searchText.indexOf(t)!==-1}))return 0;var r=t.replace(/\s+/g,``),i=e.qualifiedLower||``,a=e.titleLower||``,o=e.pathLower||``,s=e.ownerLower||``,c=1;return i&&i===r&&(c+=1200),a&&a===t&&(c+=900),o&&o===t&&(c+=850),i&&i.endsWith(`::`+r)&&(c+=780),s&&r===s+`::`+a&&(c+=760),i&&r.indexOf(`::`)!==-1&&i.indexOf(r)!==-1&&(c+=700),a&&a.indexOf(t)===0&&(c+=500),i&&i.indexOf(r)!==-1&&(c+=420),s&&s.indexOf(r)!==-1&&(c+=240),o&&o.indexOf(t)!==-1&&(c+=180),e.content.toLowerCase().indexOf(t)!==-1&&(c+=80),e.category===`Sections`&&(c-=70),e.symbolKind&&(c+=35),e.featured&&(c+=20),c}function g(){for(var e=``,t=``,r=0;r`+_(s)+``,t=s);var c=`search-result`+(r===a?` active`:``),l=i.method?``+i.method+` `+_(i.path)+``:``+_(i.summary)+``,u=i.tag?``+_(i.tag)+``:``,d=i.method&&i.summary?``+_(i.summary)+``:``;e+=`
`+l+d+`
`+u+`
`}n.innerHTML=e;var f=n.querySelector(`.search-result.active`);f&&f.scrollIntoView({block:`nearest`})}function _(e){var t=document.createElement(`span`);return t.textContent=e,t.innerHTML}function v(e){return _(e).replace(/"/g,`"`).replace(/'/g,`'`)}function y(e){if(!(e<0||e>=o.length)){var t=o[e];p(),window.location.href=t.url}}function b(e){if(e.key===`Escape`){p(),e.preventDefault();return}if(e.key===`ArrowDown`){e.preventDefault(),a=Math.min(a+1,o.length-1),g();return}if(e.key===`ArrowUp`){e.preventDefault(),a=Math.max(a-1,0),g();return}if(e.key===`Enter`){e.preventDefault(),a>=0&&y(a);return}}t.addEventListener(`input`,function(){m(t.value)}),n.addEventListener(`click`,function(e){var t=e.target.closest(`.search-result`);t&&(e.preventDefault(),y(parseInt(t.getAttribute(`data-index`),10)))}),r&&r.addEventListener(`click`,f);var x=document.getElementById(`search-open-mobile`);x&&x.addEventListener(`click`,f),document.addEventListener(`keydown`,function(e){(e.ctrlKey||e.metaKey)&&e.key===`k`&&(e.preventDefault(),f()),e.key===`/`&&!S(e.target)&&(e.preventDefault(),f())}),e.addEventListener(`click`,function(t){t.target===e&&p()});function S(e){var t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable}}`requestIdleCallback`in window?window.requestIdleCallback(e,{timeout:250}):window.addEventListener(`load`,e,{once:!0})})()})(); \ No newline at end of file