-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Use StringContent rather than StreamContent for text based Mime Types #122
Conversation
…cation/xml as StringContent httpContent types
…-for-text-based-mime-types Extend CreateProxiedHttpRequests to handle application/json and appli…
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.
Seems good to me!
Should we also add I'm not sure I 100% understand the impetus. What do those other libraries do that doesn't work with the regular |
Good Morning, |
For text/html I believe it's not so convenient since you already manage the form type submit a part. This change would affect POST/PUT/PATCH for json or xml based requests to be handled as StringContent, allowing to read the resultant stream as seekable allowing to read the content properly. |
Oh, sorry, "text/html" yes could be also. Potentially any text based mimy type could benefit from this. |
Ok, sounds good. Any way we can get a treat added that exercises this, and would fail if it did not use Essentially, this is the type of case that needs to be protected by a test. Otherwise, someone is going to come along in 3 years and revert because noone remembers why it was changed to this implementation. |
Yes, I agree that a test can help to demonstrate the reasoning. |
…or proper header handling
…-for-text-based-mime-types Extend text based mime types and add the usesStreamContent to false f…
Hi, Thanks anyways for the time and effort. |
Little improvement to proxy request with HttpRequestMessage.HttpContent as StringContent rather than StreamContent, only for content based requests (POST/PUT/PATCH) that have an "application/json" or "application/xml" (can be extended but my understanding is that this covers major use cases).
According to documentation, StringContent is recommended for text based content requests rather than StreamContent. StringContent is associated with text based Mime Type content requests while StreamContent seems to be convenient for octet-stream based requests.
This improvement should be transparent to the current functionality and enables further integration with other libraries that provide specific HttpClient implementations (such as AwsSignatureVersion4 nugget package).