diff --git a/dev/articles/httr2.html b/dev/articles/httr2.html index 3955481b..3cb2a0f2 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:35103/ +#> GET http://127.0.0.1:34515/ #> 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:35103
+#> Host: 127.0.0.1:34515
 #> 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 -(35103).

+(34515).

  • 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:35103 +#> Host: 127.0.0.1:34515 #> 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:35103 +#> Host: 127.0.0.1:34515 #> 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:35103 +#> Host: 127.0.0.1:34515 #> 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:35103 +#> Host: 127.0.0.1:34515 #> 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=------------------------d9fd825ca7e26255 +#> Content-Type: multipart/form-data; boundary=------------------------2b5696b71e4414e2 #> -#> --------------------------d9fd825ca7e26255 +#> --------------------------2b5696b71e4414e2 #> Content-Disposition: form-data; name="x" #> #> 1 -#> --------------------------d9fd825ca7e26255 +#> --------------------------2b5696b71e4414e2 #> Content-Disposition: form-data; name="y" #> #> a -#> --------------------------d9fd825ca7e26255-- +#> --------------------------2b5696b71e4414e2--

    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:35103/json +#> GET http://127.0.0.1:34515/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: Fri, 06 Sep 2024 15:21:41 GMT +#> Date: Fri, 06 Sep 2024 15:24:50 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: Fri, 06 Sep 2024 15:21:41 GMT +#> Date: Fri, 06 Sep 2024 15:24:50 GMT #> Content-Type: application/json #> Content-Length: 407 #> ETag: "de760e6d" diff --git a/dev/articles/oauth.html b/dev/articles/oauth.html index ed2f48d1..91f87aa3 100644 --- a/dev/articles/oauth.html +++ b/dev/articles/oauth.html @@ -234,7 +234,7 @@

    Client secret
     obfuscate("secret")
    -#> obfuscated("8ePuw--sOa1hUamkeB3wSD0ZDyBfPw")
    +#> obfuscated("Gd6NirpL8vjK1kd90iqUouLu8JuyaA")

    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: Fri, 06 Sep 2024 15:21:49 GMT +#> Date: Fri, 06 Sep 2024 15:24:57 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 "Optio sit et itaque eum." -#> .. ..$ description: chr "Voluptas sit maxime sed quidem ipsum corrupti. Ratione aut nulla quidem hic aspernatur voluptatum harum. Dolore"| __truncated__ +#> .. ..$ title : chr "Sed earum iure fugiat nihil." +#> .. ..$ description: chr "Numquam earum et aliquam incidunt ea expedita eos. Ut sequi velit enim vel aut illo nam. Similique voluptas ver"| __truncated__ #> .. ..$ url : chr "https://picsum.photos/300/480"

    I’ve made a few important choices here: