Bird
0
0

What will be the HTTP status code returned by this Lambda function integrated with API Gateway?

medium📝 Predict Output Q5 of 15
AWS - API Gateway
What will be the HTTP status code returned by this Lambda function integrated with API Gateway?
exports.handler = async () => { return { statusCode: 404, body: 'Not Found' }; };
A404
B302
C500
D200
Step-by-Step Solution
Solution:
  1. Step 1: Check returned statusCode

    Function returns statusCode 404 explicitly.
  2. Step 2: API Gateway uses this status code

    API Gateway passes Lambda's statusCode as HTTP response code.
  3. Final Answer:

    404 -> Option A
  4. Quick Check:

    Lambda statusCode = HTTP status code [OK]
Quick Trick: Lambda's statusCode sets HTTP response code [OK]
Common Mistakes:
MISTAKES
  • Assuming default 200 status
  • Confusing body content with status code

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes