htmlsanitize

package
v7.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsJSONContentType

func IsJSONContentType(contentType string) bool

IsJSONContentType reports whether contentType is application/json or a +json type.

func JSONBody

func JSONBody(body []byte) ([]byte, bool)

JSONBody escapes all string values in a JSON document.

func JSONBodyIfLikely

func JSONBodyIfLikely(body []byte, contentType string) ([]byte, bool)

JSONBodyIfLikely escapes JSON bodies when the content type or body shape indicates JSON.

func JSONValue

func JSONValue(value any) any

JSONValue recursively escapes string values in JSON-compatible data.

func LooksLikeJSON

func LooksLikeJSON(body []byte) bool

LooksLikeJSON reports whether body starts with an object or array JSON marker.

func String

func String(value string) string

String escapes text before it is returned to browser-facing management clients.

func Strings

func Strings(values []string) []string

Strings escapes each string in values while preserving order.

Types

This section is empty.

Jump to

Keyboard shortcuts

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