httpconst

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package httpconst centralises HTTP header names and content-type strings shared by the API, MCP, and OTLP-HTTP handlers so the same literal isn't duplicated across packages.

Index

Constants

View Source
const (
	// HeaderContentType is the canonical HTTP Content-Type header name.
	HeaderContentType = "Content-Type"

	// HeaderContentEncoding is the canonical HTTP Content-Encoding header
	// name, shared by the UI asset server and the API gzip middleware.
	HeaderContentEncoding = "Content-Encoding"

	// ContentTypeJSON is the application/json content type used by every JSON
	// response on the API and MCP surface.
	ContentTypeJSON = "application/json"
)

Variables

This section is empty.

Functions

func AcceptsEncoding

func AcceptsEncoding(r *http.Request, enc string) bool

AcceptsEncoding reports whether the request's Accept-Encoding header lists the given encoding with a non-zero q-value. Minimal token parse — the "*" wildcard is deliberately not honoured (browsers and collectors always name the encodings they support), so callers never have to guess a preference order for it.

func ETagMatch

func ETagMatch(header, etag string) bool

ETagMatch reports whether an If-None-Match header value matches the given entity tag. Handles the "*" wildcard, comma-separated candidate lists, and weak validators (W/ prefix is ignored — weak comparison is correct for If-None-Match per RFC 9110 §13.1.2).

Types

This section is empty.

Jump to

Keyboard shortcuts

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