I have a function that accept a TWebRequest
by argument, eg.:
function foo(const request: TWebRequest ): boolean;
how can i create a TWebRequest
and set some property like:
- Host
- ServerPort
- QueryFields
- ContentFields
I have tried:
var
aWebRequest: TWebRequest;
begin
aWebRequest := TWebRequest.Create;
but on creation Delphi raise an exception:
First chance exception at $XXXXXXXX. Exception class EAbstractError with message 'Abstract Error'.
the descendant is TIdHTTPAppRequest
, but it require:
constructor TIdHTTPAppRequest.Create(
AThread: TIdContext;
ARequestInfo: TIdHTTPRequestInfo;
AResponseInfo: TIdHTTPResponseInfo
);
each argument require other object etc etc.
there is a simple way (eg. third party unit, unknown snippet or trick) for mockup a request for unit test purpose?