diff options
| author | Chris Lu <chris.lu@gmail.com> | 2014-03-20 13:30:34 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2014-03-20 13:30:34 -0700 |
| commit | 7251e357e70888539f3e3b3922004356d2d605da (patch) | |
| tree | 6b10042b96377f50c50aaa0a0e5f44cc9fa05de4 /go/util | |
| parent | 7c5c94785c5789a333987348c3a3e462c143e885 (diff) | |
| download | seaweedfs-7251e357e70888539f3e3b3922004356d2d605da.tar.xz seaweedfs-7251e357e70888539f3e3b3922004356d2d605da.zip | |
enhance deletion operation
Diffstat (limited to 'go/util')
| -rw-r--r-- | go/util/http_util.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/go/util/http_util.go b/go/util/http_util.go index e28057572..e6f9f0184 100644 --- a/go/util/http_util.go +++ b/go/util/http_util.go @@ -52,3 +52,22 @@ func Get(url string) ([]byte, error) { } return b, nil } + +func Delete(url string) error { + req, err := http.NewRequest("DELETE", url, nil) + if err != nil { + glog.V(0).Infoln("failing to delete", url) + return err + } + resp, e := client.Do(req) + if e != nil { + glog.V(0).Infoln(e) + return e + } + defer resp.Body.Close() + if _, err := ioutil.ReadAll(resp.Body); err != nil { + glog.V(0).Infoln("read get result from", url, err) + return err + } + return nil +} |
