req_method {httr2}R Documentation

Set HTTP method in request

Description

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.

Usage

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")
request("http://httpbin.org") %>% req_method("PUT")
request("http://httpbin.org") %>% req_method("HEAD")

[Package httr2 version 0.2.2 Index]