Feat: client method to upload file from master node to slave node

This commit is contained in:
HFO4
2022-03-13 16:16:58 +08:00
parent 081e75146c
commit b96019be7c
12 changed files with 174 additions and 59 deletions

View File

@@ -7,7 +7,7 @@ import (
"io"
"io/ioutil"
"net/http"
"path"
"net/url"
"strings"
"sync"
@@ -70,9 +70,13 @@ func (c *HTTPClient) Request(method, target string, body io.Reader, opts ...Opti
// 确定请求URL
if options.endpoint != nil {
targetPath, err := url.Parse(target)
if err != nil {
return &Response{Err: err}
}
targetURL := *options.endpoint
targetURL.Path = path.Join(targetURL.Path, target)
target = targetURL.String()
target = targetURL.ResolveReference(targetPath).String()
}
// 创建请求