MCPcopy
hub / github.com/harness/harness / HandleFind

Function HandleFind

app/api/handler/pullreq/pr_find.go:26–59  ·  view source on GitHub ↗

HandleFind returns a http.HandlerFunc that finds a pull request.

(pullreqCtrl *pullreq.Controller)

Source from the content-addressed store, hash-verified

24
25// HandleFind returns a http.HandlerFunc that finds a pull request.
26func HandleFind(pullreqCtrl *pullreq.Controller) http.HandlerFunc {
27 return func(w http.ResponseWriter, r *http.Request) {
28 ctx := r.Context()
29 session, _ := request.AuthSessionFrom(ctx)
30
31 repoRef, err := request.GetRepoRefFromPath(r)
32 if err != nil {
33 render.TranslatedUserError(ctx, w, err)
34 return
35 }
36
37 pullreqNumber, err := request.GetPullReqNumberFromPath(r)
38 if err != nil {
39 render.TranslatedUserError(ctx, w, err)
40 return
41 }
42
43 options, err := request.ParsePullReqMetadataOptions(r)
44 if err != nil {
45 render.TranslatedUserError(ctx, w, err)
46 return
47 }
48
49 options.IncludeGitStats = true // always backfill PR git stats when fetching one PR.
50
51 pr, err := pullreqCtrl.Find(ctx, session, repoRef, pullreqNumber, options)
52 if err != nil {
53 render.TranslatedUserError(ctx, w, err)
54 return
55 }
56
57 render.JSON(w, http.StatusOK, pr)
58 }
59}
60
61// HandleFindByBranches returns a http.HandlerFunc that finds a pull request from the provided branch pair.
62func HandleFindByBranches(pullreqCtrl *pullreq.Controller) http.HandlerFunc {

Callers

nothing calls this directly

Calls 7

AuthSessionFromFunction · 0.92
GetRepoRefFromPathFunction · 0.92
TranslatedUserErrorFunction · 0.92
GetPullReqNumberFromPathFunction · 0.92
JSONFunction · 0.92
FindMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…