httpclient

package
v0.0.0-...-2f3eae6 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRedirect

func CheckRedirect(req *http.Request, via []*http.Request) error

CheckRedirect provides a custom redirect policy that is more conservative/ strict than the default.

Normally Go follows redirects similarly to how a browser would, but that means sometimes changing the method (e.g. POST -> GET), dropping the body, or removing auth-related headers.

The goal of this function is to ensure we only execute redirects that would be materially equivalent to the original request.

Go's internal behavior is already set up to protect auth data, including cookies, by ensuring they can only be sent to the original host (or subdomains). If Go has seen fit to remove the auth data, we will consider the new request to be materially different, and stop following redirects.

func NewClient

func NewClient(timeout time.Duration, transport http.RoundTripper) *http.Client

Types

This section is empty.

Jump to

Keyboard shortcuts

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