httptransport

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package http provides custom http transport implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoggedTransport

type LoggedTransport struct {
	// Pattern for blocked URLs. Body of blocked URLs will not be logged.
	BlockedResponseURLs []string
}

LoggedTransport adds request slog logging.

Responses with status code below 400 are logged with INFO level. Responses with status code of 400 or higher are logged with WARNING level. When DEBUG logging is enabled, will also log details of request and response including headers. Authorization headers in requests are redacted. Can redact response bodies for URLs (e.g. which would contain tokens)

func (LoggedTransport) RoundTrip

func (t LoggedTransport) RoundTrip(req *http.Request) (*http.Response, error)

type LoggedTransportWithRetries

type LoggedTransportWithRetries struct {
	MaxRetries         int
	StatusCodesToRetry []int
	DelayMilliseconds  int
	// Pattern for blocked URLs. Body of blocked URLs will not be logged.
	BlockedResponseURLs []string
}

LoggedTransportWithRetries adds request logging and automatic retrying for common HTTP errors.

func (LoggedTransportWithRetries) RoundTrip

func (t LoggedTransportWithRetries) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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