Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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
43 changes: 43 additions & 0 deletions .github/workflows/httr2-1-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
on:
push:
branches: main
pull_request:

name: httr2 1 R-CMD-check
Comment thread
jonthegeek marked this conversation as resolved.
Outdated

jobs:
httr2-1-check:
runs-on: ${{ matrix.config.os }}
Comment thread
jonthegeek marked this conversation as resolved.
Outdated

strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'release'}

Comment thread
jonthegeek marked this conversation as resolved.
Outdated
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
_R_CHECK_TESTS_NLINES_: 0

steps:
- uses: actions/checkout@v5
Comment thread
jonthegeek marked this conversation as resolved.
Outdated

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

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
Comment thread
jonthegeek marked this conversation as resolved.
Outdated
http-user-agent: ${{ matrix.config.http-user-agent }}
Comment thread
jonthegeek marked this conversation as resolved.
Outdated
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")'
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
10 changes: 1 addition & 9 deletions R/expect-request-header.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,5 @@ 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)
}
httr2::with_mocked_responses(header_mocker, expr)
Comment thread
jonthegeek marked this conversation as resolved.
Outdated
}
6 changes: 0 additions & 6 deletions R/zzz.R

This file was deleted.

Comment thread
jonthegeek marked this conversation as resolved.
Outdated
Empty file.
Empty file.
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