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

[Suggestion] Support API responses in file stream format. #1216

Open
rojiwon123 opened this issue Jan 31, 2025 · 0 comments
Open

[Suggestion] Support API responses in file stream format. #1216

rojiwon123 opened this issue Jan 31, 2025 · 0 comments

Comments

@rojiwon123
Copy link
Contributor

rojiwon123 commented Jan 31, 2025

Description

There are cases where API responses come in file (stream) format. Regardless of the NestJS Controller handler's return type, I want to change the response content type in Swagger or SDK documentation by recognizing the Header information.
In the NestJS official documentation, they guide both methods: directly connecting to the express or fastify response object using express(or fastify) res.pipe, and using the StreamableFile class as the handler return.

Can you please review support for some response content types (e.g. image/ ~ , video/ ~)?

@nestia/sdk v4.6.1

Image

Image

Suggestion

  • nest.Header("Content-Type", "image/*")
  • If the content-type is specified with a specific prefix (e.g., image, video), expect the API response to be in stream format, regardless of the controller handler's return type.
    Image
  • Swagger Example
    Image
  • Specify the sdk response body type as ReadableStream<Uint8Array<ArrayBufferLike>>.
@rojiwon123 rojiwon123 changed the title Support Content-Type "Image/*" Support API responses in file stream format. Jan 31, 2025
@rojiwon123 rojiwon123 changed the title Support API responses in file stream format. [Suggestion] Support API responses in file stream format. Jan 31, 2025
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