Skip to content
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

System.Net.Http.HttpMethod vs. Microsoft.AspNetCore.Http.HttpMethods #20127

Closed
am11 opened this issue Mar 25, 2020 · 3 comments
Closed

System.Net.Http.HttpMethod vs. Microsoft.AspNetCore.Http.HttpMethods #20127

am11 opened this issue Mar 25, 2020 · 3 comments
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved
Milestone

Comments

@am11
Copy link
Member

am11 commented Mar 25, 2020

Since both provide same support except System.Net.Http.HttpMethod.Connect is internal, is there a general guideline which one the devs should use?
Or can the (plural) one in this repo deprecated?

@javiercn
Copy link
Member

@am11 thanks for contacting us.

Those two classes serve different purposes. If you are using ASP.NET Core APIs you should use Microsoft.AspNetCore.Http.HttpMethods and if you are using HttpClient APIs you should use System.Net.Http.HttpMethod

@Tratcher in case he wants to add something more.

@javiercn javiercn added ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. area-servers question labels Mar 25, 2020
@ghost ghost added the Status: Resolved label Mar 25, 2020
@Tratcher
Copy link
Member

Tratcher commented Mar 25, 2020

Their types are different. HttpMethod is a class instance containing a string, where HttpMethods is static set of strings that can be used directly.

HttpMethod is required when working with HttpClient. HttpMethods can be used almost anywhere else.

Don't expect either to be deprecated any time soon.

@shirhatti shirhatti added this to the Discussions milestone Mar 25, 2020
@ghost
Copy link

ghost commented Mar 26, 2020

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.

@ghost ghost closed this as completed Mar 26, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Apr 25, 2020
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 24, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved
Projects
None yet
Development

No branches or pull requests

5 participants