Kibana plugin reply with custom headers

Hello.
There is registered routing for kibana plugin.

server.route({
path:'/api/data/export.csv',
method:'GET',
handler(req, reply) {
let respData ='abc,def,ghi,jkl\n';
respData+= '1,2,3,4\n';
reply(respData); }})

As you can see, it returns some csv 'text'. Is it possible to setup something, that it will have some other content-type? And browser will download data on this link, as a file?

Hey @undwood, the reply interface comes from hapi, so you can set the content-type like the following

reply(respData).type('text/csv')
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.