Use this function to use a custom HTTP method like "HEAD", "DELETE", "PATCH", "UPDATE", or "OPTIONS".

req_method(req, method)

Arguments

req

A request.

method

Custom HTTP method

Value

A modified HTTP request.

Examples

request("http://httpbin.org") %>% req_method("PATCH")
#> <httr2_request>
#> PATCH http://httpbin.org
#> Body: empty
request("http://httpbin.org") %>% req_method("PUT")
#> <httr2_request>
#> PUT http://httpbin.org
#> Body: empty
request("http://httpbin.org") %>% req_method("HEAD")
#> <httr2_request>
#> HEAD http://httpbin.org
#> Body: empty