request

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(username, password string) string

BasicAuth generates a basic HTTP authentication string by encoding the provided username and password. The string is base64-encoded in the format "username:password".

Parameters: - username string: The username for basic authentication. - password string: The password for basic authentication.

Returns: - string: A base64-encoded string in the format "Basic <base64-encoded-credentials>".

func Call

func Call(req *http.Request, response interface{}) (*http.Response, error)

Call makes an HTTP request using the provided request object and decodes the response into the specified structure. It automatically sets the request Content-Type to application/json and decodes the JSON response body into the provided response interface.

Parameters: - req *http.Request: The prepared HTTP request to send. - response interface{}: The target structure to hold the decoded JSON response.

Returns: - *http.Response: The raw HTTP response object. - error: An error if the HTTP request or JSON decoding fails.

func ToJsonReq

func ToJsonReq(payload interface{}) (*bytes.Buffer, error)

ToJsonReq converts a Go object to a JSON-encoded HTTP request payload. It serializes the provided payload to JSON format and wraps it in a buffer for sending in HTTP requests.

Parameters: - payload interface{}: The data structure to be serialized into JSON.

Returns: - *bytes.Buffer: The JSON-encoded payload wrapped in a bytes buffer, ready to be sent in a request. - error: An error if the JSON marshalling process fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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