http

package
v1.19.3 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 4 Imported by: ? 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

View Source
var (
	// DefaultUserAgent is the default User-Agent header value used in HTTP requests.
	DefaultUserAgent string

	// ReqHeaderProc is a callback function that allows users to modify
	// the HTTP request headers before sending the request.
	ReqHeaderProc func(req *http.Request)

	Client = &http.Client{
		Timeout: 30 * time.Second,
	}
)

Functions

func Get

func Get(url string) (resp *http.Response, err error)

Get sends a GET request to the specified URL.

Security: Server-Side Request Forgery (SSRF) The function accepts arbitrary URLs without validation. An attacker can provide URLs to internal network resources (e.g., http://localhost:6379, http://169.254.169.254/latest/meta-data/) to scan internal networks, access cloud metadata services, or interact with internal APIs.

func Open

func Open(url string) (io.ReadCloser, error)

Open opens the URL and returns the response body as an io.ReadCloser.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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