Skip to content

Commit 5070769

Browse files
author
Ran Isenberg
committed
fix: parameters: fix return type to bytes in internal function
1 parent d03ef4b commit 5070769

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

aws_lambda_powertools/utilities/parameters/appconfig.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def __init__(
8484

8585
super().__init__()
8686

87-
def _get(self, name: str, **sdk_options) -> bytes:
87+
def _get(self, name: str, **sdk_options) -> str:
8888
"""
8989
Retrieve a parameter value from AWS App config.
9090
@@ -104,7 +104,7 @@ def _get(self, name: str, **sdk_options) -> bytes:
104104
sdk_options["ClientId"] = CLIENT_ID
105105

106106
response = self.client.get_configuration(**sdk_options)
107-
return response["Content"].read() # read() of botocore.response.StreamingBody
107+
return response["Content"].read().decode("utf-8") # read() of botocore.response.StreamingBody
108108

109109
def _get_multiple(self, path: str, **sdk_options) -> Dict[str, str]:
110110
"""
@@ -121,7 +121,7 @@ def get_app_config(
121121
force_fetch: bool = False,
122122
max_age: int = DEFAULT_MAX_AGE_SECS,
123123
**sdk_options
124-
) -> Union[str, list, dict, bytes]:
124+
) -> Union[str, list, dict]:
125125
"""
126126
Retrieve a configuration value from AWS App Config.
127127

tests/functional/test_utilities_parameters.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1503,9 +1503,8 @@ def test_appconf_provider_get_configuration_no_transform(mock_name, config):
15031503
stubber.activate()
15041504

15051505
try:
1506-
value = provider.get(mock_name)
1507-
str_value = value.decode("utf-8")
1508-
assert str_value == json.dumps(mock_body_json)
1506+
value: str = provider.get(mock_name)
1507+
assert value == json.dumps(mock_body_json)
15091508
stubber.assert_no_pending_responses()
15101509
finally:
15111510
stubber.deactivate()

0 commit comments

Comments
 (0)