A developer is implementing a new backend service using an Amazon API Gateway REST API with a Lambda proxy integration. To ensure that API Gateway can successfully process the response and forward it to the client, the Lambda function must return a JSON payload with a specific structure. Which JSON payload structure must the Lambda function return to represent a successful HTTP response?
{
"isBase64Encoded": false,
"statusCode": 200,
"headers": {
"Content-Type": "application/json"
},
"body": "{\"message\": \"Success\"}"
}
Cevap- B
{
"statusCode": 200,
"body": {
"message": "Success"
}
} - C
{
"httpStatus": 200,
"message": "Success"
} - D
{
"headers": {
"Content-Type": "application/json"
},
"body": "{\"message\": \"Success\"}"
}
Cevap
The correct JSON structure contains `isBase64Encoded`, `statusCode`, `headers`, and a stringified `body` field.
The correct payload contains a status code of , headers, and a stringified JSON body. For Lambda proxy integrations, API Gateway expects a response with a numeric `statusCode`, key-value `headers` map, and a string-formatted `body` property.
Adım Adım Çözüm
Anahtar Kavram
Lambda Proxy Integration Response Format
Tahmini Süre:45s