utils

package
v0.0.37 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

utilities.go For utility/helper functions to support from the main package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Encode

func Base64Encode(data []byte) (string, error)

Base64Encode encodes the provided data into a base64 string and provides details about the encoding process.

func Base64EncodeCertificate

func Base64EncodeCertificate(certPath string) (string, error)

func DumpRequestToFile

func DumpRequestToFile(req *http.Request, filename string) error

DumpRequestToFile dumps the given request to a specified file.

func GetImageContentType

func GetImageContentType(filePath string) string

GetImageContentType determines the content type based on file extension

func PrettyPrintStruct

func PrettyPrintStruct(v interface{}) string

// Print request headers for troubleshooting

func PrintRequestHeaders(req *http.Request) {
	fmt.Println("Request Headers:")
	for name, values := range req.Header {
		// Each value is a slice of strings since headers can be repeated.
		for _, value := range values {
			fmt.Printf("%s: %s\n", name, value)
		}
	}
}

PrettyPrintStruct prints the structure in a pretty format

func UnmarshalJSONData

func UnmarshalJSONData(data []byte, out interface{}) error

UnmarshalJSONData unmarshals binary data into the given output structure.

Types

This section is empty.

Jump to

Keyboard shortcuts

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