Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CrossOrigin faygo.HandlerFunc = func(ctx *faygo.Context) error { ctx.SetHeader(faygo.HeaderAccessControlAllowOrigin, ctx.HeaderParam(faygo.HeaderOrigin)) ctx.SetHeader(faygo.HeaderAccessControlAllowCredentials, "true") { ctx.SetHeader(faygo.HeaderAccessControlAllowMethods, ctx.HeaderParam(faygo.HeaderAccessControlRequestMethod)) ctx.SetHeader(faygo.HeaderAccessControlAllowHeaders, ctx.HeaderParam(faygo.HeaderAccessControlRequestHeaders)) ctx.SetHeader(faygo.HeaderAccessControlMaxAge, "-1") } { } if ctx.IsOptions() { ctx.W.WriteHeader(204) ctx.Stop() } return nil }
CrossOrigin creates Cross-Domain middleware. Note: The router node should add the OPTIONS method.
Functions ¶
func AutoHTMLSuffix ¶
func AutoHTMLSuffix() faygo.HandlerFunc
AutoHTMLSuffix adds smartly .html suffix to static route
func NewAttachment ¶
func NewAttachment(specifiedFileExtension ...string) faygo.HandlerFunc
NewAttachment has the response content downloaded as an attachment file. Note: if the specifiedFileExtension is empty, applies to any response content.
func NewIPFilter ¶
func NewIPFilter(whitelist []string, realIP bool) faygo.HandlerFunc
NewIPFilter creates middleware that intercepts the specified IP prefix.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.