Atozed Forums
HTTP DELETE request with body - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Indy (https://www.atozed.com/forums/forum-8.html)
+--- Forum: Indy General Discussion (https://www.atozed.com/forums/forum-9.html)
+--- Thread: HTTP DELETE request with body (/thread-1001.html)



HTTP DELETE request with body - Maarten de Vries - 03-21-2019

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


RE: HTTP DELETE request with body - rlebeau - 03-21-2019

(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, []);



RE: HTTP DELETE request with body - Maarten de Vries - 03-21-2019

It Works, thanx