TsgcHTTP2ClientEvents › OnHTTP2Response

OnHTTP2Response Event

Fires when the client receives the full response (status, headers and body) from the server.

Syntax

property OnHTTP2Response: TsgcHTTP2ClientResponseEvent;
// TsgcHTTP2ClientResponseEvent = procedure(Sender: TObject; const Connection: TsgcHTTP2ConnectionClient; const Request: TsgcHTTP2RequestProperty; const Response: TsgcHTTP2ResponseProperty) of object

Default Value

Remarks

OnHTTP2Response is raised once the complete HTTP/2 response for a request has been received. The Response parameter exposes the status, headers and body returned by the server: use Response.Headers for the HTTP/2 header list, Response.Data for the raw body bytes, Response.DataString for the body as a string, and Response.DataUTF8 for the body as a UTF-8 string. The Request parameter identifies the original request so several outstanding streams can be correlated on the same Connection. When FragmentedData is set to h2fdOnlyFragmented this event is not raised and only OnHTTP2ResponseFragment is dispatched.

Example


procedure OnHTTP2ResponseEvent(Sender: TObject; const Connection: TsgcHTTP2ConnectionClient;
  const Request: TsgcHTTP2RequestProperty; const Response: TsgcHTTP2ResponseProperty);
begin
  ShowMessage(Response.Headers.Text + #13#10 + Response.DataString);
end;

Back to Events