A frontend developer needs to write integration tests that exercise both success and error HTTP responses from an API Gateway-backed serverless backend. The tests should cover positive and negative cases with minimal setup effort while the logic tier is still under development. Which approach requires the least development effort?
Choose an answer
Tap an option to check your answer.
Correct answer: Configure API Gateway mock integration for the methods. Add simple logic in the integration request to return success or error based on the desired HTTP status, and map messages in the integration response for each status..
Why this is the answer
The correct option leverages API Gateway's built-in mock integration feature. This allows developers to define static responses directly within API Gateway, including different HTTP status codes and body content, without needing any backend compute. By using a simple integration request mapping, the developer can dynamically switch between success and error responses based on a query parameter or header, minimizing setup effort and providing immediate feedback for frontend integration tests. The other options are less efficient: Creating two separate mock integration resources doubles the configuration effort. Creating Lambda functions introduces unnecessary compute and deployment overhead for simple mock responses. Referencing a Lambda from a mock integration is not a standard or efficient pattern; mock integrations are designed to return static responses directly.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed