tests/testthat/_snaps/expect-request-header.md

expect_request_header with mock API

Code
  expect_request_header(request("https://test.api/object1/") %>% req_headers(
    Accept = "image/png") %>% req_perform(), accept = "image/jpeg")
Condition
  Error:
  ! Expected Header "accept" to match regexp "image/jpeg".
  Actual text:
  x | image/png
Code
  expect_request_header(request("https://test.api/object1/") %>% req_headers(
    Accept = "image/png") %>% req_perform(), accept = NULL)
Condition
  Error:
  ! Expected Header "accept" to be NULL.
  Differences:
  `actual` is a character vector ('image/png')
  `expected` is NULL


Try the httptest2 package in your browser

Any scripts or data that you put into this service are public.

httptest2 documentation built on Nov. 17, 2025, 5:06 p.m.