#1 2024-01-22 16:47:48

ulrichd
Member
Registered: 2018-07-30
Posts: 16

Rerouting to REST server method

Is it possible to re-route requests to existing REST server methods?

I tried adding:

    aRestServer := TVspsRestServer.CreateWithOwnModel([], False, 'vsps');
    try
      aHttpServer := TRestHttpServer.Create(SERVER_PORT, [aRestServer], '+', useHttpSocket);
      try
        aHttpServer.AccessControlAllowOrigin := '*';
        aHttpServer.Route.Get('/vsps/test', '/vsps/createport');

but am getting a 400 - Bad Request when I try a GET on /vsps/test.

the method is defined as:

procedure TVspsRestServer.CreatePort(Ctxt: TRestServerURIContext);

Offline

#2 2024-01-22 17:05:04

ulrichd
Member
Registered: 2018-07-30
Posts: 16

Re: Rerouting to REST server method

Sorry... my bad! it's working... it ran into my catchall which was returning the code 400. wink

Offline

Board footer

Powered by FluxBB