add code generation

This commit is contained in:
AceDataCloud committed 2023-01-23 19:46:11 +08:00
1 parent 7b8ac91183
commit 8f8e291188
14 files changed
+362 -35

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
const options = {
method: '{{{method}}}',
headers: {
{{#headers}}
'{{{key}}}': '{{{value}}}'{{^last}},{{/last}}
{{/headers}}
},
body: JSON.stringify({
{{#body}}
{{{key}}}: '{{{value}}}'{{^last}},{{/last}}
{{/body}}
})
};
fetch('{{{url}}}', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));