TWebHTTPRequest delete method does not send request

I have a problem in this component with the DELETE function. The request does not reach the API. And the error: uLinhagem.pas:56 Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'FURL') is displayed in the console. Can you help me?

TWebHttpRequest does not have a delete method, unless you mean you set WebHttpRequest.Command to httpDelete and then call Execute or Perform.
With this approach I cannot see a problem. Please provide more details.

image

I'm calling a delphi procedure from a javascript click event. When, in the procedure, I call a showmessage, it executes normally, but when I try to use the request procedure, which in another part of the code already works, in this case the request does not arrive in the API.

I retested this here with:

procedure TForm3.WebButton1Click(Sender: TObject);
begin
  WebHttpRequest1.URL := 'https://www.tmssoftware.com/site/tmsvcluipack.asp';
  WebHttpRequest1.Execute(procedure (AResponse: string; ARequest: TJSXMLHttpRequest)
    begin
      console.log(AResponse, ARequest);
    end);
end;

and I cannot see any problem here.
If a problem persists, please provide full usable sample source test project with which we can see the problem here.

deleteButton.addEventListener('click', function() {

            Swal.fire({

            title: 'Deseja excluir a linhagem selecionada?',

            text: "Esta ação não pode ser desfeita!",

            icon: 'question',

            showCancelButton: true,

            confirmButtonColor: '#004F92',

            cancelButtonColor: '#E25D11',

            confirmButtonText: 'Excluir',

            cancelButtonText: 'Cancelar'

            }).then((result) => {

            if (result.isConfirmed) {

              pas.uLinhagem.TfLinhagem.ExcluiMov(Object.values(item)[0]);

            }              

            });

          });

procedure TfLinhagem.ExcluiMov(aID: string);

begin

http_Delete.URL := ('http://'); //t he error occurs in this assignment.

http_Delete.Execute(

procedure(AResponse: string; AReq: TJSXMLHttpRequest)

var

  lJson: TJSONObject;

  lMessage: String;

begin

  try

    lJson := TJSONObject.ParseJSONValue(AResponse) as TJSONObject;

    lMessage := '';

    lMessage :=  lJson.getJsonValue('message');

    if (lMessage = 'success') then

    begin

      asm

        Swal.fire(

        '',

        'Linhagem excluída com sucesso!',

        'success'

        )

      end;

      buscaDadosAPI;

    end    

    else

    begin

      asm

        Swal.fire(

        'Erro ao excluir linhagem!',

        lMessage,

        'error'

        )

      end;

    end;

  finally

    if Assigned(lJson) then FreeAndNil(lJson);

  end;

end);

end;

The tests in Postman work correctly, however, when I go to delphi, it is returning that the FURL configuration cannot be assigned

I suspect you compile in release mode and therefore code is optimized out if something is not accessed from Pascal code.
The compiler cannot detect what is accessed from JavaScript code only.

but when a ShowMessage is inserted instead of assigning the URL, the message is displayed normally... We are starting with TMS, I needed a little more didactic guidance on how I could make this call, considering that the form that is in the example does not work

and the compilation is being done in debug

Please provide a sample source project with which we can reproduce this.
Then we can look to it and what to change to make it work.

uLinhagem.zip (6.2 KB)

How am I supposed to reproduce this when this just has placeholder links in your code?
I replaced "anylink" with https://www.tmssoftware.com and of course, then your code to parse the JSON does not work

So, again, I ask for a project source with which I can compile & see the problem.