Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,10 @@ def experience():
return jsonify([exp.__dict__ for exp in data["experience"]]), 200

if request.method == "POST":
request_body = (
request.form
if request.content_type == "multipart/form-data"
else request.get_json()
)
request_body = request.form

if not request_body:
return jsonify({"error": "Request must be JSON or include form data"}), 400
return jsonify({"error": "Request must include form data"}), 400

required_fields = {
"title": str,
Expand Down
2 changes: 1 addition & 1 deletion test_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_experience(client):
"description": "Writing JavaScript Code",
"logo": "default.jpg",
}
item_id = client.post("/resume/experience", json=example_experience).json["id"]
item_id = client.post("/resume/experience", data=example_experience).json["id"]
response = client.get("/resume/experience")
assert any(exp["id"] == item_id for exp in response.json)

Expand Down
Loading