2016-12-20 22:37:11 +00:00
|
|
|
package lfsapi
|
|
|
|
|
|
|
|
import (
|
2017-08-24 21:51:08 +00:00
|
|
|
"io"
|
2016-12-20 22:37:11 +00:00
|
|
|
"net/http"
|
|
|
|
|
2021-09-01 19:41:10 +00:00
|
|
|
"github.com/git-lfs/git-lfs/v3/config"
|
|
|
|
"github.com/git-lfs/git-lfs/v3/creds"
|
|
|
|
"github.com/git-lfs/git-lfs/v3/lfshttp"
|
2016-12-20 22:37:11 +00:00
|
|
|
)
|
|
|
|
|
2018-09-06 21:42:41 +00:00
|
|
|
func (c *Client) NewRequest(method string, e lfshttp.Endpoint, suffix string, body interface{}) (*http.Request, error) {
|
|
|
|
return c.client.NewRequest(method, e, suffix, body)
|
2016-12-22 21:35:57 +00:00
|
|
|
}
|
|
|
|
|
2017-10-27 20:10:46 +00:00
|
|
|
// Do sends an HTTP request to get an HTTP response. It wraps net/http, adding
|
|
|
|
// extra headers, redirection handling, and error reporting.
|
2016-12-20 22:37:11 +00:00
|
|
|
func (c *Client) Do(req *http.Request) (*http.Response, error) {
|
2018-09-06 21:42:41 +00:00
|
|
|
return c.client.Do(req)
|
2017-11-16 21:50:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// do performs an *http.Request respecting redirects, and handles the response
|
|
|
|
// as defined in c.handleResponse. Notably, it does not alter the headers for
|
|
|
|
// the request argument in any way.
|
2018-05-25 16:24:15 +00:00
|
|
|
func (c *Client) do(req *http.Request, remote string, via []*http.Request) (*http.Response, error) {
|
2018-09-06 21:42:41 +00:00
|
|
|
return c.client.Do(req)
|
2016-12-20 22:37:11 +00:00
|
|
|
}
|
|
|
|
|
2019-11-28 19:57:16 +00:00
|
|
|
func (c *Client) doWithAccess(req *http.Request, remote string, via []*http.Request, mode creds.AccessMode) (*http.Response, error) {
|
|
|
|
return c.client.DoWithAccess(req, mode)
|
|
|
|
}
|
|
|
|
|
2018-09-06 21:42:41 +00:00
|
|
|
func (c *Client) LogRequest(r *http.Request, reqKey string) *http.Request {
|
|
|
|
return c.client.LogRequest(r, reqKey)
|
2016-12-20 22:37:11 +00:00
|
|
|
}
|
|
|
|
|
2018-09-06 21:42:41 +00:00
|
|
|
func (c *Client) GitEnv() config.Environment {
|
|
|
|
return c.client.GitEnv()
|
2017-01-03 20:38:15 +00:00
|
|
|
}
|
|
|
|
|
2018-09-06 21:42:41 +00:00
|
|
|
func (c *Client) OSEnv() config.Environment {
|
|
|
|
return c.client.OSEnv()
|
2016-12-20 22:37:11 +00:00
|
|
|
}
|
2017-04-14 20:11:44 +00:00
|
|
|
|
2018-09-06 21:42:41 +00:00
|
|
|
func (c *Client) ConcurrentTransfers() int {
|
|
|
|
return c.client.ConcurrentTransfers
|
2017-04-27 23:16:01 +00:00
|
|
|
}
|
|
|
|
|
2018-09-06 21:42:41 +00:00
|
|
|
func (c *Client) LogHTTPStats(w io.WriteCloser) {
|
|
|
|
c.client.LogHTTPStats(w)
|
2017-04-27 23:16:01 +00:00
|
|
|
}
|
|
|
|
|
2018-09-06 21:42:41 +00:00
|
|
|
func (c *Client) Close() error {
|
|
|
|
return c.client.Close()
|
2017-04-14 20:11:44 +00:00
|
|
|
}
|