Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
idHTTP.Delete does not support body data
#2
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

Reply


Messages In This Thread
RE: idHTTP.Delete does not support body data - by rlebeau - 01-07-2020, 12:02 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)