Closed Peter9192 closed 1 year ago
Tried using accept header to request specific output format. This works, but not through the openapi docs. Perhaps a more graceful option is better: try to respect requested header, but fallback to default if that doesn't work. Another alternative is to use a query parameter instead.
With respect to the exclude
option: shutils.make_archive
doesn't have that natively. Solution could be to copy content to a temporary directory excluding some files, and pack the tempdir.
Maybe we can explicitly add "accept" value to the FileResponse object
Using a query instead of accept header make it possible to copy the URL
can also use PyFileSystem with a file-like streamingresponse.
Then we can build the archive in-memory, walking over the directory contents including/excluding files as specified. Challenge will be to change the in-memory archive from write to read mode. Fallback option will be to write to tempfile on disk.
Maybe we can explicitly add "accept" value to the FileResponse object
Doesn't solve the issue with the openapi docs, it will still submit as application/json
you could try to add binary content type application/octet-stream
in openapi spec
you could try to add binary content type
application/octet-stream
in openapi spec
That works 🎉 I'll keep using the query param as I like that the URL is copy-able, but adding this additional info to the API is still useful :-)
@sverhoeven thanks for the helpful review! I addressed all comments, can you have another look?
Add endpoint for downloading contents of job folder as archive.
To do:
To test:
refs #66