Documentation
¶
Overview ¶
Package proxytest provides a recording forward HTTP proxy for tests that assert what a client puts on the wire to a proxy.
A net/http server cannot serve as that proxy: on an absolute-form request it replaces Request.Host with the target's authority and deletes the Host header (RFC 9112 §3.2.2), so the Host the client sent is unobservable. This proxy reads the request head itself, records the request target and the Host header verbatim, and forwards the request to the absolute URL with its Host header unchanged — the way Burp's proxy listener forwards traffic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hit ¶
type Hit struct {
// RequestTarget is the request-line target as sent, e.g.
// "http://127.0.0.1:8080/x?q=1".
RequestTarget string
// Host is the Host header as sent ("" when absent).
Host string
}
Hit is one request the proxy received.
type Proxy ¶
type Proxy struct {
// URL is the proxy's address, e.g. http://127.0.0.1:54321.
URL *url.URL
// contains filtered or unexported fields
}
Proxy is a running recording proxy. Close is registered with t.Cleanup.