Skip to content

Commit 61416ea

Browse files
committed
improve naming
1 parent 47cdfc7 commit 61416ea

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

localstack-core/localstack/aws/protocol/service_router.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def _matches_protocol(request: Request, protocol: ProtocolName) -> bool:
120120
return False
121121

122122

123-
def get_protocol_from_request(
123+
def match_available_protocols(
124124
request: Request, available_protocols: list[ProtocolName]
125125
) -> ProtocolName | None:
126126
"""
@@ -318,7 +318,7 @@ def resolve_conflicts(
318318
# The `application/x-amz-json-1.0` header is mandatory for requests targeting SQS with the `json` protocol. We
319319
# can safely route them to the `sqs` JSON parser/serializer. If not present, route the request to the
320320
# sqs-query protocol.
321-
protocol = get_protocol_from_request(request, available_protocols=["json", "query"])
321+
protocol = match_available_protocols(request, available_protocols=["json", "query"])
322322
return (
323323
ServiceModelIdentifier("sqs")
324324
if protocol == "json"
@@ -347,7 +347,7 @@ def determine_aws_protocol(request: Request, service_model: ServiceModel) -> Pro
347347
if len(protocols) == 1:
348348
return protocols[0]
349349

350-
if protocol := get_protocol_from_request(request, available_protocols=protocols):
350+
if protocol := match_available_protocols(request, available_protocols=protocols):
351351
return protocol
352352

353353
raise ProtocolError(

tests/unit/aws/test_service_router.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
ProtocolError,
1313
determine_aws_protocol,
1414
determine_aws_service_model,
15-
get_protocol_from_request,
15+
match_available_protocols,
1616
)
1717
from localstack.aws.spec import get_service_catalog
1818
from localstack.http import Request
@@ -367,4 +367,4 @@ def test_query_protocol_detection_with_empty_body():
367367
assert detected_service_model.protocol == "query"
368368

369369
# we set wrong protocol here just to verify we can match `query` even if we don't have the Content-Type
370-
assert get_protocol_from_request(sns_request, ["query", "json"])
370+
assert match_available_protocols(sns_request, ["query", "json"])

0 commit comments

Comments
 (0)