- Newest
- Most votes
- Most comments
API Gateway does indeed modify certain headers when processing requests, which explains the behavior you're observing.
When API Gateway handles requests, it processes header names and query parameters in a case-sensitive way. More importantly, API Gateway may drop, remap, or otherwise modify certain headers when sending them to your integration endpoint.
In your specific case, what's happening is that API Gateway is honoring only the first Accept media type when a request contains multiple media types in its Accept header. Additionally, when you're using a Content-Type of application/x-www-form-urlencoded, API Gateway may be applying a default transformation behavior.
The difference you're seeing between the integrated test tool and actual API execution is because the test invocation of a method uses the default content type of application/json and may ignore specifications of other content types.
To control this behavior, you can:
- Define mapping templates for specific Content-Types to control how the request is transformed
- Configure the integration passthrough behavior to determine how requests without matching templates are handled
There are three options for passthrough behavior:
- When no template matches the request Content-Type header
- When there are no templates defined
- Never
By setting the appropriate passthrough behavior, you can control whether the method request body passes through to the integration request without transformation.
Sources
Amazon API Gateway important notes - Amazon API Gateway
Mapping template transformations for REST APIs in API Gateway - Amazon API Gateway
Method request behavior for payloads without mapping templates for REST APIs in API Gateway - Amazon API Gateway
answered a year ago
Relevant content
asked 3 years ago
- AWS OFFICIALUpdated a year ago
