mirror of
https://github.com/foss42/apidash.git
synced 2025-05-26 02:36:31 +08:00
fixes
This commit is contained in:
@ -10,7 +10,7 @@ class AxiosCodeGen {
|
|||||||
final bool isNodeJs;
|
final bool isNodeJs;
|
||||||
|
|
||||||
String kStringImportNode = """import axios from 'axios';
|
String kStringImportNode = """import axios from 'axios';
|
||||||
{%if hasFormData -%}
|
{%if hasFileInFormData -%}
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@ -52,12 +52,12 @@ axios(config)
|
|||||||
try {
|
try {
|
||||||
jj.Template kNodejsImportTemplate = jj.Template(kStringImportNode);
|
jj.Template kNodejsImportTemplate = jj.Template(kStringImportNode);
|
||||||
String importsData = kNodejsImportTemplate.render({
|
String importsData = kNodejsImportTemplate.render({
|
||||||
"hasFormData": requestModel.hasFormData,
|
"hasFileInFormData": requestModel.hasFileInFormData,
|
||||||
});
|
});
|
||||||
|
|
||||||
String result = isNodeJs
|
String result = isNodeJs
|
||||||
? importsData
|
? importsData
|
||||||
: requestModel.hasFormData
|
: requestModel.hasFileInFormData
|
||||||
? "// refer https://github.com/foss42/apidash/issues/293#issuecomment-1997568083 for details regarding integration\n\n"
|
? "// refer https://github.com/foss42/apidash/issues/293#issuecomment-1997568083 for details regarding integration\n\n"
|
||||||
: "";
|
: "";
|
||||||
var harJson = requestModelToHARJsonRequest(
|
var harJson = requestModelToHARJsonRequest(
|
||||||
|
@ -410,10 +410,7 @@ axios(config)
|
|||||||
expectedCode);
|
expectedCode);
|
||||||
});
|
});
|
||||||
test('POST 4', () {
|
test('POST 4', () {
|
||||||
const expectedCode =
|
const expectedCode = r"""const config = {
|
||||||
r"""// refer https://github.com/foss42/apidash/issues/293#issuecomment-1997568083 for details regarding integration
|
|
||||||
|
|
||||||
const config = {
|
|
||||||
url: 'https://api.apidash.dev/io/form',
|
url: 'https://api.apidash.dev/io/form',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
@ -445,10 +442,7 @@ axios(config)
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('POST 5', () {
|
test('POST 5', () {
|
||||||
const expectedCode =
|
const expectedCode = r"""const config = {
|
||||||
r"""// refer https://github.com/foss42/apidash/issues/293#issuecomment-1997568083 for details regarding integration
|
|
||||||
|
|
||||||
const config = {
|
|
||||||
url: 'https://api.apidash.dev/io/form',
|
url: 'https://api.apidash.dev/io/form',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
@ -546,10 +540,7 @@ axios(config)
|
|||||||
expectedCode);
|
expectedCode);
|
||||||
});
|
});
|
||||||
test('POST 8', () {
|
test('POST 8', () {
|
||||||
const expectedCode =
|
const expectedCode = r"""const config = {
|
||||||
r"""// refer https://github.com/foss42/apidash/issues/293#issuecomment-1997568083 for details regarding integration
|
|
||||||
|
|
||||||
const config = {
|
|
||||||
url: 'https://api.apidash.dev/io/form',
|
url: 'https://api.apidash.dev/io/form',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
params: {
|
params: {
|
||||||
|
@ -461,7 +461,6 @@ axios(config)
|
|||||||
});
|
});
|
||||||
test('POST 4', () {
|
test('POST 4', () {
|
||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
import fs from 'fs'
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
url: 'https://api.apidash.dev/io/form',
|
url: 'https://api.apidash.dev/io/form',
|
||||||
@ -496,7 +495,6 @@ axios(config)
|
|||||||
|
|
||||||
test('POST 5', () {
|
test('POST 5', () {
|
||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
import fs from 'fs'
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
url: 'https://api.apidash.dev/io/form',
|
url: 'https://api.apidash.dev/io/form',
|
||||||
@ -597,7 +595,6 @@ axios(config)
|
|||||||
});
|
});
|
||||||
test('POST 8', () {
|
test('POST 8', () {
|
||||||
const expectedCode = r"""import axios from 'axios';
|
const expectedCode = r"""import axios from 'axios';
|
||||||
import fs from 'fs'
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
url: 'https://api.apidash.dev/io/form',
|
url: 'https://api.apidash.dev/io/form',
|
||||||
|
Reference in New Issue
Block a user