Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
proposal: net/http: add Client.Put, Client.Patch #22841
I am proposing the addition of the following functions to the net/http package.
These functions would be similar to the Post functions that already exist.
I believe all the reasons that the Post functions where added would also apply to these functions. Furthermore the fact the the Post functions already exist would make these functions a natural extension of an approach that has already been started but is currently incomplete.
WORK TO BE DONE BY
This has come up and been declined in the past. The argument has been that we have to draw the line somewhere. So the question is where to draw the line. After Post? After Put? After Patch? After Delete? After Options? After Trace? Hopefully before Spacejump.
Get and Head are easy, but are already lacking, in that they don't let you add headers. Post and PostForm also don't let you set headers.
We decided to stop with Get, Head, and Post, which are already convenient but often lacking.
People wanting to set request headers or use less popular methods can use http.NewRequest or their own helpers.
If you want to make an argument based on usage data in the wild (Firefox Telemetry Dashboard or Chrome UMA) that shows a massive cliff at a certain point, that might be compelling.
@bradfitz @tombergan I am checking into the telemetry data but I have not used these systems before so it is taking me a while to figure out. However I have gathered data from the top 25 google search returns for "http verbs" and "http methods". I figured this would give a decent idea about which ones where most widely learned, known, and used.
I had this data with better breakdowns and graphs but apparently the upload here doesn't support the file type.
@bradfitz @tombergan I have spent the past several days crawling all over the firefox telemetry dashboard site and all the data I can access on there. So far I have not been able to find this data on there site. I am not sure if it is in one of the password protected areas or if I am just missing something. Any advise on finding this data would be appreciated.
@bradfitz @tombergan I am currently asking around in mozilla support and other forums to find out if someone can point me toward the requested data or provide me with access to it. I was also wondering if you thought that the data I provided above might make a difference if I continued to collect and expand it (such as adding other search engines bing, yahoo, etc and/or other search quarries "http tutorials", "lists of http methods", etc.). Also I was thinking about checking what similar functions other language std libs contain. My thinking being that matching the most common ones from other languages would make it easier on ppl that know that language and are trying out Go. Therefor making the conversion and keeping these users more likely. Do you think this would make a difference (would this possibly win you over. Do you think it would win over others) ? Thanks in advance for any responses.
Request For More Info
@tmthrgd @vizee I take it from your emojis you don't like this idea. I was wondering if you would be willing to expand on your reasons and possibly say what would change your minds. I would like to know so I can address your concerns here as well as consider your perspectives in making future proposals. Thanks in advance for any responses.
@OneOfOne I am not entirely sure what your laugh emoji means. Are you agreeing with bradfitz or think his idea is ridiculous or something else. I am just trying to clarify where everyone stands so I know how to proceed or whether to proceed at all. Thanks in advance.
If we redo the net/http API then maybe we should consider making this, and client operations more generally, easier, but for now we're not adding new methods to net/http. It's certainly too much work right now just to make a GET request. The delta on top of that for PUT/PATCH is actually fairly low. But maybe a rework to make all requests easier would make PUT/PATCH easier too. Leaving this for an eventual wholesale rethink of net/http.