Generic helper to append query parameters to an http request with less allocations
(req *http.Request, queryParams map[string]string)
| 488 | |
| 489 | // Generic helper to append query parameters to an http request with less allocations |
| 490 | func BuildQueryRequest(req *http.Request, queryParams map[string]string) *http.Request { |
| 491 | if req == nil { |
| 492 | req = &http.Request{ |
| 493 | URL: &url.URL{}, |
| 494 | } |
| 495 | } |
| 496 | qb := newQueryBuilder(req.URL.RawQuery) |
| 497 | for k, v := range queryParams { |
| 498 | if v == "" { |
| 499 | continue |
| 500 | } |
| 501 | qb.addParam(k, v) |
| 502 | } |
| 503 | req.URL.RawQuery = qb.query() |
| 504 | return req |
| 505 | } |
| 506 | |
| 507 | func bounds(vals url.Values) (time.Time, time.Time, error) { |
| 508 | var ( |
no test coverage detected