func (client ApiClient) request(endpoint api.Endpoint, args ...interface{}) (*http.Request, error) { path := endpoint.Build(args...).String() if req, err := http.NewRequest(endpoint.Verb, client.url(path), nil); err != nil { return nil, err } else { req.Header.Add("Accept", string(client.Encoding)) if endpoint.Verb == "POST" || endpoint.Verb == "PATCH" || endpoint.Verb == "PUT" { req.Header.Add("Content-Type", string(client.Encoding)) } return req, nil } }