middleware

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL