Documentation
¶
Overview ¶
Package redirecttest checks, from tests, that an HTTP client keeps credential headers on their origin when a server redirects to another host.
Index ¶
Constants ¶
const ProbeHeader = "X-Goog-Api-Key"
ProbeHeader is the credential header the checks send. http.Client itself copies it to any host, so only a credential redirect policy keeps it off.
Variables ¶
This section is empty.
Functions ¶
func CallerClient ¶
CallerClient returns a client like one a caller passes in, with its own CheckRedirect that counts the hops it sees and lets them through.
func SendThroughCrossHostRedirect ¶
func SendThroughCrossHostRedirect(t *testing.T, client *http.Client) (atOrigin, atTarget http.Header)
SendThroughCrossHostRedirect sends a request carrying ProbeHeader through client to an origin that answers with a 307 to another host. It returns the headers the origin and the other host received.
Types ¶
type Result ¶
type Result struct {
// AtOrigin and AtTarget are the ProbeHeader values the origin and the
// other host received through the client under test.
AtOrigin, AtTarget string
// CallerHops counts the hops the caller's own CheckRedirect saw.
CallerHops int32
// CallerDirect is the ProbeHeader value the other host received when the
// request went through the caller's own client: still "secret" if the
// caller's client was not modified.
CallerDirect string
}
Result is what Probe saw.