Documentation
¶
Overview ¶
Package httpmock provides HTTP test fakes for the ghapi client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BranchListResponse ¶
BranchListResponse builds a REST list-branches response body. pairs are (name, sha) alternating, e.g. BranchListResponse("main", "abc", "dev", "def"). All entries are marked protected:true so tests model trusted-upstream branches by default; use BranchListResponseProtected to mix protected and unprotected entries.
func BranchListResponseProtected ¶
BranchListResponseProtected builds a REST list-branches response body where each entry is a (name, sha, protected) triple.
func CompareAncestorResponse ¶
CompareAncestorResponse builds a REST compare response indicating the requested sha is an ancestor of the head, with the given merge-base sha.
func TagListResponse ¶
TagListResponse builds a REST list-tags response body. pairs are (name, sha) alternating.
Types ¶
type Matcher ¶
Matcher determines whether a stub matches an outbound request.
func GraphQLForRepo ¶
GraphQLForRepo matches any GraphQL request whose query or variables reference the given repository owner/name. This is the preferred matcher for queries that pass owner/name through GraphQL `$variables` rather than interpolating them as string literals.
func RESTWithQuery ¶
RESTWithQuery is like REST but also requires querySubstring to appear in the request's raw query string. Use this to distinguish calls that share a URL path but differ by query parameter (e.g. branches?protected=true vs branches?per_page=100).
type Registry ¶
Registry records requests and serves stubbed responses. It mirrors the cli/cli pkg/httpmock usage pattern for deterministic API tests.
type Responder ¶
Responder builds an HTTP response for a matched request.
func GraphQLQuery ¶
GraphQLQuery inspects the outbound GraphQL request before returning a body.
func JSONResponse ¶
JSONResponse turns a value into a 200 JSON response.
func StatusResponse ¶
StatusResponse returns a response with the given status code and empty body.