Skip to content

Commit

Permalink
reproduce and fix status code issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bentsku committed Jan 14, 2025
1 parent 776aa06 commit ec9d3b4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion localstack-core/localstack/services/apigateway/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,7 @@ def add_path_methods(rel_path: str, parts: List[str], parent_id=""):
# Create the `MethodResponse` for the previously created `Method`
method_responses = field_schema.get("responses", {})
for method_status_code, method_response in method_responses.items():
method_status_code = str(method_status_code)
method_response_model = None
model_ref = None
# separating the two different versions, Swagger (2.0) and OpenAPI 3.0
Expand Down Expand Up @@ -822,7 +823,7 @@ def add_path_methods(rel_path: str, parts: List[str], parent_id=""):
)

integration_response = integration.create_integration_response(
status_code=integration_responses.get("statusCode", 200),
status_code=str(integration_responses.get("statusCode", 200)),
selection_pattern=pattern if pattern != "default" else None,
response_templates=integration_response_templates,
response_parameters=integration_response_parameters,
Expand Down
2 changes: 1 addition & 1 deletion tests/aws/files/openapi-method-int.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ paths:
x-amazon-apigateway-integration:
responses:
default:
statusCode: '200'
statusCode: 200
responseParameters:
method.response.header.Access-Control-Allow-Origin: "'*'"
requestParameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5192,7 +5192,7 @@
}
},
"tests/aws/services/apigateway/test_apigateway_import.py::TestApiGatewayImportRestApi::test_import_with_integer_http_status_code": {
"recorded-date": "14-01-2025, 14:03:07",
"recorded-date": "14-01-2025, 14:09:57",
"recorded-content": {
"resources": {
"items": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"last_validated_date": "2024-04-15T21:38:57+00:00"
},
"tests/aws/services/apigateway/test_apigateway_import.py::TestApiGatewayImportRestApi::test_import_with_integer_http_status_code": {
"last_validated_date": "2025-01-14T14:03:07+00:00"
"last_validated_date": "2025-01-14T14:09:57+00:00"
},
"tests/aws/services/apigateway/test_apigateway_import.py::TestApiGatewayImportRestApi::test_import_with_stage_variables": {
"last_validated_date": "2024-08-12T13:42:13+00:00"
Expand Down

0 comments on commit ec9d3b4

Please sign in to comment.