MCPcopy
hub / github.com/cli/cli / REST

Function REST

pkg/httpmock/stub.go:35–42  ·  view source on GitHub ↗

REST returns a matcher to a request for the HTTP method and URL escaped path p. For example, to match a GET request to `/api/v3/repos/octocat/hello-world/` use REST("GET", "api/v3/repos/octocat/hello-world") To match a GET request to `/user` use REST("GET", "user")

(method, p string)

Source from the content-addressed store, hash-verified

33// use REST("GET", "api/v3/repos/octocat/hello-world")
34// To match a GET request to `/user` use REST("GET", "user")
35func REST(method, p string) Matcher {
36 return func(req *http.Request) bool {
37 if !strings.EqualFold(req.Method, method) {
38 return false
39 }
40 return req.URL.EscapedPath() == "/"+p
41 }
42}
43
44func GraphQL(q string) Matcher {
45 re := regexp.MustCompile(q)

Callers 15

TestDeleteRunFunction · 0.92
TestListRunFunction · 0.92
TestGetCachesFunction · 0.92
Test_viewRunFunction · 0.92
Test_checkRunFunction · 0.92
Test_deleteAssetRunFunction · 0.92
Test_deleteRunFunction · 0.92
TestFetchRefSHAFunction · 0.92
StubFetchReleaseFunction · 0.92
StubFetchRefSHAFunction · 0.92
Test_createRunFunction · 0.92

Calls

no outgoing calls

Tested by 15

TestDeleteRunFunction · 0.74
TestListRunFunction · 0.74
TestGetCachesFunction · 0.74
Test_viewRunFunction · 0.74
Test_checkRunFunction · 0.74
Test_deleteAssetRunFunction · 0.74
Test_deleteRunFunction · 0.74
TestFetchRefSHAFunction · 0.74
Test_createRunFunction · 0.74
Test_downloadRunFunction · 0.74