Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

add_headers

Add additional headers to a request.


Description

Wikipedia provides a useful list of common http headers: http://en.wikipedia.org/wiki/List_of_HTTP_header_fields.

Usage

add_headers(..., .headers = character())

Arguments

...

named header values. To stop an existing header from being set, pass an empty string: "".

.headers

a named character vector

See Also

accept() and content_type() for convenience functions for setting accept and content-type headers.

Examples

add_headers(a = 1, b = 2)
add_headers(.headers = c(a = "1", b = "2"))

GET("http://httpbin.org/headers")

# Add arbitrary headers
GET(
  "http://httpbin.org/headers",
  add_headers(version = version$version.string)
)

# Override default headers with empty strings
GET("http://httpbin.org/headers", add_headers(Accept = ""))

httr

Tools for Working with URLs and HTTP

v1.4.2
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.