Code Room
Code reviewHard
Question
Review this Python form-submission endpoint's validation.
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.
Learn the concepts
@app.route('/api/applications', methods=['POST'])def create_application(): data = request.get_json() if not data.get('email'): abort(400, 'email is required') if '@' not in data['email']: abort(400, 'email is invalid') if not data.get('name'): abort(400, 'name is required') if len(data.get('resume', '')) > 100000: abort(400, 'resume too long') app_id = save_application(data) return jsonify({'id': app_id}), 201Run or narrate your approach, then ask the coach.