Atozed Forums

Full Version: HTTP DELETE request with body
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I have tries to sent a  TIdHTTP.Delete request with  a stream body the same as like a TIdHTTP.Post. Unfortunately there is no overload function for Delete what accept this (Delphi 10.2).

On Internet I found "The latest update to the HTTP 1.1 specification (RFC 7231) explicitly permits an entity body in a DELETE request:"

Is there a workaround so I can send a DELETE request with a body?

Thank you for your answer
(03-21-2019, 04:40 PM)Maarten de Vries Wrote: [ -> ]Is there a workaround so I can send a DELETE request with a body?

As you have noticed, TIdHTTP does not currently have an overload for the Delete() method that accepts body content. You will have to call the protected DoRequest() method directly, eg:

Code:
type
  TIdHTTPAccess = class(TIdHTTP)
  end;

TIdHTTPAccess(IdHTTP1).DoRequest('DELETE', URL, BodyStreamHere, nil, []);
It Works, thanx