Comments (7)
Yes, definitely. I have to check how cancellation is done in the underlying HttpClient and others and then decide how the API should allow passing tokens, etc.
from fshttp.
I'd be happy with either one, but having a choice is great. Thanks for getting this in!
from fshttp.
Hi Josh. I just released v12 (https://www.nuget.org/packages/FsHttp). Could you check please if it all works for you? Thank you.
from fshttp.
Hint:
from fshttp.
from fshttp.
For clarification + documentation:
There are 2 solutions that seems to be reaonable for an implementation:
- Setting the cancellation token on "define-time" (as part of the request)
- Passing it along at "execution-time" (something like
http { GET "url" } |> Request.withCancellationToken tok |> Request.sendAsync
).
The 2nd approach seems to me like the way to go, because: A FsHttp request is just data, out of which a dotnet HttpRequest is constructed and executed. This can happen multiple times. But: This is not strictly followed through since it's (for example) possible to capture an instance of HttpClient via an HttpClientTransformer, which is then part of the FsHttp request. I can also think of scenarios where it's wanted to bind a CTok to a request definition. This automatically also provides the possibility for passing a CTok ad-hoc on execution time, like shown above.
There are now these 2 possibilities implemented:
// 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()
// ...
http {
GET "https://mysite"
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 fshttp.
Do you have an estimate for when the next Nuget package will be released?
from fshttp.
Related Issues (20)
- System.FormatException: The format of value '' is invalid. HOT 7
- Am I using `Config.timeoutInSeconds` wrong? HOT 3
- .NET 7 not working: "The format of value '' is invalid" HOT 2
- Remove: printfn "Download response received - starting download..." HOT 2
- Encoding issue in FSI response content printing
- Not escaped query value part HOT 2
- Turning off debug logs in FSI HOT 3
- Update Readme
- Support Repeating Query Parameters
- Async config_transformHttpRequestMessage HOT 6
- ContentTypeForPart custom operations should come after part definition
- Make `logfn` optional HOT 8
- Remove ./docs generated output and deploy directy to GH pages via workflow
- Update FS Docs to modernized theme
- Rework build.fsx
- Use implicit yields instead of CustOps
- FsHttp Has an Implicit Dependency on Fsharp.Core 8.0+ from version 12.0.0 on HOT 3
- config_baseUrl shortcut
- FSharp.Core dependency confusion HOT 4
- JSON Docu
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fshttp.