x-yc-apigateway-integration:dummy extension
Written by
Updated at August 29, 2024
The x-yc-apigateway-integration:dummy
extension returns fixed content with the specified response code and required headers without any third-party service involved.
You can add an extension to a specification using the specification constructor.
Supported parameters
The table below lists the parameters specific to API Gateway API gateways. You can find the description of other parameters in the OpenAPI 3.0 specification
Parameter | Type | Description |
---|---|---|
http_code |
int |
HTTP response code. |
http_headers |
map[string](string|[]string) |
It shows the list of headers to send in the response. http_headers is used for parameter substitution. |
content |
map[string]string |
Data to send in response. It can be either actual content or the result of mapping the requested Content-Type into data. This allows you to send errors in the requested format: JSON or XML. The * key is used for the default value. content is used for parameter substitution. |
Extension specification
Specification example:
x-yc-apigateway-integration:
type: dummy
http_code: 302
http_headers:
Location: "/some/location"
Set-Cookie: ["a={number}", "b=2"]
content:
"application/json": "{ \"message\": \"You've been redirected.\" }"
Extension specifics:
- If the request has the
Accept
header:- The best match is selected first.
- If there is no match, the
*
key is selected. - If there is no key, the
415 Media not supported
response is returned.
- If the
Accept
header is missing, any response may be selected. - If the content option is selected by the
*
key, the response'sContent-Type
is picked fromhttp_headers
. If it is not specified there, the actualContent-Type
is returned.