Search code examples
restdelphi-xe

How add poDoNotEncode to TRUE from code in delphi


Is it possible and how add poDoNotEncode to TRUE from code in delphi. eg.

with RESTRequest1.Params.AddItem do
begin
     Kind:= TRESTRequestParameterKind.pkHTTPHEADER;
     name:='Authorization';
     value:= l_authorization;
     //set poDoNotEncode  to TRUE here
end;

Solution

  • Use the TRESTRequestParameter.Options property:

    with RESTRequest1.Params.AddItem do
    begin
      Kind := TRESTRequestParameterKind.pkHTTPHEADER;
      Name := 'Authorization';
      Value := l_authorization;
      Options := Options + [TRESTRequestParameterOption.poDoNotEncode];
    end;