MCPcopy
hub / github.com/mislav/hub / addQuery

Function addQuery

github/client.go:1345–1369  ·  view source on GitHub ↗
(path string, params map[string]interface{})

Source from the content-addressed store, hash-verified

1343}
1344
1345func addQuery(path string, params map[string]interface{}) string {
1346 if len(params) == 0 {
1347 return path
1348 }
1349
1350 query := url.Values{}
1351 for key, value := range params {
1352 switch v := value.(type) {
1353 case string:
1354 query.Add(key, v)
1355 case nil:
1356 query.Add(key, "")
1357 case int:
1358 query.Add(key, fmt.Sprintf("%d", v))
1359 case bool:
1360 query.Add(key, fmt.Sprintf("%v", v))
1361 }
1362 }
1363
1364 sep := "?"
1365 if strings.Contains(path, sep) {
1366 sep = "&"
1367 }
1368 return path + sep + query.Encode()
1369}

Callers 4

FetchPullRequestsMethod · 0.85
UploadReleaseAssetsMethod · 0.85
FetchIssuesMethod · 0.85
GenericAPIRequestMethod · 0.85

Calls 1

EncodeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…