utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeJSON

func DecodeJSON(r io.Reader, target interface{}) error

DecodeJSON decodes JSON data from the provided reader into the given target.

func EncodeJSON

func EncodeJSON(w io.Writer, data interface{}) error

EncodeJSON encodes the given data to JSON and writes it to the provided writer.

func ParseJSONResponse

func ParseJSONResponse(resp *http.Response, target interface{}) error

ParseJSONResponse parses the JSON body of an HTTP response into the given target.

func ReadResponseBody

func ReadResponseBody(resp *http.Response) (string, error)

ReadResponseBody reads the body of an HTTP response and returns it as a string.

func SendJSONRequest

func SendJSONRequest(method, url string, payload interface{}, headers map[string]string) (*http.Response, error)

SendJSONRequest sends an HTTP request with a JSON payload and returns the response.

Types

This section is empty.

Jump to

Keyboard shortcuts

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