diff options
| author | Shulhan <ms@kilabit.info> | 2022-04-15 01:52:25 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-04-15 01:52:25 +0700 |
| commit | 618ffca939c176b2faea4d18de756d58f1110639 (patch) | |
| tree | 7cc43c0c9a3d7140fe1008775c75b22f4d68f94c /httpd.go | |
| parent | 4d3ab7f49410eb2b774a7c9e25ba10a1efbd1413 (diff) | |
| download | rescached-618ffca939c176b2faea4d18de756d58f1110639.tar.xz | |
all: implement sub command to remove caches by domain name
The "caches" command accept second sub command "remove" that accept
single domain name to be removed from caches.
This changes affect the HTTP API for caches delete to return the removed
answer on the response data.
Diffstat (limited to 'httpd.go')
| -rw-r--r-- | httpd.go | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -291,6 +291,8 @@ func (srv *Server) httpdAPIDeleteCaches(epr *libhttp.EndpointRequest) (resBody [ var ( res = libhttp.EndpointResponse{} q = epr.HttpRequest.Form.Get(paramNameName) + + answers []*dns.Answer ) if len(q) == 0 { @@ -299,10 +301,10 @@ func (srv *Server) httpdAPIDeleteCaches(epr *libhttp.EndpointRequest) (resBody [ return nil, &res } - srv.dns.RemoveCachesByNames([]string{q}) + answers = srv.dns.RemoveCachesByNames([]string{q}) res.Code = http.StatusOK - res.Message = fmt.Sprintf("%q has been removed from caches", q) + res.Data = answers return json.Marshal(&res) } |
