-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
The version in HttpRequestMessage had no validate #56662
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsWhen I try to specify the HTTP version for the HTTP request, I found that there's no validation on the version, you can set whatever version you want, the request message For example: var request = new HttpRequestMessage(HttpMethod.Get, "https://google.com")
{
Version = new Version(4, 0)
};
Console.WriteLine(request.ToString()); output:
while the HTTP version used is Maybe the request version would be misleading if the HTTP version in
|
The default If you instead set it to If you want to see the actual version that was established, you have to look at the |
If you want to avoid typos, you can use pre-defined versions: https://docs.microsoft.com/en-us/dotnet/api/system.net.httpversion Closing as By Design. |
The request message version is the same as the request message version in the response message, while the HTTP version in the response message is 1.1, and it seemed it would not throw an exception even when I set the When I set Thanks for your quick answer @MihaZupan @Kahbazi |
That's correct, the version policy set on |
Got it, great thanks @MihaZupan |
When I try to specify the HTTP version for the HTTP request, I found that there's no validation on the version, you can set whatever version you want, the request message
ToString()
would output the version directlyFor example:
output:
while the HTTP version used is
HTTP/1.1
, not the4.0
Maybe the request version would be misleading if the HTTP version in
HttpRequestMessage
is not the same with the actualHTTP version
The text was updated successfully, but these errors were encountered: