middleware

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package middleware provides HTTP middleware for the yt-transcript server.

Package middleware provides HTTP middleware for the yt-transcript server.

Package middleware provides HTTP middleware for the yt-transcript server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS

func CORS(next http.Handler, origin string) http.Handler

CORS sets permissive CORS headers and handles preflight requests.

func CSP

func CSP(next http.Handler) http.Handler

CSP sets a Content-Security-Policy header on every response.

func Logging

func Logging(next http.Handler) http.Handler

Logging logs each request with method, path, status, cache, and duration.

func ServerHeader

func ServerHeader(version string, next http.Handler) http.Handler

ServerHeader sets the Server and X-yt-transcript-Version response headers.

Types

type CacheStatus

type CacheStatus struct {
	Hit bool
	Set bool
}

CacheStatus tracks whether a request was a cache hit or miss.

type CtxKey

type CtxKey struct{}

CtxKey is the context key for cache status in request context.

Jump to

Keyboard shortcuts

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