Skip to content

Expose response metadata on FileDownloadResponse #90

@kryachkow

Description

@kryachkow

Name and Version

latest

What is the problem this feature will solve?

FileDownloadResponse should expose HTTP response metadata such as headers and content type through public accessors.

What is the feature you are proposing to solve the problem?

Motivation

Consumers sometimes need the downloaded file content together with response metadata. In StatGPT Backend we need to return file bytes together with the Content-Type header.

At the moment, this requires accessing a private field:

download = await async_client.files.download(url)
content = await download.aget_content()
content_type = download._response.headers.get("content-type", "application/octet-stream")

This works, but it depends on an internal implementation detail.

Proposed API

Add one or more public accessors to FileDownloadResponse, for example:

@property
def headers(self) -> httpx.Headers: ...

@property
def content_type(self) -> str | None: ...

Use Case

StatGPT Backend currently wraps DIAL file downloads in a helper that returns (content, content_type). Without a public metadata accessor, fully migrating to aidial-client still requires private _response access.

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions