middleware/deprecation
import "github.com/gofiber/fiber/v3/middleware/deprecation"
Variables
ConfigDefault is the default config. It sets nothing, so New panics with it: at least one date or link is required.
Source: middleware/deprecation/config.go:50
var ConfigDefault = Config{}Functions
func New(config ...Config) fiber.Handler
Source: middleware/deprecation/deprecation.go:13
New creates a new middleware handler that marks responses as deprecated with the Deprecation (RFC 9745) and Sunset (RFC 8594) headers.
Types
type Config
Source: middleware/deprecation/config.go:12
Config defines the config for middleware.
type Config struct {
// Deprecation is when the resource was, or will be, deprecated. It is sent
// in the Deprecation header as a Structured Field Date (RFC 9745). A date
// in the future announces an upcoming deprecation.
//
// Optional. Default: zero time (header not sent)
Deprecation time.Time
// Sunset is when the resource is expected to become unresponsive. It is
// sent in the Sunset header as an HTTP-date (RFC 8594), and must not be
// earlier than Deprecation (RFC 9745 Section 4).
//
// Optional. Default: zero time (header not sent)
Sunset time.Time
// Next defines a function to skip this middleware when returned true.
//
// Optional. Default: nil
Next func(c fiber.Ctx) bool
// Link is a URI reference that documents the deprecation, such as a
// migration guide or a deprecation policy. It is added to the Link header
// with rel="deprecation". It may be set without Deprecation to publish a
// policy before anything is deprecated (RFC 9745 Section 3.1).
//
// Optional. Default: ""
Link string
// SunsetLink is a URI reference that documents the sunset policy. It is
// added to the Link header with rel="sunset", and may be set without
// Sunset (RFC 8594 Section 6).
//
// Optional. Default: ""
SunsetLink string
}Fields
Deprecation time.TimeDeprecation is when the resource was, or will be, deprecated. It is sent in the Deprecation header as a Structured Field Date (RFC 9745). A date in the future announces an upcoming deprecation.
Optional. Default: zero time (header not sent)
Sunset time.TimeSunset is when the resource is expected to become unresponsive. It is sent in the Sunset header as an HTTP-date (RFC 8594), and must not be earlier than Deprecation (RFC 9745 Section 4).
Optional. Default: zero time (header not sent)
Next func(c fiber.Ctx) boolNext defines a function to skip this middleware when returned true.
Optional. Default: nil
Link stringLink is a URI reference that documents the deprecation, such as a migration guide or a deprecation policy. It is added to the Link header with rel="deprecation". It may be set without Deprecation to publish a policy before anything is deprecated (RFC 9745 Section 3.1).
Optional. Default: ""
SunsetLink stringSunsetLink is a URI reference that documents the sunset policy. It is added to the Link header with rel="sunset", and may be set without Sunset (RFC 8594 Section 6).
Optional. Default: ""