utils

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderIfMatch = "If-Match"
)

Variables

This section is empty.

Functions

func GetETag added in v1.4.0

func GetETag(r *http.Request) (*string, error)

GetETag reads the If-Match header from the request, and returns an error if it doesn't exist, otherwise it will return the header value

func GetRequestBody added in v1.4.0

func GetRequestBody[T any](r *http.Request) (*T, error)

GetRequestBody attempts to read the request body as JSON and unmarshal it into the specified type T

func HandleBundleAPIErr

func HandleBundleAPIErr(w http.ResponseWriter, r *http.Request, httpStatusCode int, errors ...*models.Error)

HandleBundleAPIErr is a helper function to handle errors and set the HTTP response status code and headers accordingly

func MapErrorCodeToStatus added in v1.4.0

func MapErrorCodeToStatus(code *models.Code) int

func PtrContentItemState added in v1.4.0

func PtrContentItemState(s models.State) *models.State

PtrContentItemState returns a pointer for content item state

Types

This section is empty.

Jump to

Keyboard shortcuts

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