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

Method SetQueryString

request.go:218–233  ·  view source on GitHub ↗

SetQueryString set URL query parameters for the request using raw query string.

(query string)

Source from the content-addressed store, hash-verified

216// SetQueryString set URL query parameters for the request using
217// raw query string.
218func (r *Request) SetQueryString(query string) *Request {
219 params, err := urlpkg.ParseQuery(strings.TrimSpace(query))
220 if err != nil {
221 r.client.log.Warnf("failed to parse query string (%s): %v", query, err)
222 return r
223 }
224 if r.QueryParams == nil {
225 r.QueryParams = make(urlpkg.Values)
226 }
227 for p, v := range params {
228 for _, pv := range v {
229 r.QueryParams.Add(p, pv)
230 }
231 }
232 return r
233}
234
235// SetQueryParamsFromValues sets query parameters from a url.Values map.
236// This method allows direct configuration of query parameters from url.Values,

Callers 2

SetQueryStringFunction · 0.80
testQueryParamFunction · 0.80

Calls 2

AddMethod · 0.80
WarnfMethod · 0.65

Tested by 1

testQueryParamFunction · 0.64