Skip to content

[REQ] [rust-axum] support text/event-stream #21967

@jacob-vincent-mink

Description

@jacob-vincent-mink

Is your feature request related to a problem? Please describe.

Currently, the rust-axum server generator only supports application/json responses. This feature request is for the generator to also support endpoints that respond with a stream or MAY respond with a stream.

Describe the solution you'd like

Ideally, the solution is for the traits created for a route to take into account a return value enum that is either a singular value or is a Box<dyn futures::Stream<Item=T> + Send + 'static> (and potentially Unpin?). Then in the route implementation, I can decide if I stream or not and return the appropriate enum variant.

Describe alternatives you've considered

Do it myself by modifying the generated source code in my project - not currently aware of any other options available within this tool.

Additional context

Filing a new ticket for this after quickly discussing with @linxGnu on another ticket. I am interested in contributing on something like this in order to speed up the process, if possible - but I would definitely need guidance and a little hand-holding. This feels like a larger feature than a regular old “first issue”.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions