The
TIdHTTP.Delete() method is just a thin wrapper for the protected
TIdHTTP.DoRequest() method, which has an
ASource parameter that
TIdHTTP.Delete() sets to
nil. You can simply call the
DoRequest() method directly with your desired body data, eg:
Code:
type
TIdHTTPAccess = class(TIdHTTP)
end;
var
Data: TStringStream;
begin
Data := TStringStream.Create('... body data here ...', TEncoding.UTF8);
try
TIdHTTPAccess(IdHTTP1).DoRequest(Id_HTTPMethodDelete, 'https://api.spotify.com/v1/playlists/{playlist_id}/tracks', Data, nil, []);
finally
Data.Free;
end;
end;
I have opened a ticket in Indy's issue tracker to add new overloads to
TIdHTTP.Delete() for sending body data:
#277 Add overload for TIdHTTP.Delete() to send body data
Yes, that's what I did. :-)
Thanks for taking this a level further :-)