synopse / mORMot2

OpenSource RESTful ORM/SOA/MVC Framework for Delphi and FreePascal
https://synopse.info
Other
485 stars 122 forks source link

In Windows, setting TSimpleHttpClient.UserAgent does not take effect. #254

Closed zen010101 closed 1 month ago

zen010101 commented 1 month ago

mORmot version : 2.2 stable OS: Windows 11

Here is a simple code to reproduce it :

procedure TForm1.Button2Click(Sender: TObject);
begin
  with TSimpleHttpClient.Create() do
  try
    UserAgent := 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0';
    if Request('https://whatmyuseragent.com/') in HTTP_GET_OK then
      Memo1.Text := IntToStr(Status) + #13 + Headers + #13 + Body;
  finally
    Free;
  end;

end;
synopse commented 1 month ago

Please try with this commit.

zen010101 commented 1 month ago

Great! it works. Thanks for the rapid response and action.

zen010101 commented 1 month ago

SOLVED