TsgcHTTP2ClientProperties › Request

Request Property

Default HTTP/2 request parameters (headers, user-agent, accept, content-type) applied to every outgoing request.

Syntax

property Request: TsgcHTTP2Request read FRequest write SetRequest;

Default Value

Remarks

Specifies the header values that are sent with every HTTP/2 request issued by this client. Use it to configure persistent headers such as User-Agent, Accept, Accept-Encoding, Content-Type and any custom application header. Per-request overrides can still be applied from inside the OnHTTP2BeforeRequest event, which lets you add or modify headers immediately before they are HPACK-compressed and sent on the HTTP/2 stream.

Example


oHTTP2 := TsgcHTTP2Client.Create(nil);
oHTTP2.Host := 'http2.akamai.com';
oHTTP2.Port := 443;
oHTTP2.TLS := True;
oHTTP2.Request.UserAgent := 'sgcHTTP2/1.0';
oHTTP2.Request.Accept := 'application/json';
oHTTP2.Request.CustomHeaders.Add('x-api-key: abcd1234');

Back to Properties