Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/httr2-min-version-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
on:
push:
branches: main
pull_request:

name: httr2 minimum version support check

jobs:
httr2-version-check:
runs-on: ubuntu-latest

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
_R_CHECK_TESTS_NLINES_: 0

steps:
- uses: actions/checkout@v6

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2

- uses: actions/checkout@v6
with:
r-version: release
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck any::httr2@1.0.0
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ inst/doc/*.html
*.Rproj
revdep/
docs/
tests/testthat/127.0.0.1-*
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ BugReports: https://github.com/nealrichardson/httptest2/issues
License: MIT + file LICENSE
Imports:
digest,
httr2 (>= 0.2.0),
httr2 (>= 1.0.0),
jsonlite,
rlang,
stats,
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# httptest2 (development version)

* Reloaded mocked response objects now include the request that caused them to be loaded as `$request` (#65, @jonthegeek)
* httptest2 now requires httr2 v1.0.0 or higher (@jonthegeek)

# httptest2 1.2.2

Expand Down
9 changes: 1 addition & 8 deletions R/expect-request-header.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#' @return The value of `expr` if there are no expectation failures
#' @importFrom testthat expect_null expect_match
#' @importFrom rlang is_string
#' @importFrom httr2 with_mocked_response
#' @examplesIf FALSE
#'
#' library(httr2)
Expand Down Expand Up @@ -86,11 +87,3 @@ expect_request_header <- function(

with_mocked_responses(header_mocker, expr)
}

with_mocked_responses <- function(mock, code) {
if (httr2_1.0.0) {
utils::getFromNamespace("with_mocked_responses", "httr2")(mock, code)
} else {
utils::getFromNamespace("with_mock", "httr2")(mock, code)
}
}
6 changes: 0 additions & 6 deletions R/zzz.R

This file was deleted.

4 changes: 2 additions & 2 deletions tests/testthat/test-mock-api.R
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ with_mock_api({
req$policies$example <- "example policy"
a <- req %>% req_perform()
expect_identical(
httr2::resp_request(a),
a$request,
req
)
expect_identical(
httr2::resp_request(a)$policies$example,
a$request$policies$example,
"example policy"
)
})
Expand Down
Loading