From a3fd05f9057af0dc3e8efebf941bdcf647b85f26 Mon Sep 17 00:00:00 2001 From: Ankit Mahato Date: Fri, 15 Mar 2024 18:56:06 +0530 Subject: [PATCH] fixes --- lib/codegen/js/axios.dart | 6 +++--- test/codegen/js_axios_codegen_test.dart | 15 +++------------ test/codegen/nodejs_axios_codegen_test.dart | 3 --- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/lib/codegen/js/axios.dart b/lib/codegen/js/axios.dart index 51859fc6..301ecf46 100644 --- a/lib/codegen/js/axios.dart +++ b/lib/codegen/js/axios.dart @@ -10,7 +10,7 @@ class AxiosCodeGen { final bool isNodeJs; String kStringImportNode = """import axios from 'axios'; -{%if hasFormData -%} +{%if hasFileInFormData -%} import fs from 'fs' {% endif %} @@ -52,12 +52,12 @@ axios(config) try { jj.Template kNodejsImportTemplate = jj.Template(kStringImportNode); String importsData = kNodejsImportTemplate.render({ - "hasFormData": requestModel.hasFormData, + "hasFileInFormData": requestModel.hasFileInFormData, }); String result = isNodeJs ? importsData - : requestModel.hasFormData + : requestModel.hasFileInFormData ? "// refer https://github.com/foss42/apidash/issues/293#issuecomment-1997568083 for details regarding integration\n\n" : ""; var harJson = requestModelToHARJsonRequest( diff --git a/test/codegen/js_axios_codegen_test.dart b/test/codegen/js_axios_codegen_test.dart index 1c417b63..15bbeff1 100644 --- a/test/codegen/js_axios_codegen_test.dart +++ b/test/codegen/js_axios_codegen_test.dart @@ -410,10 +410,7 @@ axios(config) expectedCode); }); test('POST 4', () { - const expectedCode = - r"""// refer https://github.com/foss42/apidash/issues/293#issuecomment-1997568083 for details regarding integration - -const config = { + const expectedCode = r"""const config = { url: 'https://api.apidash.dev/io/form', method: 'post', headers: { @@ -445,10 +442,7 @@ axios(config) }); test('POST 5', () { - const expectedCode = - r"""// refer https://github.com/foss42/apidash/issues/293#issuecomment-1997568083 for details regarding integration - -const config = { + const expectedCode = r"""const config = { url: 'https://api.apidash.dev/io/form', method: 'post', headers: { @@ -546,10 +540,7 @@ axios(config) expectedCode); }); test('POST 8', () { - const expectedCode = - r"""// refer https://github.com/foss42/apidash/issues/293#issuecomment-1997568083 for details regarding integration - -const config = { + const expectedCode = r"""const config = { url: 'https://api.apidash.dev/io/form', method: 'post', params: { diff --git a/test/codegen/nodejs_axios_codegen_test.dart b/test/codegen/nodejs_axios_codegen_test.dart index 84a7ae1d..31f359ea 100644 --- a/test/codegen/nodejs_axios_codegen_test.dart +++ b/test/codegen/nodejs_axios_codegen_test.dart @@ -461,7 +461,6 @@ axios(config) }); test('POST 4', () { const expectedCode = r"""import axios from 'axios'; -import fs from 'fs' const config = { url: 'https://api.apidash.dev/io/form', @@ -496,7 +495,6 @@ axios(config) test('POST 5', () { const expectedCode = r"""import axios from 'axios'; -import fs from 'fs' const config = { url: 'https://api.apidash.dev/io/form', @@ -597,7 +595,6 @@ axios(config) }); test('POST 8', () { const expectedCode = r"""import axios from 'axios'; -import fs from 'fs' const config = { url: 'https://api.apidash.dev/io/form',