mirror of
https://github.com/foss42/apidash.git
synced 2025-07-18 07:54:30 +08:00
Update model & codegen
This commit is contained in:
@ -1,16 +1,10 @@
|
||||
import 'dart:io';
|
||||
import 'dart:convert';
|
||||
import 'package:apidash/utils/extensions/request_model_extension.dart';
|
||||
import 'package:jinja/jinja.dart' as jj;
|
||||
import 'package:apidash/consts.dart';
|
||||
import 'package:apidash/utils/utils.dart'
|
||||
show
|
||||
getNewUuid,
|
||||
getValidRequestUri,
|
||||
padMultilineString,
|
||||
rowsToFormDataMap,
|
||||
stripUriParams;
|
||||
import 'package:apidash/models/models.dart' show FormDataModel, RequestModel;
|
||||
show getNewUuid, getValidRequestUri, padMultilineString, stripUriParams;
|
||||
import 'package:apidash/models/models.dart' show RequestModel;
|
||||
|
||||
class PythonRequestsCodeGen {
|
||||
final String kTemplateStart = """import requests
|
||||
@ -107,7 +101,6 @@ print('Response Body:', response.text)
|
||||
bool hasHeaders = false;
|
||||
bool hasBody = false;
|
||||
bool hasJsonBody = false;
|
||||
List<FormDataModel> formDataList = requestModel.formDataList ?? [];
|
||||
String uuid = getNewUuid();
|
||||
|
||||
String url = requestModel.url;
|
||||
@ -181,7 +174,7 @@ print('Response Body:', response.text)
|
||||
var formDataBodyData = jj.Template(kStringFormDataBody);
|
||||
result += formDataBodyData.render(
|
||||
{
|
||||
"fields_list": json.encode(rowsToFormDataMap(formDataList)),
|
||||
"fields_list": json.encode(requestModel.formDataMapList),
|
||||
"boundary": uuid,
|
||||
},
|
||||
);
|
||||
|
Reference in New Issue
Block a user