mirror of
https://github.com/foss42/apidash.git
synced 2025-08-06 05:32:26 +08:00
fixes
This commit is contained in:
@ -12,7 +12,7 @@ class FetchCodeGen {
|
||||
String kStringImportNode = """
|
||||
import fetch from 'node-fetch'
|
||||
{% if hasFormData -%}
|
||||
import { fileFromSync, FormData } from 'node-fetch'
|
||||
import { {% if hasFileInFormData %}fileFromSync, {% endif %}FormData } from 'node-fetch'
|
||||
{% endif %}
|
||||
|
||||
""";
|
||||
@ -57,6 +57,7 @@ fetch(url, options)
|
||||
jj.Template kNodejsImportTemplate = jj.Template(kStringImportNode);
|
||||
String importsData = kNodejsImportTemplate.render({
|
||||
"hasFormData": requestModel.hasFormData,
|
||||
"hasFileInFormData": requestModel.hasFileInFormData,
|
||||
});
|
||||
|
||||
String result = isNodeJs
|
||||
|
@ -502,7 +502,7 @@ fetch(url, options)
|
||||
});
|
||||
test('POST 4', () {
|
||||
const expectedCode = r"""import fetch from 'node-fetch'
|
||||
import { fileFromSync, FormData } from 'node-fetch'
|
||||
import { FormData } from 'node-fetch'
|
||||
|
||||
const payload = new FormData();
|
||||
payload.append("text", "API")
|
||||
@ -537,7 +537,7 @@ fetch(url, options)
|
||||
|
||||
test('POST 5', () {
|
||||
const expectedCode = r"""import fetch from 'node-fetch'
|
||||
import { fileFromSync, FormData } from 'node-fetch'
|
||||
import { FormData } from 'node-fetch'
|
||||
|
||||
const payload = new FormData();
|
||||
payload.append("text", "API")
|
||||
@ -640,7 +640,7 @@ fetch(url, options)
|
||||
});
|
||||
test('POST 8', () {
|
||||
const expectedCode = r"""import fetch from 'node-fetch'
|
||||
import { fileFromSync, FormData } from 'node-fetch'
|
||||
import { FormData } from 'node-fetch'
|
||||
|
||||
const payload = new FormData();
|
||||
payload.append("text", "API")
|
||||
|
Reference in New Issue
Block a user