Drop use of deprecated `method parameter of starlette FileResponse`

Removed in starlette 1.0, see https://github.com/Kludex/starlette/pull/3147

Fix the following mypy errors in package tests:

```
galaxy/webapps/base/api.py:94: error: Too many arguments for "__init__" of
"FileResponse"  [call-arg]
            super().__init__(
            ^~~~~~~~~~~~~~~~~
galaxy/webapps/base/api.py:95: error: Argument 8 to "__init__" of
"FileResponse" has incompatible type "str | None"; expected "str"  [arg-type]
    ..., media_type, background, filename, stat_result, method, content_dispo...
                                                        ^~~~~~
```
This commit is contained in:
Nicola Soranzo
2026-03-23 01:41:25 +00:00
parent 2d27004b23
commit 63954cb42e
2 changed files with 10 additions and 4 deletions
+8 -2
View File
@@ -88,11 +88,17 @@ class GalaxyFileResponse(FileResponse):
background: Optional["BackgroundTask"] = None,
filename: Optional[str] = None,
stat_result: Optional[os.stat_result] = None,
method: Optional[str] = None,
content_disposition_type: str = "attachment",
) -> None:
super().__init__(
path, status_code, headers, media_type, background, filename, stat_result, method, content_disposition_type
path=path,
status_code=status_code,
headers=headers,
media_type=media_type,
background=background,
filename=filename,
stat_result=stat_result,
content_disposition_type=content_disposition_type,
)
self.headers["accept-ranges"] = "bytes"
self.xsendfile = self.nginx_x_accel_redirect_base or self.apache_xsendfile
+2 -2
View File
@@ -290,7 +290,7 @@ class FastAPIDatasets:
assert isinstance(display_data, IOBase)
file_name = getattr(display_data, "name", None)
assert file_name
return GalaxyFileResponse(file_name, headers=headers, method=request.method)
return GalaxyFileResponse(file_name, headers=headers)
@router.get(
"/api/histories/{history_id}/contents/{history_content_id}/display",
@@ -374,7 +374,7 @@ class FastAPIDatasets:
if isinstance(display_data, IOBase):
file_name = getattr(display_data, "name", None)
if file_name:
return GalaxyFileResponse(file_name, headers=headers, method=request.method)
return GalaxyFileResponse(file_name, headers=headers)
elif isinstance(display_data, ZipstreamWrapper):
return StreamingResponse(display_data.response(), headers=headers)
elif isinstance(display_data, bytes):