MCPcopy
hub / github.com/SurgeDM/Surge / Delete

Method Delete

internal/core/remote_service.go:230–239  ·  view source on GitHub ↗

Delete cancels and removes a download.

(id string)

Source from the content-addressed store, hash-verified

228
229// Delete cancels and removes a download.
230func (s *RemoteDownloadService) Delete(id string) error {
231 resp, err := s.doRequest("POST", "/delete?id="+url.QueryEscape(id), nil)
232 // Some APIs use DELETE method, checking previous implementation in server it supports both POST and DELETE
233 // but mostly POST for actions. Let's stick to POST as per server implementation.
234 if err != nil {
235 return err
236 }
237 defer func() { _, _ = io.Copy(io.Discard, resp.Body); _ = resp.Body.Close() }()
238 return nil
239}
240
241// Purge cancels and removes a download, and deletes its files from disk.
242func (s *RemoteDownloadService) Purge(id string) error {

Callers

nothing calls this directly

Calls 2

doRequestMethod · 0.95
CloseMethod · 0.45

Tested by

no test coverage detected