GET->POST cleanup for #178

This commit is contained in:
Ashita Prasad
2025-03-02 06:03:21 +05:30
parent 00dc5a0e0e
commit 634ffca2d3

View File

@@ -21,21 +21,6 @@ class EditRequestBody extends ConsumerWidget {
final apiType = ref final apiType = ref
.watch(selectedRequestModelProvider.select((value) => value?.apiType)); .watch(selectedRequestModelProvider.select((value) => value?.apiType));
// TODO: #178 GET->POST Currently switches to POST everytime user edits body even if the user intentionally chooses GET
// final sm = ScaffoldMessenger.of(context);
// void changeToPostMethod() {
// if (requestModel?.httpRequestModel!.method == HTTPVerb.get) {
// ref
// .read(collectionStateNotifierProvider.notifier)
// .update(selectedId, method: HTTPVerb.post);
// sm.hideCurrentSnackBar();
// sm.showSnackBar(getSnackBar(
// "Switched to POST method",
// small: false,
// ));
// }
// }
return Column( return Column(
children: [ children: [
(apiType == APIType.rest) (apiType == APIType.rest)
@@ -55,12 +40,8 @@ class EditRequestBody extends ConsumerWidget {
switch (apiType) { switch (apiType) {
APIType.rest => Expanded( APIType.rest => Expanded(
child: switch (contentType) { child: switch (contentType) {
ContentType.formdata => const Padding( ContentType.formdata =>
padding: kPh4, const Padding(padding: kPh4, child: FormDataWidget()),
child: FormDataWidget(
// TODO: See changeToPostMethod above
// changeMethodToPost: changeToPostMethod,
)),
// TODO: Fix JsonTextFieldEditor & plug it here // TODO: Fix JsonTextFieldEditor & plug it here
ContentType.json => Padding( ContentType.json => Padding(
padding: kPt5o10, padding: kPt5o10,
@@ -69,7 +50,6 @@ class EditRequestBody extends ConsumerWidget {
fieldKey: "$selectedId-json-body-editor", fieldKey: "$selectedId-json-body-editor",
initialValue: requestModel?.httpRequestModel?.body, initialValue: requestModel?.httpRequestModel?.body,
onChanged: (String value) { onChanged: (String value) {
// changeToPostMethod();
ref ref
.read(collectionStateNotifierProvider.notifier) .read(collectionStateNotifierProvider.notifier)
.update(body: value); .update(body: value);
@@ -84,7 +64,6 @@ class EditRequestBody extends ConsumerWidget {
fieldKey: "$selectedId-body-editor", fieldKey: "$selectedId-body-editor",
initialValue: requestModel?.httpRequestModel?.body, initialValue: requestModel?.httpRequestModel?.body,
onChanged: (String value) { onChanged: (String value) {
// changeToPostMethod();
ref ref
.read(collectionStateNotifierProvider.notifier) .read(collectionStateNotifierProvider.notifier)
.update(body: value); .update(body: value);