httpclient

package
v0.1.0-dev4 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 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

This section is empty.

Functions

func NewClient

func NewClient(rawBaseURL string) (*http.Client, error)

NewClient builds an *http.Client with BaseURLTransport configured. Callers are responsible for layering additional transports (e.g. auth) and setting Timeout on the returned client.

Types

type BaseURLTransport

type BaseURLTransport struct {
	// BaseURL is the API base URL (e.g. "https://api.github.com").
	BaseURL *url.URL
	// Next is the underlying RoundTripper. Defaults to http.DefaultTransport if nil.
	Next http.RoundTripper
}

BaseURLTransport is an http.RoundTripper that rewrites every request URL to resolve against a fixed base URL. This allows callers to make requests with relative paths (e.g. "/graphql") and have the transport prepend the configured base URL transparently.

func (*BaseURLTransport) RoundTrip

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

RoundTrip rewrites req.URL to resolve against BaseURL, then delegates to Next. The base URL path and request path are joined explicitly so that base URLs with a path component (e.g. "https://ghe.example.com/api") are handled correctly regardless of whether the request path starts with "/".

Jump to

Keyboard shortcuts

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