From 96a4186aef6eb67c55ee730022d48afa459cb100 Mon Sep 17 00:00:00 2001 From: hadley Date: Mon, 9 Sep 2024 19:00:06 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20r-lib/ht?= =?UTF-8?q?tr2@79db22069de22a18dfe33405d73aec119f04ba17=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dev/articles/httr2.html | 28 +++++------ dev/articles/oauth.html | 2 +- dev/articles/wrapping-apis.html | 60 +++++++++++------------ dev/news/index.html | 2 + dev/pkgdown.yml | 2 +- dev/reference/jwt_claim.html | 2 +- dev/reference/oauth_client_req_auth.html | 2 +- dev/reference/oauth_token.html | 2 +- dev/reference/obfuscate.html | 4 +- dev/reference/req_body.html | 22 ++++----- dev/reference/req_cookie_preserve.html | 2 +- dev/reference/req_error.html | 4 +- dev/reference/req_method.html | 6 +-- dev/reference/req_perform.html | 2 +- dev/reference/req_perform_iterative.html | 3 ++ dev/reference/req_perform_parallel.html | 6 +-- dev/reference/req_perform_stream.html | 2 +- dev/reference/req_retry.html | 61 ++++++++++++++---------- dev/reference/req_template.html | 6 +-- dev/reference/req_throttle.html | 4 +- dev/reference/req_verbose.html | 40 ++++++++-------- dev/reference/resp_headers.html | 30 ++++++------ dev/reference/resp_raw.html | 2 +- dev/reference/resp_url.html | 2 +- dev/reference/resps_successes.html | 6 +-- dev/reference/secrets.html | 2 +- dev/reference/with_verbosity.html | 20 ++++---- dev/search.json | 2 +- 28 files changed, 170 insertions(+), 156 deletions(-) diff --git a/dev/articles/httr2.html b/dev/articles/httr2.html index f74b738c..0c126506 100644 --- a/dev/articles/httr2.html +++ b/dev/articles/httr2.html @@ -105,7 +105,7 @@

Create a requestreq <- request(example_url()) req #> <httr2_request> -#> GET http://127.0.0.1:43345/ +#> GET http://127.0.0.1:36911/ #> Body: empty

Here, instead of an external website, we use a test server that’s built-in to httr2 itself. That ensures that this vignette will work @@ -115,7 +115,7 @@

Create a request
 req |> req_dry_run()
 #> GET / HTTP/1.1
-#> Host: 127.0.0.1:43345
+#> Host: 127.0.0.1:36911
 #> User-Agent: httr2/1.0.3.9000 r-curl/5.2.2 libcurl/7.81.0
 #> Accept: */*
 #> Accept-Encoding: deflate, gzip, br, zstd
@@ -130,7 +130,7 @@

Create a request

The path, which is the URL stripped of details that the server already knows, i.e. the protocol (http or https), the host (localhost), and the port -(43345).

+(36911).

  • The version of the HTTP protocol. This is unimportant for our purposes because it’s handled at a lower level.

  • @@ -147,7 +147,7 @@

    Create a request ) |> req_dry_run() #> GET / HTTP/1.1 -#> Host: 127.0.0.1:43345 +#> Host: 127.0.0.1:36911 #> User-Agent: httr2/1.0.3.9000 r-curl/5.2.2 libcurl/7.81.0 #> Accept-Encoding: deflate, gzip, br, zstd #> Name: Hadley @@ -166,7 +166,7 @@

    Create a request req_body_json(list(x = 1, y = "a")) |> req_dry_run() #> POST / HTTP/1.1 -#> Host: 127.0.0.1:43345 +#> Host: 127.0.0.1:36911 #> User-Agent: httr2/1.0.3.9000 r-curl/5.2.2 libcurl/7.81.0 #> Accept: */* #> Accept-Encoding: deflate, gzip, br, zstd @@ -193,7 +193,7 @@

    Create a request req_body_form(x = "1", y = "a") |> req_dry_run() #> POST / HTTP/1.1 -#> Host: 127.0.0.1:43345 +#> Host: 127.0.0.1:36911 #> User-Agent: httr2/1.0.3.9000 r-curl/5.2.2 libcurl/7.81.0 #> Accept: */* #> Accept-Encoding: deflate, gzip, br, zstd @@ -209,22 +209,22 @@

    Create a request req_body_multipart(x = "1", y = "a") |> req_dry_run() #> POST / HTTP/1.1 -#> Host: 127.0.0.1:43345 +#> Host: 127.0.0.1:36911 #> User-Agent: httr2/1.0.3.9000 r-curl/5.2.2 libcurl/7.81.0 #> Accept: */* #> Accept-Encoding: deflate, gzip, br, zstd #> Content-Length: 228 -#> Content-Type: multipart/form-data; boundary=------------------------15bc3a0bd15ae39c +#> Content-Type: multipart/form-data; boundary=------------------------848da71d34092912 #> -#> --------------------------15bc3a0bd15ae39c +#> --------------------------848da71d34092912 #> Content-Disposition: form-data; name="x" #> #> 1 -#> --------------------------15bc3a0bd15ae39c +#> --------------------------848da71d34092912 #> Content-Disposition: form-data; name="y" #> #> a -#> --------------------------15bc3a0bd15ae39c-- +#> --------------------------848da71d34092912--

    If you need to send data encoded in a different form, you can use req_body_raw() to add the data to the body and set the Content-Type header.

    @@ -239,7 +239,7 @@

    Perform a request and fetch th resp <- req |> req_perform() resp #> <httr2_response> -#> GET http://127.0.0.1:43345/json +#> GET http://127.0.0.1:36911/json #> Status: 200 OK #> Content-Type: application/json #> Body: In memory (407 bytes) @@ -249,7 +249,7 @@

    Perform a request and fetch th resp |> resp_raw() #> HTTP/1.1 200 OK #> Connection: close -#> Date: Mon, 09 Sep 2024 13:21:49 GMT +#> Date: Mon, 09 Sep 2024 18:59:48 GMT #> Content-Type: application/json #> Content-Length: 407 #> ETag: "de760e6d" @@ -302,7 +302,7 @@

    Perform a request and fetch th resp |> resp_headers() #> <httr2_headers> #> Connection: close -#> Date: Mon, 09 Sep 2024 13:21:49 GMT +#> Date: Mon, 09 Sep 2024 18:59:48 GMT #> Content-Type: application/json #> Content-Length: 407 #> ETag: "de760e6d" diff --git a/dev/articles/oauth.html b/dev/articles/oauth.html index 1e60209d..7ee78035 100644 --- a/dev/articles/oauth.html +++ b/dev/articles/oauth.html @@ -234,7 +234,7 @@

    Client secret
     obfuscate("secret")
    -#> obfuscated("fW8Et2sLw6DH_wuCp8QxgRiq2A0aYw")
    +#> obfuscated("cU2GXcb-lFqv9fEbbD2zpshzY63dTA")

    Here’s what a complete client specification for GitHub looks like, using a real app that I created specifically for this vignette:

    Errors @@ -162,7 +162,7 @@

    Errors #> Connection: keep-alive #> X-Powered-By: PHP/8.3.8 #> Cache-Control: no-cache, private -#> Date: Mon, 09 Sep 2024 13:21:56 GMT +#> Date: Mon, 09 Sep 2024 18:59:56 GMT #> X-RateLimit-Limit: 60 #> X-RateLimit-Remaining: 56 #> Access-Control-Allow-Origin: *

    @@ -234,8 +234,8 @@

    Core request function#> $ total : int 1 #> $ data :List of 1 #> ..$ :List of 3 -#> .. ..$ title : chr "Vitae excepturi ab quisquam." -#> .. ..$ description: chr "Rerum ut iure minima in sunt repellat est. Et maiores esse quia neque aliquam odit esse. Sunt excepturi delenit"| __truncated__ +#> .. ..$ title : chr "Sit qui quia provident." +#> .. ..$ description: chr "Corrupti quibusdam cumque sit eligendi provident. Doloremque nam voluptates cumque illo. Maiores et sint aliqui"| __truncated__ #> .. ..$ url : chr "https://picsum.photos/300/480"

    I’ve made a few important choices here: