darrenburns / posting

The modern API client that lives in your terminal.
Apache License 2.0
4.48k stars 64 forks source link

Request body is saved in a non human-readable format when it contains special characters #48

Closed MilanVasko closed 1 month ago

MilanVasko commented 1 month ago

Hello and thank you for creating this tool, it looks very promising! The overall experience has been good so far, but I did notice an issue that's a bit inconvenient.

I've created a POST request which contains letters with diacritics in the body, such as this one:

{
  "Hello": "There",
  "Hi": "Čau"
}

If I save the request into a yaml file, the body will be saved in a hard to read format:

name: Test
method: POST
url: https://example.org/test
body:
  content: "{\n  \"Hello\": \"There\",\n  \"Hi\": \"\u010Cau\"\n}"

If I replace the Č with a regular C, the resulting yaml file will have the format that I expect:

name: Test
method: POST
url: https://example.org/test
body:
  content: |-
    {
      "Hello": "There",
      "Hi": "Cau"
    }

Is it possible to fix this? The current behavior complicates manual editing and version control diffs, so I think it might be worth looking into.

I'm using posting 1.7.0

Thanks!