Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidContentType is returned when Content-Type header is not application/json ErrInvalidContentType = errors.New("Content-Type must be application/json") // ErrMissingContentType is returned when Content-Type header is missing ErrMissingContentType = errors.New("Content-Type header is required") )
Functions ¶
func RequireJSONContentType ¶
RequireJSONContentType validates that the request has application/json Content-Type CWE-436: Strict validation that requires Content-Type header Use this for new endpoints where you want to enforce the header
func ValidateJSONContentType ¶
ValidateJSONContentType validates that the request has application/json Content-Type CWE-436: Validates Content-Type before parsing to prevent interpretation conflicts Accepts both "application/json" and "application/json; charset=utf-8"
func ValidateJSONContentTypeStrict ¶
ValidateJSONContentTypeStrict validates that the request has application/json Content-Type CWE-16: Configuration - Enforces strict Content-Type validation This version REQUIRES the Content-Type header and returns specific error for missing header
Types ¶
This section is empty.