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

[Bug]: wrong response (json int64) #163

Open
1 task done
gniqizeuy opened this issue Apr 16, 2024 · 1 comment
Open
1 task done

[Bug]: wrong response (json int64) #163

gniqizeuy opened this issue Apr 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@gniqizeuy
Copy link

What happened?

diff response about json int64 field

request
image
response
image

in chrome
image

diff id in list filed

id in db is same as response frome chrome not the httpie response

Steps to reproduce?

just send the GET http request

What did you expect to happen?

show correct int64 value

Platform

macOS

HTTPie Desktop version

2024.1.2

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@gniqizeuy gniqizeuy added the bug Something isn't working label Apr 16, 2024
@jkbrzt
Copy link
Member

jkbrzt commented Apr 16, 2024

Hi @gniqizeuy, thanks for the report. This is indeed a bug. We shouldn’t alter the displayed data. For what it’s worth, you can always use the “Raw” body view mode to see the response body as provided by the server:

image

Background: JSON doesn’t really support int64. We currently use JSON.stringify() under the hood to prettify the body, which means we parse the data, and JS alters the unsafe integer value.

Number.isSafeInteger(68164106661659011)  // → false

A simple test: add the following to the request body JSON editor and invoke “Prettify”:

{
  "foo": 68164106661659011
}

We need to prevent this alteration. Ideally, we’d also warn the user when unsafe integers appear in the request/response JSON.

@jkbrzt jkbrzt changed the title [Bug]: wrong response [Bug]: wrong response (json int64) Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants