`request.body()` not works
See original GitHub issueFirst Check
- I added a very descriptive title to this issue.
- I used the GitHub search to find a similar issue and didn’t find it.
- I searched the FastAPI documentation, with the integrated search.
- I already searched in Google “How to X in FastAPI” and didn’t find any information.
- I already read and followed all the tutorial in the docs and didn’t find an answer.
- I already checked if it is not related to FastAPI but to Pydantic.
- I already checked if it is not related to FastAPI but to Swagger UI.
- I already checked if it is not related to FastAPI but to ReDoc.
Commit to Help
- I commit to help with one of those options 👆
Example Code
from fastapi.exceptions import RequestValidationError
from fastapi.requests import Request
...
@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request: Request,
exc: RequestValidationError):
print(await request.body())
Description
I made POST /bla-bla-bla
with invalid data, when the error occurred I can’t see the body of the request, swagger endlessly loads something
Operating System
macOS
Operating System Details
MacOS 12.1 Monterey
FastAPI Version
0.70.1
Python Version
3.9.9
Additional Context
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
java - @RequestBody not working on Rest service
My problem is that I am going nuts because the annotation @requestBody appears to work wrong. This is my service: @ResponseBody @RequestMapping( ...
Read more >Add a Request Body to a POST Request | API Connector
If your POST request isn't working, a likely cause is a mismatched content type. Try adding in a content type into the header...
Read more >Request.body - Web APIs - MDN Web Docs
The read-only body property of the Request interface contains a ReadableStream with the body contents that have been added to the request.
Read more >Why my request.body is empty while request.params in not?
We can't see the request parameters on your Postman screenshots nor the logs in your code but the port you listen to with...
Read more >HTTP Request body not working - Activities - UiPath Forum
I am trying to use the HTTP request. Authentication is ok but I can't get the body correct. I found posts about using...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Refer to issue #394
in fastapi docs https://fastapi.tiangolo.com/advanced/custom-request-and-route/