mirror of
https://github.com/foss42/apidash.git
synced 2025-12-01 10:17:47 +08:00
feat: wipe current request data before making changes
This commit is contained in:
@@ -107,6 +107,8 @@ class RequestApplyService {
|
||||
body: body,
|
||||
bodyContentType: bodyContentType,
|
||||
formData: formData.isEmpty ? null : formData,
|
||||
params: const [],
|
||||
isParamEnabledList: const [],
|
||||
);
|
||||
return const ApplyResult(
|
||||
systemMessage: 'Applied cURL to the selected request.',
|
||||
@@ -221,6 +223,9 @@ class RequestApplyService {
|
||||
body: body,
|
||||
bodyContentType: bodyContentType,
|
||||
formData: formData.isEmpty ? null : formData,
|
||||
// Wipe existing parameters and authentication to ensure clean state
|
||||
params: const [],
|
||||
isParamEnabledList: const [],
|
||||
);
|
||||
return const ApplyResult(
|
||||
systemMessage: 'Applied OpenAPI operation to the selected request.',
|
||||
|
||||
@@ -29,8 +29,6 @@ import 'package:curl_parser/curl_parser.dart';
|
||||
/// concern). Not part of request description.
|
||||
/// - `--globoff`: parsing behavior for the curl CLI; irrelevant post-parse.
|
||||
|
||||
|
||||
|
||||
/// Service to parse cURL commands and produce
|
||||
/// a standard action message map understood by Dashbot.
|
||||
class CurlImportService {
|
||||
@@ -117,14 +115,14 @@ class CurlImportService {
|
||||
{
|
||||
'action': 'apply_curl',
|
||||
'target': 'httpRequestModel',
|
||||
'field': 'apply_to_selected',
|
||||
'field': 'apply_to_new',
|
||||
'path': null,
|
||||
'value': actionPayload,
|
||||
},
|
||||
{
|
||||
'action': 'apply_curl',
|
||||
'target': 'httpRequestModel',
|
||||
'field': 'apply_to_new',
|
||||
'field': 'apply_to_selected',
|
||||
'path': null,
|
||||
'value': actionPayload,
|
||||
}
|
||||
|
||||
@@ -246,14 +246,14 @@ class OpenApiImportService {
|
||||
{
|
||||
'action': 'apply_openapi',
|
||||
'target': 'httpRequestModel',
|
||||
'field': 'apply_to_selected',
|
||||
'field': 'apply_to_new',
|
||||
'path': null,
|
||||
'value': actionPayload,
|
||||
},
|
||||
{
|
||||
'action': 'apply_openapi',
|
||||
'target': 'httpRequestModel',
|
||||
'field': 'apply_to_new',
|
||||
'field': 'apply_to_selected',
|
||||
'path': null,
|
||||
'value': actionPayload,
|
||||
}
|
||||
|
||||
@@ -417,6 +417,10 @@ class ChatViewmodel extends StateNotifier<ChatState> {
|
||||
body: body,
|
||||
bodyContentType: bodyContentType,
|
||||
formData: formData.isEmpty ? null : formData,
|
||||
// Wipe existing parameters and authentication to ensure clean state
|
||||
params: const [],
|
||||
isParamEnabledList: const [],
|
||||
authModel: null,
|
||||
);
|
||||
_appendSystem('Applied OpenAPI operation to the selected request.',
|
||||
ChatMessageType.importOpenApi);
|
||||
@@ -911,6 +915,10 @@ class ChatViewmodel extends StateNotifier<ChatState> {
|
||||
body: body,
|
||||
bodyContentType: bodyContentType,
|
||||
formData: formData.isEmpty ? null : formData,
|
||||
// Wipe existing parameters and authentication to ensure clean state
|
||||
params: const [],
|
||||
isParamEnabledList: const [],
|
||||
authModel: null,
|
||||
);
|
||||
_appendSystem(
|
||||
'Applied cURL to the selected request.', ChatMessageType.importCurl);
|
||||
|
||||
Reference in New Issue
Block a user