-
-
Notifications
You must be signed in to change notification settings - Fork 71
fix: general quality of service improvements #167
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
base: main
Are you sure you want to change the base?
Conversation
096a4ab
to
84220b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: CopyWith Mutates Original MultipartRequest Files
The MultipartRequest.copyWith
method calls file.finalize()
on the original MultipartFile
objects. Since finalize()
consumes the file's stream and can only be called once, this makes the original request's files unusable and can result in the copied request having invalid or empty file contents if the originals were already finalized. This violates the non-mutating behavior expected from copyWith()
.
lib/extensions/multipart_request.dart#L25-L44
http_interceptor/lib/extensions/multipart_request.dart
Lines 25 to 44 in 7a57b40
for (var file in this.files) { | |
clonedRequest.files.add(MultipartFile( | |
file.field, | |
file.finalize(), | |
file.length, | |
filename: file.filename, | |
contentType: file.contentType, | |
)); | |
} | |
} else { | |
// Use the provided files | |
for (var file in files) { | |
clonedRequest.files.add(MultipartFile( | |
file.field, | |
file.finalize(), | |
file.length, | |
filename: file.filename, | |
contentType: file.contentType, | |
)); | |
} |
Was this report helpful? Give feedback by reacting with 👍 or 👎
No description provided.