req_method {httr2} | R Documentation |
Use this function to use a custom HTTP method like HEAD
,
DELETE
, PATCH
, UPDATE
, or OPTIONS
. The default method is
GET
for requests without a body, and POST
for requests with a body.
req_method(req, method)
req |
A request. |
method |
Custom HTTP method |
A modified HTTP request.
request("http://httpbin.org") %>% req_method("PATCH")
request("http://httpbin.org") %>% req_method("PUT")
request("http://httpbin.org") %>% req_method("HEAD")