From 19d1897826828de982abb7082834ce0130294cfc Mon Sep 17 00:00:00 2001 From: SchlenkR Date: Sun, 3 Sep 2023 10:53:27 +0200 Subject: [PATCH 1/2] docu --- src/docs/Sending_Requests.fsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/docs/Sending_Requests.fsx b/src/docs/Sending_Requests.fsx index b6cd4f84..23a7634a 100644 --- a/src/docs/Sending_Requests.fsx +++ b/src/docs/Sending_Requests.fsx @@ -98,12 +98,27 @@ http { It is possible to pass a cancellation token that will be used for the underlying HTTP request. *) -use cs = new CancellationTokenSource() +use cts = new CancellationTokenSource() // ... http { GET "https://mysite" - config_cancellationToken cs.Token + config_cancellationToken cts.Token } |> Request.send + + +(** +See also: https://github.com/fsprojects/FsHttp/issues/105 + +Instead of binding a cancellation token directly to a request definition (like in the example above), +it is also possible to pass it on execution-timer, like so: +*) + +http { + GET "https://mysite" +} +|> Config.cancellationToken cts.Token +|> Request.send + From 30af3f3259655a9323cc2bc3bcfcd61864c6efea Mon Sep 17 00:00:00 2001 From: SchlenkR Date: Sun, 3 Sep 2023 10:56:23 +0200 Subject: [PATCH 2/2] docu --- src/docs/Sending_Requests.fsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/docs/Sending_Requests.fsx b/src/docs/Sending_Requests.fsx index 23a7634a..401dc6e9 100644 --- a/src/docs/Sending_Requests.fsx +++ b/src/docs/Sending_Requests.fsx @@ -95,7 +95,8 @@ http { (** ## Request Cancellation -It is possible to pass a cancellation token that will be used for the underlying HTTP request. +It is possible to bind a cancellation token to a request definition, +that will be used for the underlying HTTP request: *) use cts = new CancellationTokenSource()