Skip to content

Commit

Permalink
devtools::build_readme()
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Jan 8, 2025
1 parent a3d536d commit 853acc3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ req |> req_headers("Accept" = "application/json")
#> <httr2_request>
#> GET https://r-project.org
#> Headers:
#> • Accept: 'application/json'
#> • Accept: "application/json"
#> Body: empty

# Add a body, turning it into a POST
Expand All @@ -69,6 +69,9 @@ req |> req_retry(max_tries = 5)
#> Policies:
#> • retry_max_tries: 5
#> • retry_on_failure: FALSE
#> • retry_failure_threshold: Inf
#> • retry_failure_timeout: 30
#> • retry_realm: "r-project.org"

# Change the HTTP method
req |> req_method("PATCH")
Expand All @@ -83,9 +86,9 @@ And see exactly what httr2 will send to the server with `req_dry_run()`:
req |> req_dry_run()
#> GET / HTTP/1.1
#> Host: r-project.org
#> User-Agent: httr2/1.0.3.9000 r-curl/5.2.2 libcurl/8.6.0
#> User-Agent: httr2/1.0.7.9000 r-curl/6.1.0 libcurl/8.7.1
#> Accept: */*
#> Accept-Encoding: deflate, gzip
#> Accept-Encoding: gzip
```

Use `req_perform()` to perform the request, retrieving a **response**:
Expand All @@ -97,7 +100,7 @@ resp
#> GET https://www.r-project.org/
#> Status: 200 OK
#> Content-Type: text/html
#> Body: In memory (6951 bytes)
#> Body: In memory (6774 bytes)
```

The `resp_` functions help you extract various useful components of the
Expand Down Expand Up @@ -147,8 +150,7 @@ resp |> resp_body_html()

## Acknowledgements

httr2 wouldn’t be possible without
[curl](https://cran.dev/curl/),
httr2 wouldn’t be possible without [curl](https://cran.dev/curl/),
[openssl](https://cran.dev/openssl/),
[jsonlite](https://cran.dev/jsonlite/), and
[jose](https://github.com/r-lib/jose/), which are all maintained by
Expand Down

0 comments on commit 853acc3

Please sign in to comment.