File: test-req-method.R

package info (click to toggle)
r-cran-httr2 1.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,684 kB
  • sloc: sh: 13; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 489 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
test_that("can override default method", {
  req <- request("http://example.com")

  expect_equal(req$method, NULL)

  req <- req_method(req, "patch")
  expect_equal(req$method, "PATCH")
})

test_that("correctly guesses default method", {
  req <- request("http://example.com")
  expect_equal(req_get_method(req), "GET")

  req <- req_body_raw(req, "abc")
  expect_equal(req_get_method(req), "POST")

  req <- req_options(req, nobody = TRUE)
  expect_equal(req_get_method(req), "HEAD")
})