I'm trying to reach an api with this request url :
https://myapi/api/v4/contract/id/recipients/
In my code it looks like that :
var
RESTClient : TRESTClient;
...
begin
RESTClient := TRESTClient.Create('');
try
RESTClient.BaseURL := 'https://myapi/api/v4/contract/id/recipients/';
ShowMessage(RestClient.BaseURL);
...
finally
RESTClient.Free;
end;
end;
But instead of the URL I put inside my RESTClient.BaseURL
it shows me:
https://myapi/api/v4/contract/id/recipients
Is there a method that can force the last /
? I tried the IncludeTrailingPathDelimiter
method but that added a \
instead. I also found a IncludeTrailingSlash
method but my compiler did not recognise it.
CodePudding user response:
Assuming that you are using a TRESTRequest
together with the TRESTClient
, you should split the URL into the real BaseURL
https://myapi/api/v4 for the client and the Resource
part contract/id/recipients/ for the request. That way the combined URL for this request will contain the ending slash.