Table of Contents

THttpRequest Class

Represents an HTTP request to be sent through an THttpEngine, including its method, target URI, headers, and content body.

Remarks

Set the Method and Uri properties and, optionally, add request headers or a content body (via SetContent or ContentStream) before sending the request. Instances are typically created through THttpEngine.CreateRequest.

Syntax

Unit: Sparkle.Http.Engine

THttpRequest = class(TObject);

Constructors

Name Description
Create Creates an empty HTTP request with a default timeout of 60 seconds.

Methods

Name Description
SetContent Sets the request content body from a byte array.

Properties

Name Description
AsUri Gets the parsed representation of the request Uri.
ContentLength Gets the length, in bytes, of the request content body.
ContentStream Gets or sets the stream that provides the request content body.
Headers Gets the collection of HTTP headers to send with the request.
Method Gets or sets the HTTP method (verb) of the request, such as GET or POST.
OwnsContentStream Indicates whether the request owns the assigned ContentStream and frees it.
Timeout Gets or sets the request timeout, in milliseconds.
Uri Gets or sets the target URI of the request.