TsgcHTTP3Client › Methods › RequestOptions

RequestOptions Method

Sends a synchronous HTTP/3 OPTIONS request to inspect the communication options of a resource.

Syntax

RequestOptions(const aURL: string): string string overload

function RequestOptions(const aURL: string): string; overload;
NameTypeDescription
aURLconst stringAbsolute URL of the target resource.

Response body received from the server, decoded as a string. (string)

RequestOptions(const aURL: string; const aResponseContent: TStream) stream overload

procedure RequestOptions(const aURL: string;

  const aResponseContent: TStream); overload;
NameTypeDescription
aURLconst stringAbsolute URL of the target resource.
aResponseContentTStreamStream that receives the response body.

None. The response body is written to aResponseContent.

Remarks

The call blocks the calling thread until the complete response has been received. When the client is not connected yet, the URL is used to open the QUIC connection first. For a non-blocking request use OptionsAsync, which delivers the reply on OnResponse.

OPTIONS asks the server which methods and capabilities the target resource supports. The answer is normally carried in the allow response header, plus the CORS access-control-allow-* headers when the request is a preflight.

The method is named RequestOptions rather than Options because Options collides with an existing identifier in Delphi and C++Builder. The asynchronous counterpart keeps the protocol name and is called OptionsAsync.

Example



vResponse := oClient.RequestOptions('https://api.example.com/v1/users');

Back to Methods