Skip to content
CodeKruPro

400, 415 or 422 for a bad request body?

QuizMediumAsked in: Accenture, Capgemini, Infosys, TCS, Wipro

Three requests to POST /users:

  1. The body is JSON but the header says Content-Type: text/plain, a format the API does not accept.
  2. The body is {"email": "a@x.com", (cut off).
  3. The body is correct JSON (the syntax is right), but the email is "not-an-email".

Which mapping follows RFC 9110 most closely?

  • 1: 415, 2: 400, 3: 422
  • 1: 400, 2: 422, 3: 415
  • 1: 422, 2: 415, 3: 400
  • All three must be 500

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in