You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’ve written a series of methods that basically wrap the fetch method from http to make calls to a specific REST API. They’ve all been working splendidly until I ran into something odd with one specific request:
It’s a GET request and produces a response containing a JSON object. When I consume the body of the response using the Response.text() method, all is well. When I do so using the Response.json() method (which was my original approach), a particular numeric value is slightly wrong. As in, the correct value is 190799521558733887 and json() gives me 190799521558733900. The rest of the output is correct, as are the results of all the other calls I’ve been making.
I’m afraid I don’t know enough about this domain to have much of a hunch where the problem is. I’m guessing we can rule out anything amiss on the server side, since json() and text() are both working with the same data, right? Could there be a problem somewhere in the fetch implementation of the http plug-in? Could the fault lie in my platform (which is Windows)? Of course, I’m completely open to the possibility of user error.
If this sounds like something that should be investigated, I’m happy to open an issue and follow any instructions that might help diagnose the problem. If this doesn’t sound interesting, I’m satisfied with my workaround.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I’ve written a series of methods that basically wrap the
fetch
method fromhttp
to make calls to a specific REST API. They’ve all been working splendidly until I ran into something odd with one specific request:It’s a GET request and produces a response containing a JSON object. When I consume the body of the response using the
Response.text()
method, all is well. When I do so using theResponse.json()
method (which was my original approach), a particular numeric value is slightly wrong. As in, the correct value is190799521558733887
andjson()
gives me190799521558733900
. The rest of the output is correct, as are the results of all the other calls I’ve been making.I’m afraid I don’t know enough about this domain to have much of a hunch where the problem is. I’m guessing we can rule out anything amiss on the server side, since
json()
andtext()
are both working with the same data, right? Could there be a problem somewhere in thefetch
implementation of thehttp
plug-in? Could the fault lie in my platform (which is Windows)? Of course, I’m completely open to the possibility of user error.If this sounds like something that should be investigated, I’m happy to open an issue and follow any instructions that might help diagnose the problem. If this doesn’t sound interesting, I’m satisfied with my workaround.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions