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