-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modify serialization to check for text plan content type #2649
Conversation
…fix_pipeline_response_deserialization
@@ -105,7 +105,7 @@ class RawDeserializer: | |||
# Remove Byte Order Mark if present in string | |||
data_as_str = data_as_str.lstrip(_BOM) | |||
|
|||
if content_type is None: | |||
if content_type is None or content_type == "text/plain": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We solved this problem in azure-core already a while back, I would prefer to stay consistent with azure-core:
https://github.com/Azure/azure-sdk-for-python/blob/999ded5c8cdca182359d40265f08ed10f070c548/sdk/core/azure-core/azure/core/pipeline/policies/_universal.py#L643-L644
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with Laurent that we had better keep consistent with azure-core
…fix_pipeline_response_deserialization
@@ -2498,5 +2498,10 @@ def test_skip_url_encoding(self): | |||
self.assertEqual("%2Fdatabase%2F%7BObject.value%7D", result2) | |||
|
|||
|
|||
def test_deserialize_text(): | |||
assert "str" == RawDeserializer.deserialize_from_text("str", content_type="text/plain") | |||
assert "str" == RawDeserializer.deserialize_from_text(b"str", content_type="text/plain") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add test case to cover this scenario
thanks @msyyc |
fixes #2647