func()

in bugzilla/client/client.go [134:154]


func (c *Client) newRequest(endpoint api.Endpoint) (*http.Request, error) {
	req, err := http.NewRequest(endpoint.Method(), c.base+endpoint.Resource(), nil)
	if err != nil {
		return nil, err
	}
	if endpoint.Method() != http.MethodGet {
		b, err := json.Marshal(endpoint)
		if err != nil {
			return nil, err
		}
		req.Body = ioutil.NopCloser(bytes.NewReader(b))
	}
	req.Header.Set("X-AUTOMATED-TOOL", c.tool)
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Accept", "application/json")
	// The default Go user agent is blocked for bad bots
	req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Slackware; Linux x86_64; "+
		"rv:80.0) Gecko/20100101 Firefox/80.0 OneCRL-Tools")
	c.authenticator.Authenticate(req.Header)
	return req, nil
}