Request Body to String? from dynamic

This commit is contained in:
Ankit Mahato
2023-03-23 03:45:11 +05:30
parent e7eee508c6
commit 454ebd4b8a
3 changed files with 13 additions and 15 deletions

View File

@ -116,14 +116,13 @@ import 'dart:convert';
}
var method = requestModel.method;
if (kMethodsWithBody.contains(method) &&
requestModel.requestBody != null) {
var contentLength = utf8.encode(requestModel.requestBody).length;
var requestBody = requestModel.requestBody;
if (kMethodsWithBody.contains(method) && requestBody != null) {
var contentLength = utf8.encode(requestBody).length;
if (contentLength > 0) {
hasBody = true;
var body = requestModel.requestBody;
var templateBody = jj.Template(kTemplateBody);
result += templateBody.render({"body": body});
result += templateBody.render({"body": requestBody});
result = kBodyImportDartConvert + result;
result += kBodyLength;
}