diff options
| author | Konstantin Lebedev <lebedev_k@tochka.com> | 2021-04-12 11:22:51 +0500 |
|---|---|---|
| committer | Konstantin Lebedev <lebedev_k@tochka.com> | 2021-04-12 11:22:51 +0500 |
| commit | 8e02e138ea889d9f43cc89937c02c212ca145d74 (patch) | |
| tree | 0fd5664bcd0efaff75efafdc230f45076a6c056b /weed/util/http_util.go | |
| parent | 5021bea69838a5946b4b0bfa37c6269bfe66fa27 (diff) | |
| parent | 742ab1ec81795d1705bf3be48d56727fddf625df (diff) | |
| download | seaweedfs-8e02e138ea889d9f43cc89937c02c212ca145d74.tar.xz seaweedfs-8e02e138ea889d9f43cc89937c02c212ca145d74.zip | |
Merge branch 'upstreamMaster' into iam_handlers
Diffstat (limited to 'weed/util/http_util.go')
| -rw-r--r-- | weed/util/http_util.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/weed/util/http_util.go b/weed/util/http_util.go index 135d10c45..1630760b1 100644 --- a/weed/util/http_util.go +++ b/weed/util/http_util.go @@ -124,6 +124,27 @@ func Delete(url string, jwt string) error { return errors.New(string(body)) } +func DeleteProxied(url string, jwt string) (body []byte, httpStatus int, err error) { + req, err := http.NewRequest("DELETE", url, nil) + if jwt != "" { + req.Header.Set("Authorization", "BEARER "+string(jwt)) + } + if err != nil { + return + } + resp, err := client.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + body, err = ioutil.ReadAll(resp.Body) + if err != nil { + return + } + httpStatus = resp.StatusCode + return +} + func GetBufferStream(url string, values url.Values, allocatedBytes []byte, eachBuffer func([]byte)) error { r, err := client.PostForm(url, values) if err != nil { |
