utils

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 26 Imported by: 10

Documentation

Index

Constants

View Source
const AcceptContentIdentity = "identity"

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(username, password string) string

func Fetch

func Fetch(ctx context.Context, url string, options ...fetch_config.Option) (*http.Response, []byte, error)

func FetchJson

func FetchJson[U any](ctx context.Context, url string, options ...fetch_config.Option) (*http.Response, U, error)

func FetchJsonWithBody

func FetchJsonWithBody[U any, T any](ctx context.Context, url string, bodyValue T, options ...fetch_config.Option) (*http.Response, U, error)

func FetchWithRequest

func FetchWithRequest(ctx context.Context, request *http.Request, options ...fetch_config.Option) (*http.Response, []byte, error)

func GetMatchingAccept

func GetMatchingAccept(
	clientSupportedMediaRanges []*motmedelHttpTypes.MediaRange,
	serverSupportedMediaRanges []*motmedelHttpTypes.ServerMediaRange,
) *motmedelHttpTypes.ServerMediaRange

func GetMatchingContentEncoding

func GetMatchingContentEncoding(
	clientSupportedEncodings []*motmedelHttpTypes.Encoding,
	serverSupportedEncodingIdentifiers []string,
) string

GetMatchingContentEncoding returns the server encoding to use for a client's accepted encodings. Client quality values are authoritative between quality groups; within a group of equal quality the server's preference order decides (callers list their identifiers by preference, e.g. smallest variant first).

func GetSingleHeader

func GetSingleHeader(name string, header http.Header) (string, error)

func IfModifiedSinceCacheHit

func IfModifiedSinceCacheHit(ifModifiedSinceValue string, lastModifiedValue string) (bool, error)

func IfNoneMatchCacheHit

func IfNoneMatchCacheHit(ifNoneMatchValue string, etag string) bool

func MakeStrongEtag

func MakeStrongEtag(data []byte) string

func ParseLastModifiedTimestamp

func ParseLastModifiedTimestamp(timestamp string) (time.Time, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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