Search code examples
delphifiremonkey

Restclient Set an Array Property


I am trying to create a RestClient at runtime, One of the properties I want to set seems to be a Bool Array. RestClient.RedirectsWithGET Below is the properties of RedirectWithGET that I want to set but dont understand how.

enter image description here

I have tried FRESTClient.RedirectsWithGET := (Post301,Post302,Post303,Put303,Delete303); and many other variances. But no luck. How can I set this at runtime?


Solution

  • Try something like this

    RestClient1.RedirectsWithGET := [THTTPRedirectWithGET.Post301,
                                     THTTPRedirectWithGET.Post302,
                                     THTTPRedirectWithGET.Post303,
                                     THTTPRedirectWithGET.Put303,
                                     THTTPRedirectWithGET.Delete303];
    

    The reason why you need to prefix each value with THTTPRedirectWithGET is because those values are part of THTTPRedirectWithGET set. But RestClient.RedirectsWithGET expects a set of type THTTPRedirectsWithGET which is actually a set of THTTPRedirectWithGET set.