Thanks guys! I have no idea how I missed that.
BR
On Tuesday, June 15, 2021, 6:21:34 PM GMT+2, Christian Grün christian.gruen@gmail.com wrote:
Hi BR,
You can also use the %rest:header-param annotation:
declare %rest:path('/test') %rest:header-param('User-Agent', '{$agent}') function local:test($agent) { element agent { $agent } };
Check out [1] for "User-Agent" and additional examples.
Best, Christian
[1] https://docs.basex.org/wiki/RESTXQ
On Tue, Jun 15, 2021 at 4:33 PM dudzikp@yahoo.com dudzikp@yahoo.com wrote:
Dear all,
I do not see an option to obtain the headers from the HTTP request from inside webapp function. Just like in the example:
declare %rest:GET %rest:path('tests-html') ???%rest:headers('User-Agent')??? %output:method('html') function page-main:start-empty( ???$user-agent as xs:string??? ) as element(html) { ... }
Is this possible?
BR