Nothing Special   »   [go: up one dir, main page]

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

[Feature request] Multipart request progress support #362

Open
pierremrtn opened this issue Sep 22, 2022 · 3 comments
Open

[Feature request] Multipart request progress support #362

pierremrtn opened this issue Sep 22, 2022 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@pierremrtn
Copy link

It would be great to have a way to get the upload progress of multipart requests. An example of how to achieve this with http package can be found here.
Maybe by adding a new annotation? Something like:

  @Post(path: '/file')
  @Multipart()
  Future<Response<void>> uploadFile(
    @Query('filename') String fileName,
    @PartFile() String filePath,
    /// A callback that take the progress of the upload as a double between 0 and 1
    @ProgressCallback() void Function(double) progressCallback,
);
@techouse techouse added the enhancement New feature or request label Jan 8, 2023
@Guldem
Copy link
Contributor
Guldem commented Jan 10, 2023

When looking at the example it looks like its actually using the HttpClient from dart.io instead of http dart package which chopper is using. Reading into some more documentation the http package lists using StreamedRequest as a possibility.

I think it take a bit more investigation on figuring out how too get the progress :)

@techouse techouse added the investigation The issue needs further investigation label Jan 11, 2023
@bmadaras
Copy link

Looks to me that the easy way to do this would be to extend the http packages MultipartRequest and override the finalize method to include the progress callback.
Is there any appetite to do that within this library or is the plan to just wait for something like the following which doesn't seem to be getting the attention that it deserves.
dart-lang/http#579

@Guldem
Copy link
Contributor
Guldem commented Mar 29, 2023

Haven't had the time to further investigate this. There is also this dart-lang/http#728 PR which has a bit more attention and also adds a upload progress to the http client. Would be nice if it was included and easier intergrading in chopper. But that no guarantee.

What I did look into was that it might be possible to finalize the MultipartRequest which results in a ByteStream which maybe could be used in a StreamedRequest. This could be done by creating a extended MultipartRequest or just a method converting the MultipartRequest to StreamedRequest. But feels a bit hacky converting the Request types.

@techouse techouse removed the investigation The issue needs further investigation label Sep 3, 2023
@techouse techouse added the help wanted Extra attention is needed label Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants