Open joschrew opened 2 years ago
Since this is the accept header of the request, we can still return responses that are not application/json
. Yes, that's not a proper way to do that but at least we will have working test cases that can verify the content. When we find a proper way to achieve the same, we can change it.
Here, instead of returning a WorkspaceRsrc
, we could return a FileResponse
. The return type could be decided based on another flag, not the accept
.
https://github.com/OCR-D/ocrd-webapi-implementation/blob/main/ocrd_webapi/routers/workspace.py#L61-L81
EDIT: We should maybe just consider testing by using curl
in our tests for these specific cases instead of trying workaround hacks.
zip download does not work with accept-header and fastapi's generated-swagger-client (the ui you get at /docs). There only application/json can be set as accept header. www.github.com/tiangolo/fastapi/issues/4438