MCPcopy Index your code
hub / github.com/imroc/req / SetCommonQueryString

Method SetCommonQueryString

client.go:489–504  ·  view source on GitHub ↗

SetCommonQueryString set URL query parameters with a raw query string for requests fired from the client.

(query string)

Source from the content-addressed store, hash-verified

487// SetCommonQueryString set URL query parameters with a raw query string
488// for requests fired from the client.
489func (c *Client) SetCommonQueryString(query string) *Client {
490 params, err := urlpkg.ParseQuery(strings.TrimSpace(query))
491 if err != nil {
492 c.log.Warnf("failed to parse query string (%s): %v", query, err)
493 return c
494 }
495 if c.QueryParams == nil {
496 c.QueryParams = make(urlpkg.Values)
497 }
498 for p, v := range params {
499 for _, pv := range v {
500 c.QueryParams.Add(p, pv)
501 }
502 }
503 return c
504}
505
506// SetCommonQueryParamsFromValues set URL query parameters from a url.Values map
507// for requests fired from the client.

Callers 3

TestSetCommonQueryStringFunction · 0.80
testQueryParamFunction · 0.80
SetCommonQueryStringFunction · 0.80

Calls 2

AddMethod · 0.80
WarnfMethod · 0.65

Tested by 2

TestSetCommonQueryStringFunction · 0.64
testQueryParamFunction · 0.64