diff options
Diffstat (limited to 'go/util/http_util.go')
| -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 +} |
