From 2ce5727c01f5f00f5f8ad9c792faa2f66761057c Mon Sep 17 00:00:00 2001 From: adityamayukhsom Date: Wed, 3 Apr 2024 12:50:32 +0530 Subject: [PATCH] [ISSUE 375] - request initialization and body setup --- lib/codegen/php/curl.dart | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/lib/codegen/php/curl.dart b/lib/codegen/php/curl.dart index 8f1a4f7a..8e6f915c 100644 --- a/lib/codegen/php/curl.dart +++ b/lib/codegen/php/curl.dart @@ -154,21 +154,7 @@ echo $response; result += templateHeader.render({'headers': headers}); } - // contains the HTTP method associated with the request - var method = requestModel.method; - - // contains the entire request body as a string if body is present - var requestBody = requestModel.requestBody; - - //renders the request body - if (kMethodsWithBody.contains(method) && requestBody != null) { - var contentLength = utf8.encode(requestBody).length; - if (contentLength > 0) { - hasBody = true; - var templateBody = jj.Template(kTemplateBody); - result += templateBody.render({"body": requestBody}); - } - } + result += kStringRequestInit; //renders the request temlate var templateRequest = jj.Template(kTemplateRequest); @@ -180,7 +166,7 @@ echo $response; }); if (hasBody || requestModel.hasFormData) { - result += kStringRequestBody; + result += kStringRequestBodyOpt; } //and of the request