Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to route Body response used for streaming #152

Open
hniksic opened this issue Nov 4, 2024 · 0 comments
Open

How to route Body response used for streaming #152

hniksic opened this issue Nov 4, 2024 · 0 comments

Comments

@hniksic
Copy link

hniksic commented Nov 4, 2024

I have an endpoint declared like this:

pub async fn handler(
    headers: HeaderMap,
    Path(audience_id): Path<Uuid>,
    Query(query): Query<UserInfoQuery>,
    Extension(state): Extension<Arc<bridge::State>>,
) -> Result<Body, Response> {
    // ...
    Ok(Body::from_stream(tokio_util::io::ReaderStream::new(stream)))
}

This handler is not accepted by aide::axum::routing::get_with because it returns Body. (If I change Body to e.g. Vec<u8>, the call to get_with() compiles.) I need to return Body to stream the response to the client. Is there a way to pass such a handler to aide?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant