Ok the suggested reduction seems meaningful.
Anyway that's what i do on the backend service, directly copied from my original post:
declare
%rest:path("/service/files/{$name}")
%rest:POST("{$body}")
%rest:consumes("image/png", "image/jpg", "image/jpeg", "image/gif", "image/svg+xml")
%output:method("text")
function m:upload-maps($userid as xs:string, $name as xs:string, $body as item()){
let $stored := db:store("files", $name, $body)
return
<rest:response>
<http:response status="201"/>
</rest:response>
};
> 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?