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

proposal: net/http: add Client.Put, Client.Patch #22841

Open
sjtwiv opened this issue Nov 22, 2017 · 7 comments
Open

proposal: net/http: add Client.Put, Client.Patch #22841

sjtwiv opened this issue Nov 22, 2017 · 7 comments

Comments

@sjtwiv
Copy link

sjtwiv commented Nov 22, 2017

PROPOSAL

I am proposing the addition of the following functions to the net/http package.

func Put()
func Patch()
func ()Put
func ()Patch

These functions would be similar to the Post functions that already exist.

REASONS

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

sjtwiv

@bradfitz
Copy link
Contributor

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.

/cc @tombergan

@bradfitz bradfitz changed the title Add patch and put functions to net/http proposal: net/http: add Client.Put, Client.Patch Nov 22, 2017
@gopherbot gopherbot added this to the Proposal milestone Nov 22, 2017
@bradfitz bradfitz added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 22, 2017
@sjtwiv
Copy link
Author

sjtwiv commented Nov 23, 2017

@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.

Method Count
get 36
put 35
patch 21
delete 35
post 35
connect 10
head 23
options 23
trace 13
acl 2
baseline-control 2
bind 1
checkin 2
checkout 2
copy 2
label 2
link 1
lock 2
merge 2
mkactivity 2
mkcalendar 1
mkcol 2
mkredirectref 1
mkworkspace 2
move 2
pri 1
orderpatch 2
propfind 2
proppatch 2
rebind 1
report 2
search 2
unbind 1
uncheckout 2
unlink 1
unlock 2
update 2
updateredirectref 1
version-control 2
spacejump 0

I had this data with better breakdowns and graphs but apparently the upload here doesn't support the file type.

@sjtwiv
Copy link
Author

sjtwiv commented Nov 25, 2017

@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
Copy link
Contributor

Sorry, I have no clue about either the Firefox or the Chrome systems in detail.

@sjtwiv
Copy link
Author

sjtwiv commented Nov 26, 2017

Update

@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.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2017

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.

@sjtwiv
Copy link
Author

sjtwiv commented Nov 28, 2017

@rsc Ok. That makes sense. Let me know if theres anything I can do.

@joedian joedian removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants