The code I sent is the smallest example I have been able to produce.
If I got you right, data arrives correctly on port 9984; is that correct? If yes, we could get rid of CURL and RESTXQ (because we know everything is ok up to this point) and e.g. reduce your XQuery expression as follows:
http:send-request( <http:request method="POST">, <http:body media-type="image/png"/> </http:request>, "http://localhost:10000", bin:hex('414243') )
I then replaced the second BaseX with an nc -l on port 10000 [...]
I now need more hints regarding the second BaseX instance: What will it do when being addressed by localhost:10000? Do you have another RESTXQ function on top level that processes the request, or is it the plain BaseX REST API?