A developer is building a REST API in Amazon API Gateway. To allow the frontend development team to test their application before the backend microservices are fully implemented, the developer wants to configure an endpoint to return a mock response with a static JSON payload and an HTTP 200 status code. Which two actions must the developer take to configure this Mock integration in API Gateway? (Select TWO.)
- Configure the Method Response to include the HTTP 200 status code, and configure the Integration Response for the 200 status with an application/json body mapping template that outputs the static JSON payload.Cevap
- Set the method's integration type to MOCK, and define an Integration Request mapping template for the application/json content type that returns a JSON object containing a statusCode of 200.Cevap
- CConfigure a custom Lambda authorizer for the method that intercepts the incoming request and returns the static mock JSON payload in the authorizer context.
- DConfigure the method to use an HTTP integration with the endpoint URL pointing to http://localhost/mock, and use a VTL mapping template to define the static response.
- ESet the method's integration type to Lambda Proxy Integration with an empty function name, and define the mock JSON payload in the Method Request body mapping template.
Cevap
To configure a Mock integration in Amazon API Gateway to return a static JSON response, the developer must set the method's integration type to MOCK and configure the Integration Request with a mapping template returning a statusCode (such as 200). Additionally, the developer must define the HTTP 200 status code in the Method Response and configure the corresponding Integration Response with an application/json body mapping template that contains the static JSON payload.
The correct options explain the two halves of a Mock integration configuration: setting the integration type to MOCK with an Integration Request template that outputs a statusCode (e.g., 200), and configuring the Method Response (to define the 200 HTTP code) along with an Integration Response mapping template to return the static JSON payload.
Adım Adım Çözüm
Anahtar Kavram
Mock integrations in API Gateway bypass backend services and use mapping templates in both the Integration Request and Integration Response to construct static client responses.