Merge pull request #161 from Tanish2002/fix-redundant-form-payload

fix: remove redundant body payload from codegen
This commit is contained in:
Ankit Mahato
2024-03-10 00:25:50 +05:30
committed by GitHub
4 changed files with 10 additions and 4 deletions

View File

@ -112,7 +112,9 @@ Map<String, dynamic> requestModelToHARJsonRequest(
var method = requestModel.method;
var requestBody = requestModel.requestBody;
if (kMethodsWithBody.contains(method) && requestBody != null) {
if (kMethodsWithBody.contains(method) &&
requestBody != null &&
!requestModel.isFormDataRequest) {
var contentLength = utf8.encode(requestBody).length;
if (contentLength > 0) {
hasBody = true;