Closed kschets closed 2 years ago
@kschets I'm glad you like the framework!
I'm not sure I got the point of your PR, though. I mean, why you wouldn't just write:
@app.route(output='bytes')
async def whatever():
response.content_type = 'application/octet-stream'
return your_binary_data()
Am I missing something?
@gi0baro You're absolutely right, I guess I was just too focused on trying to find a solution by means of adding a service which kept me from seeing the more obvious and already available solution, thanks for pointing it out ! Never mind the PR, hereby closed ... It would be worth adding the output option to the docs I think, how say thy ? Thanks again, Koen
@kschets no worries. As per documentation, output is already there: https://emmett.sh/docs/2.3.x/routing#output
Dear gi0baro, I absolutely love your Emmett framework ! My use-case for it is a web search-and-retrieve interface to an object storage based archive. When the user selects files to be downloaded from the archive they are added to a ZIP file and then get offered for download to the client by means of the "Content-Disposition": "attachment, filename ..." header. This means I needed a service next to "xml" and "json" which basically does nothing but passing the original file to the user ( default service would unzip the file, luckily the "bytes" output existed already ). I'm far from a pro Python programmer so forgive me the "hack" but it works for me so far. I would be very interested in an official solution of course ! Many thanks, Koen