Skip to content

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

@synapsecode

Description

@synapsecode

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": "johndoe@example.com",
        "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": "johndoe@example.com",
    "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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions