Hey everyone!
I'm trying to flask create post request with body parameters, but I'm kinda stuck. I’ve got this basic route set up, but when I send data, it’s not showing up like I expected.
Here’s what I’ve got:
```python
@app.route('/submit', methods=['POST'])
def submit():
data = request.json
return data
```
But when I test it with Postman or curl, sometimes the body just comes back empty. Am I missing something obvious?
Also, should I be using `request.form` or `request.get_json()` instead? I’ve seen mixed examples online, and it’s low-key confusing.
Any tips or working examples would be a lifesaver! Thanks in advance.
(PS: Using Flask 2.0 if that matters.)
I'm trying to flask create post request with body parameters, but I'm kinda stuck. I’ve got this basic route set up, but when I send data, it’s not showing up like I expected.
Here’s what I’ve got:
```python
@app.route('/submit', methods=['POST'])
def submit():
data = request.json
return data
```
But when I test it with Postman or curl, sometimes the body just comes back empty. Am I missing something obvious?
Also, should I be using `request.form` or `request.get_json()` instead? I’ve seen mixed examples online, and it’s low-key confusing.
Any tips or working examples would be a lifesaver! Thanks in advance.
(PS: Using Flask 2.0 if that matters.)
