8000 Uppercase methods by patr1ckm · Pull Request #583 · r-lib/httr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Uppercase methods 8000 #583

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 3 commits into from
Apr 3, 2020
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
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* `RETRY()` now throws the correct error message if an error occurs during the
request (@austin3dickey, #581).

* `VERB()` and `RETRY()` now automatically uppercase methods (@patr1ckm, #571).

# httr 1.4.0

## OAuth
Expand Down
4 changes: 2 additions & 2 deletions R/request.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ request_build <- function(method, url, ...) {

req <- Reduce(request_combine, extra, init = request())

req$method <- method
req$method <- toupper(method)
req$url <- url

req
Expand All @@ -94,7 +94,7 @@ request_combine <- function(x, y) {
print.request <- function(x, ...) {
cat("<request>\n")
if (!is.null(x$method) && !is.null(x$url)) {
cat(toupper(x$method), " ", x$url, "\n", sep = "")
cat(x$method, " ", x$url, "\n", sep = "")
}
if (!is.null(x$output)) {
cat("Output: ", class(x$output)[[1]], "\n", sep = "")
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-request.r
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ test_that("c.request merges headers", {
)
})

test_that('request_build upper cases verbs', {
expect_equal(request_build('get', 'asdf.com')$method, "GET")
expect_equal(request_build('post', 'asdf.com')$method, "POST")
})

test_that("non-http methods don't parse headers", {
# skip on travis to avoid hammering the FTP server, which doesn't
# seem to be able to handle multiple simultaneous requests
Expand Down
0