Fastapi: [BUG] bigint overflow

Created on 22 Apr 2020  ·  5Comments  ·  Source: tiangolo/fastapi

Describe the bug

Routing can not be return bigint value correctly

To Reproduce

  1. Create a file with:
from fastapi import FastAPI

app = FastAPI()


@app.get("/{test_id}")
def read_root(test_id: int):
    return test_id
  1. Open the browser and call the endpoint /1249958025205260288.
  2. It returns 1249958025205260300.
  3. But I expected it to return 1249958025205260288.

Environment

  • OS: macOS & Linux
  • FastAPI Version : 0.52.0
  • Python Version: 3.7.2 & 3.7.4
bug

Most helpful comment

I think this problem caused by js, not python,even fasapi.
In js:
You console.log(1249958025205260288), you can see it consoled :

1249958025205260300

Not 1249958025205260288.

All 5 comments

I think this problem caused by js, not python,even fasapi.
In js:
You console.log(1249958025205260288), you can see it consoled :

1249958025205260300

Not 1249958025205260288.

yes, this problem caused by js

You can close the issue since it's really not a fastapi issue.

sure, have a nice day

在 2020年4月22日,13:46,Henry Pan notifications@github.com 写道:



You can close the issue since it's really not a fastapi issue.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/tiangolo/fastapi/issues/1302#issuecomment-617564220, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALB2EGRIWSYUZXBYQUBFFNTRN2ADHANCNFSM4MNYZOOQ.

Thanks for the help here everyone! :clap: :bow:

Thanks for reporting back and closing the issue @tanyaofei :+1:

Was this page helpful?
0 / 5 - 0 ratings