Documentation
¶
Overview ¶
Package ghtest provides minimal test helpers for code that uses ghkit. It is shape-correct, not behaviour-correct: see TESTING.md for the full recipe set and the boundary the helpers do and do not cover.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Write304IfMatch ¶
Write304IfMatch computes the expected ETag for body using the bored-engineer algorithm (which hashes the request's Authorization, Accept, and Cookie headers along with the body). If any tag in If-None-Match (split on commas, trimmed, and normalised to strip the W/ weak prefix and surrounding quotes) matches, it sets a quoted ETag response header per RFC 7232, writes 304 Not Modified with empty body, and returns true. Otherwise it writes nothing and returns false.
func WriteSecondaryLimit ¶
func WriteSecondaryLimit(w http.ResponseWriter, retryAfter time.Duration)
WriteSecondaryLimit writes a 403 with a Retry-After header (whole seconds) and a JSON body whose documentation_url ends in #secondary-rate-limits. That suffix is what go-github pattern-matches on to classify the error as an AbuseRateLimitError, so the consumer's retry path actually triggers in tests. Negative durations are clamped to zero.
Types ¶
This section is empty.