aboutsummaryrefslogtreecommitdiff
path: root/weed/util/http_util.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/util/http_util.go')
-rw-r--r--weed/util/http_util.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/weed/util/http_util.go b/weed/util/http_util.go
index f3e97f6f1..086584af7 100644
--- a/weed/util/http_util.go
+++ b/weed/util/http_util.go
@@ -74,6 +74,17 @@ func Get(url string) ([]byte, error) {
return b, nil
}
+func Head(url string) (http.Header, error) {
+ r, err := client.Head(url)
+ if err != nil {
+ return nil, err
+ }
+ if r.StatusCode >= 400 {
+ return nil, fmt.Errorf("%s: %s", url, r.Status)
+ }
+ return r.Header, nil
+}
+
func Delete(url string, jwt security.EncodedJwt) error {
req, err := http.NewRequest("DELETE", url, nil)
if jwt != "" {