transport

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package transport provides HTTP transport with Bearer token authentication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Transport)

Option configures a Transport.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets the ResponseHeaderTimeout on the underlying transport. This limits how long the client waits for response headers after sending a request, without affecting long-running streaming responses.

func WithToken

func WithToken(token string) Option

WithToken sets the Bearer token for authentication.

type Transport

type Transport struct {
	// Base is the underlying transport.
	Base *http.Transport
	// Token is the Bearer token for authentication.
	Token string
}

Transport is an http.RoundTripper that adds Bearer token authentication.

func New

func New(opts ...Option) *Transport

New creates a Transport with the given options.

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper by adding Bearer token authentication.

Jump to

Keyboard shortcuts

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