httputils

package
v0.0.0-...-a272187 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeJson

func EncodeJson(r *http.Request, writer io.Writer, d any) error

func StreamJsonChan

func StreamJsonChan[T any](r *http.Request, writer io.Writer, stream <-chan T) error

StreamJsonChan Streams a channel of values into a JSON list via a writer.

func StreamJsonIterator

func StreamJsonIterator[T any](r *http.Request, writer io.Writer, next func() (int, *T)) error

StreamJsonIterator Streams an iterator of values into a JSON list via a writer.

Types

type ContentEncoding

type ContentEncoding string
const (
	ContentEncodingNone   ContentEncoding = ""
	ContentEncodingGzip   ContentEncoding = "gzip"
	ContentEncodingBrotli ContentEncoding = "br"
	ContentEncodingZstd   ContentEncoding = "zstd"
)

func SelectEncodingServerPreference

func SelectEncodingServerPreference(acceptEncoding string) (contentEncoding ContentEncoding)

Jump to

Keyboard shortcuts

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