utils

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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