diff --git a/dev/articles/httr2.html b/dev/articles/httr2.html index 78b25c5b..f5bf8d65 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:42033/ +#> GET http://127.0.0.1:38255/ #> 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:42033
+#> Host: 127.0.0.1:38255
 #> User-Agent: httr2/1.0.7.9000 r-curl/6.0.1 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 -(42033).

+(38255).

  • 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:42033 +#> Host: 127.0.0.1:38255 #> User-Agent: httr2/1.0.7.9000 r-curl/6.0.1 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:42033 +#> Host: 127.0.0.1:38255 #> User-Agent: httr2/1.0.7.9000 r-curl/6.0.1 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:42033 +#> Host: 127.0.0.1:38255 #> User-Agent: httr2/1.0.7.9000 r-curl/6.0.1 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:42033 +#> Host: 127.0.0.1:38255 #> User-Agent: httr2/1.0.7.9000 r-curl/6.0.1 libcurl/7.81.0 #> Accept: */* #> Accept-Encoding: deflate, gzip, br, zstd #> Content-Length: 228 -#> Content-Type: multipart/form-data; boundary=------------------------7f4c3d37b82bde0e +#> Content-Type: multipart/form-data; boundary=------------------------f39c4189a43ec116 #> -#> --------------------------7f4c3d37b82bde0e +#> --------------------------f39c4189a43ec116 #> Content-Disposition: form-data; name="x" #> #> 1 -#> --------------------------7f4c3d37b82bde0e +#> --------------------------f39c4189a43ec116 #> Content-Disposition: form-data; name="y" #> #> a -#> --------------------------7f4c3d37b82bde0e-- +#> --------------------------f39c4189a43ec116--

    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:42033/json +#> GET http://127.0.0.1:38255/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: Wed, 27 Nov 2024 14:21:58 GMT +#> Date: Thu, 12 Dec 2024 20:36:38 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: Wed, 27 Nov 2024 14:21:58 GMT +#> Date: Thu, 12 Dec 2024 20:36:38 GMT #> Content-Type: application/json #> Content-Length: 407 #> ETag: "de760e6d" diff --git a/dev/articles/oauth.html b/dev/articles/oauth.html index ac3eb57a..d206c040 100644 --- a/dev/articles/oauth.html +++ b/dev/articles/oauth.html @@ -234,7 +234,7 @@

    Client secret
     obfuscate("secret")
    -#> obfuscated("LkQDki_2B1jskcUdl0Jkyki0N57h_g")
    +#> obfuscated("iCvjCayDi09V562wHJg3w3oi-GrXdA")

    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: Wed, 27 Nov 2024 14:22:06 GMT +#> Date: Thu, 12 Dec 2024 20:36:47 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 "Itaque sit ipsum ipsam." -#> .. ..$ description: chr "Fugiat amet quas et molestiae. Molestiae eum voluptatem et rerum hic aperiam est. Molestiae reprehenderit iste "| __truncated__ +#> .. ..$ title : chr "Ullam ipsum nam voluptatem." +#> .. ..$ description: chr "Amet sint aut quia optio placeat voluptatem. Et quam error eveniet. Et dolores debitis expedita vel. Est ex imp"| __truncated__ #> .. ..$ url : chr "https://picsum.photos/300/480"

    I’ve made a few important choices here: