- 最新
- 最多得票
- 最多評論
The behavior you are describing, where the HTTP integration in an HTTP API Gateway sets a default Content-Type header when it is missing, is expected behavior. According to the AWS documentation, when a client sends an HTTP request to an HTTP API endpoint, API Gateway passes on the request to the integration target as-is, including the request headers.
However, when API Gateway sends the request to the integration target, it adds some headers to the request, including a Content-Type header if it is missing. By default, the Content-Type header is set to "application/json", but you can change this by specifying a custom Content-Type header in the integration settings.
This behavior is documented in the API Gateway Developer Guide, under the section "Default Content-Type header for HTTP integrations" (https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-http.html#http-api-develop-integrations-http-default-content-type).
As for other undocumented features or issues related to HTTP integrations in API Gateway, it's always a good idea to thoroughly test your API and integration workflows and to read the documentation carefully to ensure that you are using the service correctly.
相關內容
- AWS 官方已更新 2 年前
- AWS 官方已更新 2 年前
- AWS 官方已更新 1 年前
as of 2023-06-15, there is no "Default Content-Type header for HTTP integrations" section in the linked documentation. I cannot find any setting that can change this default, either. Also, as per Petter's description, the default Content-Type headers should be "application/x-www-form-urlencoded". considering the importance of this header, AWS apparently made a reckless decision without considering the impact of this action
I can confirm that the issue described still exists and AWS's response is of no value at all.