Bird
0
0

What HTTP status code will be returned by this APIView method?

medium📝 component behavior Q5 of 15
Django - REST Framework Basics
What HTTP status code will be returned by this APIView method?
def post(self, request):
    return Response({"success": True}, status=201)
A201 Created
B200 OK
C400 Bad Request
D500 Internal Server Error
Step-by-Step Solution
Solution:
  1. Step 1: Check the status argument in Response

    The Response explicitly sets status=201, which means Created.
  2. Step 2: Match status code to meaning

    201 indicates successful creation of a resource, which fits the context.
  3. Final Answer:

    201 Created -> Option A
  4. Quick Check:

    Status code 201 = Created [OK]
Quick Trick: Use status=201 for resource creation responses [OK]
Common Mistakes:
MISTAKES
  • Assuming default 200 status
  • Confusing 201 with 400 or 500
  • Omitting status code meaning

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes