Hi all,
We've run into a strange issue that we never experienced beforehand even if it's something we should have done thousands of time.
Consider storing a resource sent through a RestXQ POST directly to a database.
The restxq module
module namespace o = "test";
(:sendMessage: Send a new message:)
declare
%rest:path('test/savemsg')
%rest:POST('{$body}')
%rest:consumes("application/xml")
function o:save-message($body as document-node()) {
db:add('hereiam', $body, 'saved.xml')
};
The client request:
http:send-request(
<http:request method="POST" href="http://localhost:8984/test/savemsg">
<http:body media-type="application/xml">
<a>
<b/>
</a>
</http:body>
</http:request>
)
The resource gets stored into the DB with all the extra text nodes containing white spaces (codepoints 10 and 32) something like:
<a>
<b/>
</a>
That's pretty strange because if I PUT the resource through Basex REST interface it doesn't create the spaces and the same if I directly db:add the resource.
We noticed this oddity on BaseX 8.3.1 and could verify it on a Basex 8.2 and 8.1.1 as well.
It works neatly on an older 7.9 version we still have around
The applies same if the resource is sent through curl or Chrome Postman.
What are we doing wrong?
Thanks.
Marco.