File: http-headers.R

package info (click to toggle)
r-cran-crul 1.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,620 kB
  • sloc: sh: 13; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 726 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#' Working with HTTP headers
#'
#' @name http-headers
#' @examples \dontrun{
#' (x <- HttpClient$new(url = "https://httpbin.org"))
#'
#' # set headers
#' (res <- HttpClient$new(
#'   url = "https://httpbin.org",
#'   opts = list(
#'     verbose = TRUE
#'   ),
#'   headers = list(
#'     a = "stuff",
#'     b = "things"
#'   )
#' ))
#' res$headers
#' # reassign header value
#' res$headers$a <- "that"
#' # define new header
#' res$headers$c <- "what"
#' # request
#' res$get('get')
#'
#' ## setting content-type via headers
#' (res <- HttpClient$new(
#'   url = "https://httpbin.org",
#'   opts = list(
#'     verbose = TRUE
#'   ),
#'   headers = list(`Content-Type` = "application/json")
#' ))
#' res$get('get')
#' }
NULL