Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support comments in JSON request body #599 #623

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

FreeBono
Copy link
Contributor

PR Description

When a body in JSON format is provided, the function checks whether the body is in JSON format. If it is, the function returns the JSON string with comments removed. If not, it returns the input string as it is.

I have written test cases for removing single-line comments, multi-line comments, and other scenarios.

Related Issues

Checklist

  • I have gone through the contributing guide
  • I have updated my branch and synced it with project main branch before making this PR
  • I am using the latest Flutter stable branch (run flutter upgrade and verify)
  • I have run the tests (flutter test) and all tests are passing

Added/updated tests?

We encourage you to add relevant test cases.

  • Yes
  • No, and this is why: please replace this line with details on why tests have not been included

OS on which you have developed and tested the feature?

  • Windows
  • macOS
  • Linux

ref
.read(collectionStateNotifierProvider.notifier)
.update(body: value);
.update(body: removeJsonComments(value));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to preserve the comments added by the user. Currently, it removes all comments and saves it. When the user comes back to the request, the body is modified.
Comments are cleaned up only when the request is sent.

@FreeBono
Copy link
Contributor Author

Thank you for the great feedback. I’ve modified the code in the core package to only remove comments when the data is in JSON format, ensuring that the existing data in the editor remains unchanged and comments are removed only during the send request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support comments in JSON request body
2 participants