Skip to content

Commit a3fd05f

Browse files
committed
fixes
1 parent f80b6b3 commit a3fd05f

File tree

3 files changed

+6
-18
lines changed

3 files changed

+6
-18
lines changed

lib/codegen/js/axios.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class AxiosCodeGen {
1010
final bool isNodeJs;
1111

1212
String kStringImportNode = """import axios from 'axios';
13-
{%if hasFormData -%}
13+
{%if hasFileInFormData -%}
1414
import fs from 'fs'
1515
{% endif %}
1616
@@ -52,12 +52,12 @@ axios(config)
5252
try {
5353
jj.Template kNodejsImportTemplate = jj.Template(kStringImportNode);
5454
String importsData = kNodejsImportTemplate.render({
55-
"hasFormData": requestModel.hasFormData,
55+
"hasFileInFormData": requestModel.hasFileInFormData,
5656
});
5757

5858
String result = isNodeJs
5959
? importsData
60-
: requestModel.hasFormData
60+
: requestModel.hasFileInFormData
6161
? "// refer https://github.com/foss42/apidash/issues/293#issuecomment-1997568083 for details regarding integration\n\n"
6262
: "";
6363
var harJson = requestModelToHARJsonRequest(

test/codegen/js_axios_codegen_test.dart

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,7 @@ axios(config)
410410
expectedCode);
411411
});
412412
test('POST 4', () {
413-
const expectedCode =
414-
r"""// refer https://github.com/foss42/apidash/issues/293#issuecomment-1997568083 for details regarding integration
415-
416-
const config = {
413+
const expectedCode = r"""const config = {
417414
url: 'https://api.apidash.dev/io/form',
418415
method: 'post',
419416
headers: {
@@ -445,10 +442,7 @@ axios(config)
445442
});
446443

447444
test('POST 5', () {
448-
const expectedCode =
449-
r"""// refer https://github.com/foss42/apidash/issues/293#issuecomment-1997568083 for details regarding integration
450-
451-
const config = {
445+
const expectedCode = r"""const config = {
452446
url: 'https://api.apidash.dev/io/form',
453447
method: 'post',
454448
headers: {
@@ -546,10 +540,7 @@ axios(config)
546540
expectedCode);
547541
});
548542
test('POST 8', () {
549-
const expectedCode =
550-
r"""// refer https://github.com/foss42/apidash/issues/293#issuecomment-1997568083 for details regarding integration
551-
552-
const config = {
543+
const expectedCode = r"""const config = {
553544
url: 'https://api.apidash.dev/io/form',
554545
method: 'post',
555546
params: {

test/codegen/nodejs_axios_codegen_test.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,6 @@ axios(config)
461461
});
462462
test('POST 4', () {
463463
const expectedCode = r"""import axios from 'axios';
464-
import fs from 'fs'
465464
466465
const config = {
467466
url: 'https://api.apidash.dev/io/form',
@@ -496,7 +495,6 @@ axios(config)
496495

497496
test('POST 5', () {
498497
const expectedCode = r"""import axios from 'axios';
499-
import fs from 'fs'
500498
501499
const config = {
502500
url: 'https://api.apidash.dev/io/form',
@@ -597,7 +595,6 @@ axios(config)
597595
});
598596
test('POST 8', () {
599597
const expectedCode = r"""import axios from 'axios';
600-
import fs from 'fs'
601598
602599
const config = {
603600
url: 'https://api.apidash.dev/io/form',

0 commit comments

Comments
 (0)