| 1 | package lfsapi |
| 2 | |
| 3 | import ( |
| 4 | "io" |
| 5 | "net/http" |
| 6 | |
| 7 | "github.com/git-lfs/git-lfs/v3/config" |
| 8 | "github.com/git-lfs/git-lfs/v3/creds" |
| 9 | "github.com/git-lfs/git-lfs/v3/errors" |
| 10 | "github.com/git-lfs/git-lfs/v3/lfshttp" |
| 11 | ) |
| 12 | |
| 13 | func (c *Client) NewRequest(method string, e lfshttp.Endpoint, suffix string, body interface{}) (*http.Request, error) { |
| 14 | return c.client.NewRequest(method, e, suffix, body) |
| 15 | } |
| 16 | |
| 17 | // Do sends an HTTP request to get an HTTP response. It wraps net/http, adding |
| 18 | // extra headers, redirection handling, and error reporting. |
| 19 | func (c *Client) Do(req *http.Request) (*http.Response, error) { |
| 20 | return c.client.Do(req) |
| 21 | } |
| 22 | |
| 23 | // do performs an *http.Request respecting redirects, and handles the response |
| 24 | // as defined in c.handleResponse. Notably, it does not alter the headers for |
| 25 | // the request argument in any way. |
| 26 | func (c *Client) do(req *http.Request, remote string, via []*http.Request) (*http.Response, error) { |
| 27 | return c.client.Do(req) |
| 28 | } |
| 29 | |
| 30 | func (c *Client) doWithAccess(req *http.Request, remote string, via []*http.Request, mode creds.AccessMode) (*http.Response, error) { |
| 31 | return c.client.DoWithAccess(req, mode) |
| 32 | } |
| 33 | |
| 34 | func (c *Client) LogRequest(r *http.Request, reqKey string) *http.Request { |
| 35 | return c.client.LogRequest(r, reqKey) |
| 36 | } |
| 37 | |
| 38 | func (c *Client) GitEnv() config.Environment { |
| 39 | return c.client.GitEnv() |
| 40 | } |
| 41 | |
| 42 | func (c *Client) OSEnv() config.Environment { |
| 43 | return c.client.OSEnv() |
| 44 | } |
| 45 | |
| 46 | func (c *Client) ConcurrentTransfers() int { |
| 47 | return c.client.ConcurrentTransfers |
| 48 | } |
| 49 | |
| 50 | func (c *Client) LogHTTPStats(w io.WriteCloser) { |
| 51 | c.client.LogHTTPStats(w) |
| 52 | } |
| 53 | |
| 54 | func (c *Client) Close() error { |
| 55 | return errors.Join(c.closeSSHTransfers(), c.client.Close()) |
| 56 | } |