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

Rare '<optimized out>' Exception after changing Body Content-Type back to json #782

Closed
synapsecode opened this issue Apr 6, 2025 · 1 comment · Fixed by #780
Closed

Comments

@synapsecode
Copy link
Contributor

synapsecode commented Apr 6, 2025

Describe the bug/problem

While using the application I came across an issue that is a fairly common user-flow. This does not happen for all types of JSON but it has happened to me a couple of times. At the end of this, I will be adding examples of JSON that cause this error

Steps to Reproduce the bug/problem

  • Copy the specific JSON examples given below (many more may potentially exist)
  • Go to the Body Section when defining a request and add JSON content to the Textbox (in json content type)
  • change content type to text and change it back to json
  • We get an error exception mentioning

Video Demonstration

EXCEPTION_VIDEO.mov

Expected behavior

Expected behaviour is that it must work as usual and switch between JSON and TEXT without any error.

Some Examples of JSON that trigger this issue

{
  "user": {
        "id": 12345,
        "name": "John Doe",
        "email": "[email protected]",
        "roles": ["admin", "editor"],
        "preferences": {
            "language": "en",
            "timezone": "UTC"
        }
    },
    "action": "create",
    "metadata": {
        "device": "iPhone",
        "app_version": "1.2.3"
    }
}
{ "name"   : "Alice Brown",
  "sku"    : "54321",
  "price"  : 199.95,
  "shipTo" : { "name" : "Bob Brown",
               "address" : "456 Oak Lane",
               "city" : "Pretendville",
               "state" : "HI",
               "zip"   : "98999" },
  "billTo" : { "name" : "Alice Brown",
               "address" : "456 Oak Lane",
               "city" : "Pretendville",
               "state" : "HI",
               "zip"   : "98999" }
}
{
    "name": "John Doe",
    "email": "[email protected]",
    "message": "This is a test message."
}

This occurs only to a subset of JSON bodies that are syntactically correct but may have some formatting problem.
I think it might have something to do with the formatting because when i paste these examples in jsonbeautifier and paste them back into apidash, things work normally.

Device Info (The device where you encountered this issue)

  • OS: MacOS
  • Version: Sonoma (M3 Chip)

Flutter Doctor

Please run the flutter doctor -v command and provide the details below:

[✓] Flutter (Channel stable, 3.29.0, on macOS 14.2 23C64 darwin-arm64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[✓] IntelliJ IDEA Community Edition (version 2024.1.1)
[✓] VS Code (version 1.98.2)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!
@animator
Copy link
Member

animator commented Apr 6, 2025

@synapsecode Wonderful catch!

@ashitaprasad ashitaprasad removed the bug Something isn't working label Apr 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants