Einzelnen Beitrag anzeigen

Kas Ob.

Registriert seit: 3. Sep 2023
382 Beiträge
 
#7

AW: CURL in Delphi ausführen -d

  Alt Gestern, 08:49
@Ykcim, Hi

Here few thoughts :
1) Skip WireShark as it is overkill in your situation, you have CURL commands which easily can be logged in full with -v (--verbose) you can have the headers in full but with --trace, you will have everything even the body (payload/post_content/data/post_data ... these just names for the same thing)
https://everything.curl.dev/usingcur...ose/trace.html
Also in your Delphi code you have access to Request then just right before Request.Execute; grab the headers and the body and log it or show it somewhere, then compare to find your problem, don't have these access to TRESTClient and TRESTRequest, so may be someone else here can help with that, i mean how to extract the header and the body also the URI/URL.

2) CURL command you pasted has "-d" for these parameters this means they are in the body request aka post payload, unlike your other question not long ago, see and remember there is 3 places data can be exchanged between HTTP client and server, in the URI, HTTP header or in the body, make sure to put each in its needed place as requested per documentation, for that use (1) above in case you are in doubt.

3) What Uwe suggested is right and should be followed always, for these common header fields that are known and almost always needed, you should use the provided and named property to set the values, in other words if there is a property TRESTRequest like these "Request.Accept und Client.ContentType" then use them and don't use the "Request.Params.AddItem('accept',...." or "Request.Params.AddItem('content-type',..."
Kas
  Mit Zitat antworten Zitat