-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Smart text serialization #12149
Smart text serialization #12149
Conversation
# A string is valid JSON, make the difference between text | ||
# and a plain JSON string. | ||
# Content-Type is a good indicator of intent from user | ||
elif content_type and content_type.startswith("text/"): |
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.
I'm wondering if we've created a bit of a mishmash in how we decide how to serialize/pass request bodies. We are using the Content-Type
header, which parameters we pass in (form_data
or content
/stream_content
) as well as looking at the content mixed together. For example, we will try to serialize the data as json even if I specify a completely different header (assuming I didn't pass in an Element
instance that is :)). This is a reasonable first step given where we are.
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.
Yes, I'm not really happy by the black magic, it's why I took the simplest approach to avoid two much black magic: when you cannot guess at all if this is a string test, or a string token of JSON.
…into regenerate_keys * 'master' of https://github.com/Azure/azure-sdk-for-python: don't use mgmt track2 (Azure#12183) Fix pip version requirement in build-test.yml (Azure#12148) Revert "Resolve Pip Related Errors (Azure#12157)", Pin VirtualEnv (Azure#12169) Smart text serialization (Azure#12149) Remove OSName Variable (Azure#12147) [formrecognizer] add strongly-typed receipt wrapper sample (Azure#12128) Add missing __init__ type annotations (Azure#12146) fix sample in readme (Azure#12144)
Fix #12137