Skip to main content

AWS DVA-C02 Drill: API Gateway Mock Integration - Correct Content-Type Mapping

Jeff Taakey
Author
Jeff Taakey
21+ Year Enterprise Architect | AWS SAA/SAP & Multi-Cloud Expert.

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/html and statusCode of 200. Configure the integration response mapping template with Content-Type of application/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 of text/html and statusCode of 200.
  • C) Configure the integration request mapping template with Content-Type of application/json and statusCode of 200. Configure the integration response mapping template with Content-Type of text/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 of application/json and 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/json because mock integration expects a valid JSON payload. This payload can specify the HTTP status code in a statusCode property (e.g., 200).
  • Integration Response Mapping Template: Specifies the outgoing HTTP headers and body. Setting the Content-Type header to text/html and 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 be application/json for mock integrations; using text/html here conflicts with the expected payload format. Also, response mapping template Content-Type application/json means clients receive JSON, not HTML.

  • Why not B?
    This is close, but it misses setting the statusCode in 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 to text/html is incorrect. Also inverts response Content-Type to application/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.

The DevPro Network: Mission and Founder

A 21-Year Tech Leadership Journey

Jeff Taakey has driven complex systems for over two decades, serving in pivotal roles as an Architect, Technical Director, and startup Co-founder/CTO.

He holds both an MBA degree and a Computer Science Master's degree from an English-speaking university in Hong Kong. His expertise is further backed by multiple international certifications including TOGAF, PMP, ITIL, and AWS SAA.

His experience spans diverse sectors and includes leading large, multidisciplinary teams (up to 86 people). He has also served as a Development Team Lead while cooperating with global teams spanning North America, Europe, and Asia-Pacific. He has spearheaded the design of an industry cloud platform. This work was often conducted within global Fortune 500 environments like IBM, Citi and Panasonic.

Following a recent Master’s degree from an English-speaking university in Hong Kong, he launched this platform to share advanced, practical technical knowledge with the global developer community.


About This Site: AWS.CertDevPro.com


AWS.CertDevPro.com focuses exclusively on mastering the Amazon Web Services ecosystem. We transform raw practice questions into strategic Decision Matrices. Led by Jeff Taakey (MBA & 21-year veteran of IBM/Citi), we provide the exclusive SAA and SAP Master Packs designed to move your cloud expertise from certification-ready to project-ready.