I’m working on a website where the frontend is done in React and the backend in Python with FastAPI. I made a form which takes a some data and sends it to the backend with axios. It looks like this
{
name='Jonathan',
aliases=["Johnny"],
birthdate='2-15-1980',
gender='male',
height=178
weight=90
nationalities=["American", "French"],
occupations=["Programmer", "Comedian"],
status='single',
images=[
{'attachment': FileList,
'location': 'Berlin',
'date': '10-14-2019'
}
]
}
However, when I submit it. FastApi seems to remove the images from the form.
name='Jonathan',
aliases=["Johnny"],
birthdate='2-15-1980',
gender='male',
height=178
weight=90
nationalities=["American", "French"],
occupations=["Programmer", "Comedian"],
status='single',
images=[
{'attachment': {'0': {}}, 'location': 'Berlin', 'date': '10-14-2019'}
]
This is what the route currently looks like
@router.post("/register/user")
def register_user(user_data: UserCreate):
print(user_data)
I’m not entirely sure what’s going on. I’m guessing it has something to do with how the data is send and its encryption. I’m at a dead end here. Thanks in advance