unit XData.Web.Response;

interface

uses
  XData.Web.Headers;

type
  IHttpResponse = interface
  ['{4F5FBBEB-2D03-446F-AD75-FFF8DB09B0B0}']
    function GetStatusCode: Integer;
    function GetStatusReason: string;
    function GetHeaders: THttpHeaders;
    function GetContentAsText: string;
    property StatusCode: Integer read GetStatusCode;
    property StatusReason: string read GetStatusReason;
    property Headers: THttpHeaders read GetHeaders;
    property ContentAsText: string read GetContentAsText;
  end;

  THttpResponse = class(TInterfacedObject, IHttpResponse)
  private
    FStatusReason: string;
    FHeaders: THttpHeaders;
    FContentAsText: string;
    FStatusCode: integer;
    function GetContentAsText: string;
    function GetHeaders: THttpHeaders;
    function GetStatusCode: integer;
    function GetStatusReason: string;
  public
    property StatusCode: integer read GetStatusCode;
    property StatusReason: string read GetStatusReason;
    property Headers: THttpHeaders read GetHeaders;
    property ContentAsText: string read GetContentAsText;
  end;

implementation

{ THttpResponse }

function THttpResponse.GetContentAsText: string;
begin
  Result := FContentAsText;
end;

function THttpResponse.GetHeaders: THttpHeaders;
begin
  Result := FHeaders;
end;

function THttpResponse.GetStatusCode: integer;
begin
  Result := FStatusCode;
end;

function THttpResponse.GetStatusReason: string;
begin
  Result := FStatusReason;
end;

end.
