Skip to content

Commit ff24fcb

Browse files
committed
", " instead of "," as field separator
1 parent 356cf18 commit ff24fcb

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

python-packages/smithy-python/smithy_python/_private/http/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def get_value(self) -> str:
176176
177177
Values with spaces or commas are double-quoted.
178178
"""
179-
return ",".join(self._quote_and_escape_single_value(val) for val in self.value)
179+
return ", ".join(self._quote_and_escape_single_value(val) for val in self.value)
180180

181181
def get_value_list(self) -> list[str]:
182182
"""Get values as a list of strings."""

python-packages/smithy-python/tests/unit/test_http_fields.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,35 +33,35 @@ def test_field_multi_valued_basics() -> None:
3333
assert field.name == "fname"
3434
assert field.kind == FieldPosition.HEADER
3535
assert field.value == ["fval1", "fval2"]
36-
assert field.get_value() == "fval1,fval2"
36+
assert field.get_value() == "fval1, fval2"
3737
assert field.get_value_list() == ["fval1", "fval2"]
3838

3939

4040
@pytest.mark.parametrize(
4141
"values,expected",
4242
[
4343
(["val1"], "val1"),
44-
(["val1", "val2"], "val1,val2"),
45-
(["©väl", "val2"], "©väl,val2"),
44+
(["val1", "val2"], "val1, val2"),
45+
(["©väl", "val2"], "©väl, val2"),
4646
# Values containing commas must be double-quoted.
47-
(["val1,", "val2"], '"val1,",val2'),
48-
(["v,a,l,1", "val2"], '"v,a,l,1",val2'),
47+
(["val1,", "val2"], '"val1,", val2'),
48+
(["v,a,l,1", "val2"], '"v,a,l,1", val2'),
4949
# ... but if the value is already quoted, it will not be quoted again.
50-
(['"v,a,l,1"', "val2"], '"v,a,l,1",val2'),
50+
(['"v,a,l,1"', "val2"], '"v,a,l,1", val2'),
5151
# In strings the got quoted, pre-existing double quotes are escaped with a
5252
# single backslash. The second backslash below is for escaping the actual
5353
# backslash in the string for Python.
54-
(["slc", '4,196"'], 'slc,"4,196\\""'),
54+
(["slc", '4,196"'], 'slc, "4,196\\""'),
5555
# ... unless they appear at the beginning AND end of the value, i.e. the value
5656
# is already quoted.
57-
(['"quoted"', "val2"], '"quoted",val2'),
57+
(['"quoted"', "val2"], '"quoted", val2'),
5858
# If the value is already quoted, additional quotes contained within do not get
5959
# escaped.
60-
(['"""', "val2"], '""",val2'),
60+
(['"""', "val2"], '""", val2'),
6161
# Backslashes are also escaped. The following case is a single backslash getting
6262
# serialized into two backslashes. Python escaping accounts for each actual
6363
# backslash being written as two.
64-
(["foo,bar\\", "val2"], '"foo,bar\\\\",val2'),
64+
(["foo,bar\\", "val2"], '"foo,bar\\\\", val2'),
6565
],
6666
)
6767
def test_field_serialization(values, expected):

0 commit comments

Comments
 (0)