Alternativ kannst du auch
RESTRequest.SynchronizedEvents := True;
schreiben und damit schon alles gelöst haben.
Delphi-Quellcode:
/// <summary>
/// Specifies if Events (such as OnAfterExecute) should run in the context of the main
/// thread (true) or in the context of an arbitrary thread - which was created by the developer or by using
/// ExecuteAsync.
/// </summary>
// <seealso cref="TCustomRESTRequest.ExecuteAsync" />
property SynchronizedEvents: Boolean read FSynchronizedEvents write SetSynchronizedEvents default true;