Parameter Query

Hello, is there a simple way to add query parameters to Httpclient?
I did not find the procedure on httpclient class. this is my code.


var
  Req: THttpRequest;
  Resp: THttpResponse;
  Query: string;
begin
  Resp := nil;
  Req := FClient.CreateRequest;
  try
    var guest := 'G19878';
    var key := 'jdsuyYhu221lm';
    var regards := url_encode('Thank you for your information');

    // set request method
    Req.Method := 'GET';

    // set custom query
    Query := '?guest='+guest
             +'key='+key
             +'regards='+regards;
    // set uri
    Req.Uri := 'http://localhost/api/v1/guest/thankyou'+Query;
    // perform request
    Resp := FClient.Send(Req);

    // Fill response
    FillResponse(Resp);
  finally
    Req.Free;
    Resp.Free;
  end;
end;


thanks you

Hello Megat,

I'm not sure who simpler you want from this, since your code related to the query is just two lines? In any case, that's the current way to do it, there is no simpler way than that.

it's ok Wagner, I ask this maybe there are ways that I don't know about.

I only compare with the RestRequest component that provides this feature.