shape

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package shape is the edge shaping middleware (ADR-0114, F78): CORS (preflight + ACAO), response header inject/strip, and gzip compression that SKIPS streaming (text/event-stream) and upgrades (Connection: Upgrade / 101) and FORWARDS http.Flusher + http.Hijacker so SSE/WebSocket pass through unbroken. Additive (never rejects) and pass-through when unconfigured. It is the innermost edge middleware so it wraps the real upstream response.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chain

func Chain(cfg Config) func(http.Handler) http.Handler

Chain composes the configured shaping middlewares (CORS → headers → compression, innermost). A zero Config is a pass-through.

Types

type CORS

type CORS struct {
	AllowOrigins  []string
	AllowMethods  []string
	AllowHeaders  []string
	MaxAgeSeconds int
}

CORS configures cross-origin response headers + preflight handling.

type Config

type Config struct {
	CORS        *CORS
	Headers     *Headers
	Compression bool
}

Config toggles the shaping middlewares. A zero Config is a pass-through.

type Headers

type Headers struct {
	Set    map[string]string
	Remove []string
}

Headers configures response header injection/removal.

Jump to

Keyboard shortcuts

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