httputils

package
v1.101.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetArray

func GetArray(r *http.Request, argKey string) []string

GetArray returns an array of comma-separated values from r arg with the argKey name.

func GetBool

func GetBool(r *http.Request, argKey string) bool

GetBool returns boolean value from the given argKey query arg.

func GetDuration

func GetDuration(r *http.Request, argKey string, defaultValue int64) (int64, error)

GetDuration returns duration in milliseconds from the given argKey query arg.

func GetInt

func GetInt(r *http.Request, argKey string) (int, error)

GetInt returns integer value from the given argKey.

func GetTime

func GetTime(r *http.Request, argKey string, defaultMs int64) (int64, error)

GetTime returns time in milliseconds from the given argKey query arg.

If argKey is missing in r, then defaultMs rounded to seconds is returned. The rounding is needed in order to align query results in Grafana executed at different times. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/720

func TLSConfig added in v1.97.2

func TLSConfig(certFile, keyFile, caFile, serverName string, insecureSkipVerify bool) (*tls.Config, error)

TLSConfig creates tls.Config object from provided arguments

func Transport added in v1.97.2

func Transport(URL, certFile, keyFile, caFile, serverName string, insecureSkipVerify bool) (*http.Transport, error)

Transport creates http.Transport object based on provided URL. Returns Transport with TLS configuration if URL contains `https` prefix

Types

This section is empty.

Jump to

Keyboard shortcuts

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