I'm using BaseX 8.4 but have recreated the issue with 8.5.4 beta 8d90b66

I'm POSTing xml files to a RESTXQ function using the following script

let $fpath := 'C:\incoming\SAQD\mo'
let $targetBasex := 'http://localhost:8984/saqd/mo/'
let $list :=  sort(file:list($fpath), function($fname) {fn:analyze-string($fname,'.*_(.*?)\.xml$')/fn:match/fn:group[@nr="1"]/string()})
for $file in $list
let $abspath := $fpath||'\'||$file
let $body := try {fetch:xml($abspath, map { 'chop': true() }) }
             catch * {()}
         
return if ( not(empty($body)) ) then (http:send-request(<http:request href="{$targetBasex||$file}"
method='POST'>
    <http:body media-type="text/xml">{$body}</http:body>
    </http:request>), file:move($abspath,$fpath||'\processed\'||$file) )
    else ()

The XML file has no namespace declarations.
The RESTXQ function does a db:update using the body received and the http-client namespace has been added to the root node.

If I POST to the same function using curl the stored document is unchanged.
The function is as follows.

declare 
%rest:path("/saqd/mo/{$fname}")
(: %rest:consumes("application/xml", "text/xml") :)
%rest:POST("{$body}")
%updating
function saqd:mo($fname, $body as document-node())
{
 try {(db:replace('SAQD', '/MO/'||$fname, $body ),
   db:output(http:send-request(<http:request href="{'http://example.org:8082/home/VALIDSCHEMA/xml/current/Metoffice_Data/'||$fname}" 
method='PUT' username='validuser' password='validpassword' send-authorization='true'>
    <http:body media-type='text/xml'>{$body}</http:body>
    </http:request>))
 )
}
catch * {db:output(
<rest:response>
<http:response status="500" message="{$err:code||' : '||$err:description}">
  </http:response>
</rest:response>)}
};


 The file PUT inside the db:output statement also gets the namespace added i.e. it happens even when the file was POSTed with curl so the recieved document still had no namespaces.

Is this expected behaviour, a bug, or am I using http:send-request incorrectly?

Regards,

chris sweeney