View source: R/expect-header.R
expect_header | R Documentation |
This expectation checks that a HTTP header (and potentially header value)
is present in a request. It works by inspecting the request object and
raising warnings that are caught by testthat::expect_warning()
.
expect_header(..., ignore.case = TRUE)
... |
Arguments passed to |
ignore.case |
logical: if |
expect_header
works both in the mock HTTP contexts and on "live" HTTP
requests.
NULL
, according to expect_warning
.
library(httr)
with_fake_http({
expect_header(
GET("http://example.com", config = add_headers(Accept = "image/png")),
"Accept: image/png"
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.