Skip to content

Commit

Permalink
Switch to base R pipe in vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Jan 28, 2024
1 parent edf52b9 commit 5e0d608
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
- {os: windows-latest, r: '4.1', ssl-backend: openssl}
- {os: windows-latest, r: '4.1'}
- {os: windows-latest, r: '3.6'}
- {os: ubuntu-22.04, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-20.04, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Suggests:
jsonlite,
later,
rmarkdown,
magrittr,
httpuv (>= 1.4.4),
webutils
VignetteBuilder: knitr
Expand Down
17 changes: 9 additions & 8 deletions vignettes/intro.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,13 @@ The `form_data` function is similar but simply posts a string or raw value with

All of the `handle_xxx` functions return the handle object so that function calls can be chained using the popular pipe operators:

```{r}
library(magrittr)
new_handle() %>%
handle_setopt(copypostfields = "moo=moomooo") %>%
handle_setheaders("Content-Type"="text/moo", "Cache-Control"="no-cache", "User-Agent"="A cow") %>%
curl_fetch_memory(url = "https://hb.cran.dev/post") %$% content %>%
rawToChar %>% jsonlite::prettify()
```{r eval=getRversion() > "4.1"}
# Perform request
res <- new_handle() |>
handle_setopt(copypostfields = "moo=moomooo") |>
handle_setheaders("Content-Type"="text/moo", "Cache-Control"="no-cache", "User-Agent"="A cow") |>
curl_fetch_memory(url = "https://hb.cran.dev/post")
# Parse response
res$content |> rawToChar() |> jsonlite::prettify()
```

0 comments on commit 5e0d608

Please sign in to comment.