Hi,
I would like to use XDataClient for non-Xdata third party servers. As leveraging the xdata json parsing functionality with only an interface is pretty clean.
I have a few issues:
All Req.Uri get a trailing "/" added to the url. For example: "login.server.com/auth/" in stead of "login.server.com/auth". Some servers do not accept the trailing "/" and return a 404 error.
When using the x-www-form-urlencoded parameters (and maybe also the fromquery parameters, I haven't tested that one yet), all string values in the content body are quoted.
For example:
password=''xxxxxx''&username=''yyyyy''
This results in an error because other servers expect:
password=xxxxxx&username=yyyyy
It is possible to overwrite the THttpRequest, to make it work:
XDataClient.HttpClient.OnSendingRequest :=
procedure(Req: THttpRequest)
begin
Req.Uri := 'https://login.server.com/auth';
Req.SetContent(TEncoding.UTF8.GetBytes('password=xxx&username=xxx'));
end;
Isn't there an easier way? For example two settings:
- turn off trailing "/"
- turn off quoted strings
Thank you!
The interface is based on:
https://support.tmssoftware.com/t/xdata-read-x-www-form-urlencoded-parameters/22715/4