Reference THttpPost
Declared in Codebot.Networking.Web.pas on line 124
THttpPost manages sending multipart http post requests. It is recommended that when you attach streams to the body you turn ownership over to this class. Invoking build will generate a request stream.
Note:
Adding only one nameless part to the body causes the post to suppress multipart sections
THttpPost = class
public
{ Create an empty post }
constructor Create;
{ Destroy the post and any streams it owns }
destructor Destroy; override;
{ Remove all headers and body parts }
procedure Clear;
{ Add a custom header }
function AddHeader(const Name, Value: string): THttpPost;
{ Add a text to the post body }
function AddText(Text: string): THttpPost; overload;
function AddText(const Name, Text: string): THttpPost; overload;
function AddText(const Name, MimeType, Text: string): THttpPost; overload;
{ Add a file to the post body }
function AddFile(const FileName: string): THttpPost; overload;
function AddFile(const Name, FileName: string): THttpPost; overload;
function AddFile(const Name, MimeType, FileName: string): THttpPost; overload;
{ Add a stream to the post body }
function AddStream(const Name: string; Stream: TStream; OwnsStream: Boolean = True): THttpPost; overload;
function AddStream(const Name, MimeType: string; Stream: TStream; OwnsStream: Boolean = True): THttpPost; overload;
{ Build the post resulting in a request stream }
procedure Build(Url: TUrl);
{ The request stream generated by Build }
property Request: TStream read FRequest;
end;