AttributeError: 'Request' object has no attribute '_body'
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 import FastAPI
import uvicorn
app = FastAPI()
@app.get('/chain_detail/')
def read_chain_detail():
return 'hello world'
if __name__ == '__main__':
uvicorn.run(app=app, host="127.0.0.1", port=8000)
Description
I got “AttributeError ‘Request’ object has not attribute ‘_body’” error. As GET request doesn’t have body, I have no idea how can I fix it.
Operating System
Windows
Operating System Details
Windows 10 Version No. 1809
FastAPI Version
0.73.0
Python Version
3.8.8
Additional Context
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:7
Top Results From Across the Web
Python requests, no attribute 'body' - Stack Overflow
Python requests, no attribute 'body' · Try: request.content · I get a similar error: 'Request' object has no attribute 'content'. – Mustard Tiger....
Read more >'WSGIRequest' object has no attribute 'body' ???
if not request.body: AttributeError: 'WSGIRequest' object has no attribute 'body'. I can reproduce this with a a minimal resource:.
Read more >Flask Attributeerror Request Object Has No Attribute
Requestisjson returns True if certain request body contains JSON data. Attract and maybe should be used at one byte for business agility, and...
Read more >flask.Request — Flask API - GitHub Pages
If you want to replace the request object used you can subclass this and set ... this attribute contains the username the user...
Read more >Request and response objects — Django 4.1.4 documentation
Accessing the body attribute after reading the request with either of these ... attribute always contains the path info portion of the path,...
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
In my case there’s no problem like you. Just try to install fastAPI by use
pip install "fastapi[all]
Oh, I got it, and modified it. Thanks for that. But it is not the point which caused the error. I just used chrome to visit http://127.0.0.1:8000/chain_detail/ . One more thing, I can see the correct response in chrome. But at the same time, I can see the error in console.