I was faintly hoping that a sequence will be magically output as multipart/mixed with appropriate part content types when I annotate it with %rest:produces("multipart/mixed"):
declare %rest:GET %rest:path("/test") %rest:produces("multipart/mixed") function my:test-multipart() { (<ok/>, json:serialize(map{'some':'json'})) };
But the response header says "Content-Type: application/xml", and the result is
<ok/> { "some": "json" }
Are there some other functions or annotations or rest:response elements that I can use in order to get multipart/mixed correctly assembled? Bonus: With the possibility to add file names to each chunk?
Gerrit
Hi Gerrit,
As for now, multipart support is only available for requests (multipart/mixed [1], multipart/form-data [2]). Responses are limited to single parts as multipart data had not been considered in the RESTXQ specification.
It would be reasonable to also choose sequences for multipart/mixed and maps for multipart/form-data (with filenames as keys). I’ll have some more thoughts on that.
Best, Christian
[1] https://docs.basex.org/wiki/RESTXQ#Multipart_Types [2] https://docs.basex.org/wiki/RESTXQ#HTML_Form_Fields
On Mon, Feb 21, 2022 at 11:07 PM Imsieke, Gerrit, le-tex gerrit.imsieke@le-tex.de wrote:
I was faintly hoping that a sequence will be magically output as multipart/mixed with appropriate part content types when I annotate it with %rest:produces("multipart/mixed"):
declare %rest:GET %rest:path("/test") %rest:produces("multipart/mixed") function my:test-multipart() { (<ok/>, json:serialize(map{'some':'json'})) };
But the response header says "Content-Type: application/xml", and the result is
<ok/> { "some": "json" }
Are there some other functions or annotations or rest:response elements that I can use in order to get multipart/mixed correctly assembled? Bonus: With the possibility to add file names to each chunk?
Gerrit
basex-talk@mailman.uni-konstanz.de