From a105b085862fcadcf304df461775482a3811d3b3 Mon Sep 17 00:00:00 2001 From: Tanish2002 Date: Fri, 23 Feb 2024 21:08:51 +0530 Subject: [PATCH] fix: remove redundant multipart header - reqwest crate will add the headers and boundary itself. --- lib/codegen/rust/reqwest.dart | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/codegen/rust/reqwest.dart b/lib/codegen/rust/reqwest.dart index d242eb0b..6406fba8 100644 --- a/lib/codegen/rust/reqwest.dart +++ b/lib/codegen/rust/reqwest.dart @@ -43,8 +43,6 @@ class RustReqwestCodeGen { } """; - String kTemplateFormHeaderContentType = ''' -multipart/form-data; boundary={{boundary}}'''; int kHeadersPadding = 10; @@ -157,13 +155,6 @@ multipart/form-data; boundary={{boundary}}'''; var headersList = requestModel.enabledRequestHeaders; if (headersList != null || hasBody) { var headers = requestModel.enabledHeadersMap; - if (requestModel.isFormDataRequest) { - var formHeaderTemplate = - jj.Template(kTemplateFormHeaderContentType); - headers[HttpHeaders.contentTypeHeader] = formHeaderTemplate.render({ - "boundary": uuid, - }); - } if (headers.isNotEmpty || hasBody) { hasHeaders = true; if (hasBody) { @@ -181,7 +172,6 @@ multipart/form-data; boundary={{boundary}}'''; result += formDataBodyData.render( { "fields_list": json.encode(requestModel.formDataMapList), - "boundary": uuid, }, ); } @@ -206,7 +196,7 @@ multipart/form-data; boundary={{boundary}}'''; result += kStringRequestForm; } - if (hasHeaders || requestModel.isFormDataRequest) { + if (hasHeaders) { result += kStringRequestHeaders; }