promptdojo_

This handler indexes request["amount"] with no validation, so an empty request crashes with a KeyError (a 500 in production). Add a guard so a missing field returns a structured error instead. Fix the body so the empty request returns the error dict.

Expected output:

{'error': 'missing amount'}
The break is on line 3 — but read the whole snippet first.

full-screen editor opens — close anytime to keep reading.