fabriciocolombo / delphi-rest-client-api

A Delphi REST client API to consume REST services written in any programming language.
Apache License 2.0
381 stars 182 forks source link

Async response #127

Open soareseneves opened 5 years ago

soareseneves commented 5 years ago

Using the Async request example there is no way to get the actual result from the request, how can I get it? Shouldn't the Response Content be added as a parameter of OnAsyncRequestProcess procedure?

fabioxgn commented 5 years ago

@soareseneves I think you've confused the behavior of the Async method. Only the request is made async, your code will block and wait for the request to finish, example:

  Events := FClient.Resource(URL)
    .Accept(RestUtils.MediaType_Json)
    .Async
    .Get<TEvents>;

The advantage is that you can cancel the request at any time if it takes too much time to finish.