8000 enh: use the appropriate CURL options for specifying methods by antoine-lizee · Pull Request #357 · r-lib/httr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 2 commits into from
May 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# httr 1.1.0.9000

* Don't use custom requests anymore for standard `POST`, `GET` and `PUT` requests
(issue #356, fix #357). This has the side-effect of properly following redirects
after `POST`, fixing usual login issues (eg hadley/rvest#133).

* New `http_type()` returns the content/mime type of a request, sans parameters.

* Fix in readfunction to close connection when done.
Expand Down
9 changes: 8 additions & 1 deletion R/request.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ print.request <- function(x, ...) {

request_prepare <- function(req) {
req <- request_combine(request_default(), req)
req$options$customrequest <- req$method

# Use the appropriate cURL method when available.
# This - among others - ensures proper behaviour on redirects.
switch(req$method,
"POST" = {req$options$post <- TRUE},
"PUT" = {req$options$put <- TRUE},
"GET" = {req$options$httpget <- TRUE},
{req$options$customrequest <- req$method})

# Sign request, if needed
token <- req$auth_token
Expand Down
0