httputil

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneRequest added in v0.7.0

func CloneRequest(req *http.Request) (*http.Request, error)

CloneRequest creates a clone of an HTTP request with its body preserved. This is useful for retrying requests, as the body can only be read once.

If req.GetBody is set (e.g., by http.NewRequest), it uses that to recreate the body. Otherwise, it reads the body, restores the original, and sets the clone's body.

Types

type ChatuinoRoundTrip

type ChatuinoRoundTrip struct {
	// contains filtered or unexported fields
}

func NewChatuinoRoundTrip

func NewChatuinoRoundTrip(rt http.RoundTripper, logger zerolog.Logger, userAgentVersion string) *ChatuinoRoundTrip

func (*ChatuinoRoundTrip) RoundTrip

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

type RateLimitRetryTransport added in v0.7.0

type RateLimitRetryTransport struct {
	// Transport is the underlying http.RoundTripper
	Transport http.RoundTripper

	// SkipEndpoints lists endpoint paths that should NOT be retried on 429
	SkipEndpoints []string
}

RateLimitRetryTransport is an http.RoundTripper that automatically retries requests that receive a 429 (Too Many Requests) response by waiting until the time specified in the Ratelimit-Reset header.

func (*RateLimitRetryTransport) RoundTrip added in v0.7.0

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

RoundTrip implements http.RoundTripper

type RoundTripperFunc added in v0.4.0

type RoundTripperFunc func(req *http.Request) (*http.Response, error)

func (RoundTripperFunc) RoundTrip added in v0.4.0

func (f RoundTripperFunc) 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