-
Security
Validate Content-Type on my API endpoints
Rejects requests with unexpected content types so parsers and handlers only process what they were built for.
Free Prompt
What This Does / How This Helps
Makes each endpoint strict about what content types it accepts, and turns malformed bodies into clean 400s instead of server errors. Loose parsing creates weird attack surface. An endpoint built for JSON that also accepts form-encoded or multipart data can be fed types the handler never expected, which is how type-confusion bugs and some injection paths open up. It also turns garbage input into 500s that clutter your logs and leak internals. The verification trio (right type passes, wrong type gets a 415, malformed body gets a 400) proves the boundary is doing its job.
Want to skip doing this by hand?
Fortivibe audits your app for all of the areas these prompts cover (and more).