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)
| 33 | // use REST("GET", "api/v3/repos/octocat/hello-world") |
| 34 | // To match a GET request to `/user` use REST("GET", "user") |
| 35 | func 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 | |
| 44 | func GraphQL(q string) Matcher { |
| 45 | re := regexp.MustCompile(q) |
no outgoing calls