go-ftw icon indicating copy to clipboard operation
go-ftw copied to clipboard

httpbin does not reflect requests perfectly

Open theseion opened this issue 8 months ago • 3 comments

httpbin usually returns the request data in the response exactly as sent. At least in case of Unicode that is not true, unfortunately. Example:

curl -X POST "https://httpbin.org/anything" --json '{"über": "bort"}'
{
  "args": {},
  "data": "{\"\u00fcber\": \"bort\"}",
  "files": {},
  "form": {},
  "headers": {
    "Accept": "application/json",
    "Content-Length": "17",
    "Content-Type": "application/json",
    "Host": "httpbin.org",
    "User-Agent": "curl/8.1.2",
    "X-Amzn-Trace-Id": "Root=1-6548859d-09da901d70e79647362f7b83"
  },
  "json": {
    "\u00fcber": "bort"
  },
  "method": "POST",
  "origin": "89.133.9.17",
  "url": "https://httpbin.org/anything"
}

The Unicode sequence is returned as a backslash escape sequence instead. That is semantically correct but bad for testing. We need to find a way around this.

theseion avatar Nov 06 '23 06:11 theseion