Skip to content

Commit 21c5a41

Browse files
authored
fix: Fixed bad parsing of binary request bodies (#156)
1 parent 0642b2b commit 21c5a41

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/extensions/request.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ extension RequestCopyWith on Request {
2121
final copied = Request(
2222
method?.asString ?? this.method,
2323
url ?? this.url,
24-
)..body = this.body;
24+
)..bodyBytes = this.bodyBytes;
25+
26+
try {
27+
copied.body = this.body;
28+
} catch (e) {
29+
// Do not try to get body as string when it is not parseable
30+
}
2531

2632
if (body != null) {
2733
copied.body = body;

0 commit comments

Comments
 (0)