Refactored makeStreamedRequest out & replaced sendHttpRequest underlying code

This commit is contained in:
Manas Hejmadi
2025-07-03 19:27:49 +05:30
parent ce1a463d75
commit 2ab6de6a62
4 changed files with 210 additions and 182 deletions

View File

@@ -67,9 +67,13 @@ class HttpResponseModel with _$HttpResponseModel {
HttpHeaders.contentLengthHeader: response.contentLength.toString(),
}, response.headers);
MediaType? mediaType = getMediaTypeFromHeaders(responseHeaders);
final body = (mediaType?.subtype == kSubTypeJson)
? utf8.decode(response.bodyBytes)
: response.body;
//TODO: Review Effectiveness
final body = decodeBytes(
response.bodyBytes,
response.headers['content-type']!,
);
return HttpResponseModel(
statusCode: response.statusCode,
headers: responseHeaders,