Here's a self-contained minimal, reproducible, example with my use case:
```Python
from fastapi import FastAPI
app = FastAPI()
class Sample(BaseModel):
countryId: int
@router.get("/foo/bar",
response_model=Sample)
def get_sample(sample: Sample):
return {"Hello": "World"}
/foo/bar.{"countryId": 1}.It doesn't throw the TypeError and allows GET calls to pass in JSON payloads
FastAPI Version [e.g. 0.3.0]: 0.60.1
Python version:
3.7.7

It's not something we'll be able to solve. We have already done everything that we could.
You can follow the discussions and solution already merged:
To summarize:

The HTTP GET method requests a representation of the specified resource. Requests using GET should only retrieve data.
| Request has body | NO |
| Successful response has body | YES |
The HTTP specification says in section 4.3
A message-body MUST NOT be included in a request if the specification of the request method (section 5.1.1) does not allow sending an entity-body in requests.
@ycd The HTTP specification your using is from 1991. The updated one is RFC 7231 where it is allowed to include a body.
A payload within a GET request message has no defined semantics;
sending a payload body on a GET request might cause some existing
implementations to reject the request.
So generally it is allowed but discouraged.
OpenAPI take on it: https://github.com/OAI/OpenAPI-Specification/pull/1937
@ArcLightSlavik thanks, just read that publication ,actually you were right, in practice it's fine but in theory it's not a good idea i think.. :face_with_head_bandage:
GET, DELETE and HEAD are no longer allowed to have request body because it does not have defined semantics as per RFC 7231.
That's true for OpenAPI 3.0, but seems to be changed in 3.1 as this PR suggests. The same change was removed from 3.0 only because it did't fit the semantics of a patch release
According to the PR, 3.1 will read as follows, which is in-line with RFC 7231.
In other cases where the HTTP spec is vague (such as GET, HEAD and DELETE),
requestBodyis permitted but does not have well-defined semantics and SHOULD be avoided if possible.
Most helpful comment
@ArcLightSlavik thanks, just read that publication ,actually you were right, in practice it's fine but in theory it's not a good idea i think.. :face_with_head_bandage: