Skip to content

Commit 3d3d01d

Browse files
Handle empty fields in error identifier
Co-authored-by: Nate Prewitt <[email protected]>
1 parent 1a83535 commit 3d3d01d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/smithy-aws-core/src/smithy_aws_core/aio/protocols.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def identify(
2222
if self._HEADER_KEY not in response.fields:
2323
return None
2424

25-
code = response.fields[self._HEADER_KEY].values[0]
25+
error_field = response.fields[self._HEADER_KEY]
26+
code = error_field.values[0] if len(error_field.values) > 0 else None
2627
if not code:
2728
return None
2829

packages/smithy-http/src/smithy_http/aio/protocols.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def _is_success(
144144
context: TypedProperties,
145145
response: HTTPResponse,
146146
) -> bool:
147-
return 200 <= response.status <= 299
147+
return 200 <= response.status < 300
148148

149149
async def _create_error(
150150
self,

0 commit comments

Comments
 (0)