toolhttp

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBytes

func GetBytes(client *HttpClient, body any) ([]byte, error)

HttpGetBinary makes an HTTP GET request to the specified client.BaseURL with query parameters from client.QueryParams and returns the binary data from the response.

func GetJSON

func GetJSON[T any](client *HttpClient, body any) (T, error)

func GetText

func GetText(client *HttpClient, body any) (string, error)

func JoinURL

func JoinURL(pBaseURL string, pQueryParams StrMap) (string, error)

URLEncode encodes a string for safe inclusion in a URL query.

func URLEncode

func URLEncode(input string) string

URLEncode encodes a string for safe inclusion in a URL query.

Types

type HttpClient

type HttpClient struct {
	BaseURL     string
	QueryParams StrMap
	ContentType string
}

type StrMap

type StrMap = map[string]string

Jump to

Keyboard shortcuts

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