Webhook creation returns wrong status
Review this Python Flask resource-creation endpoint.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.
0:00 of about 22 min
Mark a line and say what kind of problem it is.0 findings
1@app.route('/api/webhooks', methods=['POST'])
2def create_webhook():
3 data = request.get_json()
4 existing = Webhook.query.filter_by(url=data['url']).first()
5 if existing:
6 return jsonify(existing.to_dict()), 200
7 hook = Webhook(url=data['url'], secret=gen_secret())
8 db.session.add(hook)
9 db.session.commit()
10 return jsonify(hook.to_dict()), 200
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.