utils

package
v2.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanPrint

func CanPrint(content []byte) bool

CanPrint returns a bool if a byte array can be "printed" or written to a log file (filters binary data)

func CanPrintFast

func CanPrintFast(content []byte) (string, bool)

CanPrintFast is faster than CanPrint, but less accurate (it only checks the first chunk of the content)

func Contains

func Contains(slice []string, str string) bool

Contains checks if a slice contains a string.

func DecodeBody

func DecodeBody(body []byte, contentEncoding string) (decodedBody []byte, err error)

DecodeBody decompresses a byte array (response body) based on the content encoding

func EncodeBody

func EncodeBody(body []byte, acceptEncodingHeader string) (encodedBody []byte, encoding string, err error)

EncodeBody compresses a string (the response body) based on the content-encoding header

func HeaderString

func HeaderString(headers http.Header) string

HeaderString returns http.Header as a flat string

Types

This section is empty.

Jump to

Keyboard shortcuts

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