Jeff’s Note #
Unlike generic exam dumps, ADH analyzes this scenario through the lens of a Real-World Lead Developer.
For DVA-C02 candidates, the confusion often lies in correctly configuring API Gateway mock integration with the right Content-Type headers and response mapping templates. In production, this is about knowing exactly which mapping templates control the HTTP status codes and content types sent to the client, especially when serving static HTML via API Gateway mock integration. Let’s drill down.
The Certification Drill (Simulated Question) #
Scenario #
TechNova Solutions is building a serverless backend using Amazon API Gateway and AWS Lambda proxy integration. To improve developer experience, the engineering team wants a landing page at /home that provides navigation links to their backend APIs.
A developer creates a new /home resource with a GET method configured for mock integration to serve the landing page content.
The Requirement: #
Enable the API Gateway mock integration to return an HTML landing page with HTTP status code 200 and the Content-Type header set to text/html.
The Options #
- A) Configure the integration request mapping template with Content-Type of
text/htmland statusCode of 200. Configure the integration response mapping template with Content-Type ofapplication/json. In the integration response mapping template, include the landing page HTML code that references the APIs. - B) Configure the integration request mapping template with Content-Type of
application/json. In the integration request mapping template, include the landing page HTML code that references the APIs. Configure the integration response mapping template with Content-Type oftext/htmland statusCode of 200. - C) Configure the integration request mapping template with Content-Type of
application/jsonand statusCode of 200. Configure the integration response mapping template with Content-Type oftext/html. In the integration response mapping template, include the landing page HTML code that references the APIs. - D) Configure the integration request mapping template with Content-Type of
text/html. In the integration request mapping template, include the landing page HTML code that references the APIs. Configure the integration response mapping template with Content-Type ofapplication/jsonand statusCode of 200.
Google adsense #
leave a comment:
Correct Answer #
C
Quick Insight: The Developer Imperative #
API Gateway mock integrations require the integration request mapping template to send the desired data downstream (or in this case, mock data structures) as JSON with status codes, while the integration response mapping template controls how API Gateway formats the outgoing HTTP response to the client, including headers and body content such as HTML. The request template is typically JSON-shaped even for mock integration; the response mapping template defines content-type headers and inlines the actual HTML payload.
Content Locked: The Expert Analysis #
You’ve identified the answer. But do you know the implementation details that separate a Junior from a Senior?
The Expert’s Analysis #
Correct Answer #
Option C
The Winning Logic #
Option C correctly configures the API Gateway mock integration as follows:
- Integration Request Mapping Template: Must be of Content-Type
application/jsonbecause mock integration expects a valid JSON payload. This payload can specify the HTTP status code in astatusCodeproperty (e.g., 200). - Integration Response Mapping Template: Specifies the outgoing HTTP headers and body. Setting the Content-Type header to
text/htmland returning the full HTML landing page markup here enables the API Gateway to serve a proper HTML response.
The landing page HTML included in the integration response mapping template gets injected into the body while the client receives a status code 200 and the proper content-type header.
The Trap (Distractor Analysis) #
-
Why not A?
The request template Content-Type should beapplication/jsonfor mock integrations; usingtext/htmlhere conflicts with the expected payload format. Also, response mapping template Content-Typeapplication/jsonmeans clients receive JSON, not HTML. -
Why not B?
This is close, but it misses setting thestatusCodein the integration request mapping template. Without that, the HTTP status could default undesirably. -
Why not D?
Similar to A, setting the integration request mapping template Content-Type totext/htmlis incorrect. Also inverts response Content-Type toapplication/json, which doesn’t serve HTML.
The Technical Blueprint #
Code Snippet: Integration Response Template Example #
#set($inputRoot = $input.path('$'))
<html>
<head><title>Landing Page</title></head>
<body>
<h1>Welcome to TechNova APIs</h1>
<p>Navigate to:</p>
<ul>
<li><a href="/v1/users">Users API</a></li>
<li><a href="/v1/orders">Orders API</a></li>
</ul>
</body>
</html>
Integration Response Mapping Template (application/json → text/html):
#set($context.responseOverride.header.Content-Type = "text/html")
$input.path('$')
<html>
...
</html>
Integration Request Mapping Template (application/json):
{
"statusCode": 200
}
The Comparative Analysis #
| Option | API Request Template Content-Type | Response Template Content-Type | Status Code | HTML Included in | Correct Outcome? |
|---|---|---|---|---|---|
| A | text/html | application/json | 200 | Response | No, wrong content-type headers sent |
| B | application/json | text/html | none/suspect | Request | No, missing statusCode in request |
| C | application/json | text/html | 200 | Response | Yes, correct headers and HTML served |
| D | text/html | application/json | 200 | Request | No, reverse content-type mismatch |
Real-World Application (Practitioner Insight) #
Exam Rule #
For the exam, always pick application/json as the integration request Content-Type when working with API Gateway mock integration, and configure the integration response mapping template with the desired Content-Type header according to the content served.
Real World #
In production, rather than using mock integration for HTML, many teams front static content with S3 + CloudFront or Lambda@Edge for performance and caching benefits. But mock integration is an efficient exam scenario for validating mapping template mastery.
(CTA) Stop Guessing, Start Mastering #
Disclaimer
This is a study note based on simulated scenarios for the AWS DVA-C02 exam.