TsgcHTTP2Client › Methods › Options
Performs a synchronous HTTP/2 OPTIONS request to discover the communication options of a resource.
function Options(const aURL: string): string;
| Name | Type | Description |
|---|---|---|
aURL | const string | Absolute URL of the resource whose capabilities are being queried, or * to query the server as a whole. |
Response body returned by the server as a string; the useful information is usually in the response headers. (string)
OPTIONS is commonly used by browsers for CORS preflight and by clients to probe which methods are accepted. Inspect Request.Headers after the call to read the allow, access-control-allow-* and related headers.
vResponse := oClient.Options('https://api.example.com/v1/users');
procedure Options(Const aURL: string; const aResponseContent: TStream);
| Name | Type | Description |
|---|---|---|
aURL | const string | Absolute URL of the resource being interrogated. |
aResponseContent | const TStream | Caller-owned stream that receives the response body, if the server returns any. |
Stream-based variant of OPTIONS. Use it when the response payload should be routed to an arbitrary TStream rather than materialised as a string.
oOut := TMemoryStream.Create;
try
oClient.Options('https://api.example.com/v1/users', oOut);
finally
oOut.Free;
end;