mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 10:58:55 +00:00
Merge pull request #1443 from restic/fix-init-rest-cacert
rest: Use client for creating the repository
This commit is contained in:
commit
6a4a328bbc
@ -31,7 +31,7 @@ type restBackend struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Open opens the REST backend with the given config.
|
// Open opens the REST backend with the given config.
|
||||||
func Open(cfg Config, rt http.RoundTripper) (restic.Backend, error) {
|
func Open(cfg Config, rt http.RoundTripper) (*restBackend, error) {
|
||||||
client := &http.Client{Transport: rt}
|
client := &http.Client{Transport: rt}
|
||||||
|
|
||||||
sem, err := backend.NewSemaphore(cfg.Connections)
|
sem, err := backend.NewSemaphore(cfg.Connections)
|
||||||
@ -72,7 +72,7 @@ func Create(cfg Config, rt http.RoundTripper) (restic.Backend, error) {
|
|||||||
values.Set("create", "true")
|
values.Set("create", "true")
|
||||||
url.RawQuery = values.Encode()
|
url.RawQuery = values.Encode()
|
||||||
|
|
||||||
resp, err := http.Post(url.String(), "binary/octet-stream", strings.NewReader(""))
|
resp, err := be.client.Post(url.String(), "binary/octet-stream", strings.NewReader(""))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user