Hello
I'm testing the demo TMS XData\Demos\firedac-sql\server
When i call POST http://localhost:2001/tms/firedacsql/customers with
{
"id": 7,
"name": "my test",
"country": "test"
}
The procedure CreateCustomer(Customer: TCustomer);
is trigered but the object "Customer is empty !
I tested with swagger, it's ok but not with delphi RestDebugger or Bommerang google add-on .
Why the object is empty ?
Thank you.
Delphi 11, win 11 x64
wlandgraf
(Wagner Landgraf)
July 12, 2023, 12:24pm
2
If it works with Swagger but not with other tools, please give more details about how you are doing the requests with such tools. It's of course some wrong configuration.
Thank you for reply.
I tested with Bommerang add-on, PostMan and Delphi RestDebugger
With PostMan :
When i debug with swagger i have this:
And with Bommerang:
Thank you.
wlandgraf
(Wagner Landgraf)
July 12, 2023, 1:17pm
4
And what is the full response you get (headers and response body) when you do such requests?
With Bommerang :
204 No Content, 2116ms, undefined
content-length: 0
date: Wed, 12 Jul 2023 13:27:04 GMT
server: Microsoft-HTTPAPI/2.0
xdata-version: 2
With Swagger
HTTP/1.1 204 No Content
Content-Length: 0
Server: Microsoft-HTTPAPI/2.0
xdata-version: 2
Date: Wed, 12 Jul 2023 13:01:54 GMT
wlandgraf
(Wagner Landgraf)
July 12, 2023, 2:23pm
6
It looks everything is ok, the response is the same.
Yes, but i don't understand why with swagger the customer is no empty.
The only difference that i can see , it's in the header request
on swagger : Sec-Fetch-Site = Same-origin
on bommerang : = Sec-Fetch-Site = none
wlandgraf
(Wagner Landgraf)
July 12, 2023, 8:25pm
8
I don't use the other tools, but I use Postman. Do you see the same issue with Postman? If yes, please share the Postman request here so I can try to reproduce the issue.
Finally,
I found the difference,
The json in body of the request is case-sensitive.
wlandgraf
(Wagner Landgraf)
July 17, 2023, 2:19pm
10
Correct, JSON is always case-sensitive.
I recommend you set UnknownMemberHandling
property of the TXDataServer
to TUnknownMemberHandling.Error
. This way, XData will raise an error if the JSON contains properties that it does not know.
system
(system)
Closed
July 18, 2023, 2:20pm
11
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.