transport

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package transport provides shared HTTP round-trippers and wire helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PeekRequestBody

func PeekRequestBody(req *http.Request) (body []byte, ok bool)

PeekRequestBody returns the request body without consuming it, preferring GetBody and restoring req.Body otherwise. ok is false when the request has no body or reading it fails.

func SSEEventData

func SSEEventData(event []byte) (data [][]byte, commentOnly bool)

SSEEventData splits one SSE event into its data-line payloads, with the "data:" prefix and one optional leading space stripped. commentOnly reports whether every line was a comment or blank.

Types

type DiscoverShortCircuit

type DiscoverShortCircuit struct {
	Base http.RoundTripper
}

DiscoverShortCircuit answers the SDK client's SEP-2575 server/discover probe in-process with the method-not-found error a mark3labs-era gateway produced, so the client falls straight back to the legacy initialize handshake with zero network round trips for the probe.

func (*DiscoverShortCircuit) RoundTrip

func (d *DiscoverShortCircuit) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

type DynamicHeaderRoundTripper

type DynamicHeaderRoundTripper struct {
	Base    http.RoundTripper
	Headers func() map[string]string
}

DynamicHeaderRoundTripper injects headers resolved per request, for callers whose header set changes over a connection's lifetime (e.g. a pooled session that must always carry the caller's current credentials).

func (*DynamicHeaderRoundTripper) RoundTrip

func (d *DynamicHeaderRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

type HeaderRoundTripper

type HeaderRoundTripper struct {
	Base    http.RoundTripper
	Headers map[string]string
}

HeaderRoundTripper injects custom headers into every outgoing HTTP request. It clones the request before modifying headers to avoid mutating the caller's original.

func (*HeaderRoundTripper) RoundTrip

func (h *HeaderRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

Jump to

Keyboard shortcuts

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