mirror of
https://github.com/foss42/apidash.git
synced 2025-05-25 10:16:43 +08:00
fixes
This commit is contained in:
@ -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(
|
||||
|
@ -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: {
|
||||
|
@ -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',
|
||||
|
Reference in New Issue
Block a user