-
Notifications
You must be signed in to change notification settings - Fork 2k
enh: use the appropriate CURL options for specifying methods #357
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
Conversation
@@ -99,7 +99,14 @@ print.request <- function(x, ...) { | |||
|
|||
request_prepare <- function(req) { | |||
req <- request_combine(request_default(), req) | |||
req$options$customrequest <- req$method | |||
switch(req$method, | |||
"POST" = { |
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.
Could you please make it more like "POST" = (req$options$post <- TRUE)
?
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.
Why the brackets instead of curly? I'd rather have it be silent? I wouldn't mind putting it on one line if you prefer.
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.
I'm not sure what you mean by silent, but I don't think choice of parens matters.
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.
Curly brackets are expressions, they return the result invisibly. Just try:
switch("a", "a" = (tt <- 2))
# [1] 2
switch("a", "a" = {tt <- 2})
# Nothing
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.
Yes, but it really doesn't matter here. Regardless, splitting the expression over multiple lines really bugs me, so please fix.
Would you mind also adding a bullet point to NEWS? And any thoughts on how to test this? |
NEWS -> Will do |
Since testing is hard, could you add a comment mentioning why this behaviour is important? I'm worried I'll forget about it and re-simplify in the future. |
648dac5
to
7cd10ef
Compare
Thanks! |
Unfortunately this doesn't seem to be correct - setting I think this is probably because I'm setting the post body parameters in |
A bit of googling suggests that using |
Good catch - this is officially a Windows exception to the cURL behaviour, itself being a standard but non-compliant way of dealing with RFC... Why is software getting so crazy? |
cf #356.
A small fix can go a long way :-). I'd advocate for quick publishing to CRAN after inclusion of this PR (or whatever other code change that solves #356).