cors

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MiddlewareBuilder

type MiddlewareBuilder struct {
	AllowOrigin string // URI(s) that are permitted to access the server.
}

func InitMiddlewareBuilder added in v0.0.23

func InitMiddlewareBuilder() *MiddlewareBuilder

InitMiddlewareBuilder initializes a new MiddlewareBuilder instance with default settings. It sets the AllowOrigin field to an empty string, indicating no origin is explicitly allowed by default. Returns: - A pointer to the newly created MiddlewareBuilder instance.

func (*MiddlewareBuilder) Build

func (m *MiddlewareBuilder) Build() mist.Middleware

Build constructs and returns the middleware function configured by the MiddlewareBuilder instance. This function sets up CORS headers based on the configuration provided to the MiddlewareBuilder instance. Returns: - A function that conforms to mist.Middleware signature, capturing the logic for handling CORS requests.

func (*MiddlewareBuilder) SetAllowOrigin added in v0.0.24

func (m *MiddlewareBuilder) SetAllowOrigin(allowOrigin string) *MiddlewareBuilder

SetAllowOrigin sets the origin that is allowed by the middleware to access the server. This method can be used to configure Access-Control-Allow-Origin headers for CORS (Cross-Origin Resource Sharing) requests. Parameters: - allowOrigin: A string specifying the URI that is permitted to access the server. Returns: - A pointer to the MiddlewareBuilder instance to enable method chaining.

Jump to

Keyboard shortcuts

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