A .Net HTTP client library for F#, C#, and friends
Get Started
| Product | Versions |
|---|---|
| .NET |
README
FsHttp
FsHttp is a "hackable HTTP client" that offers a legible style for the basics while still affording full access to the underlying HTTP representations for covering unusual cases. It's the best of both worlds: Convenience and Flexibility.
- Use it as a replacement for
.httpfiles, VSCode's REST client, Postman, and other tools as an interactive and programmable playground for HTTP requests. - Usable as a production-ready HTTP client for applications powered by .NET (C#, VB, F#).
👍 Postman? ❤️ FsHttp! https://youtu.be/F508wQu7ET0
FsHttp ❤️ PXL Clock
Allow us a bit of advertising for our PXL Clock! It's a fun device, made with ❤️ - and it's programmable almost as easy as you write requests with FsHttp :)
Find out more:
On the PXL Clock Discord Server
check out the PXL Clock Repo on GitHub
Visit the official PXL Clock Store
Join the PXL Clock Community on Discord
Documentation
- 📖 Please see FsHttp Documentation site for detailed documentation.
- 🧪 In addition, have a look at the Integration Tests that show various library details.
F# syntax example
#r "nuget: FsHttp"
open FsHttp
http {
POST "https://reqres.in/api/users"
CacheControl "no-cache"
body
jsonSerialize
{|
name = "morpheus"
job = "leader"
|}
}
|> Request.send
C# syntax example
#r "nuget: FsHttp"
using FsHttp;
await Http
.Post("https://reqres.in/api/users")
.CacheControl("no-cache")
.Body()
.JsonSerialize(new
{
name = "morpheus",
job = "leader"
}
)
.SendAsync();
FSI / Non-FSI Scenarios
As this is a recurring issue:
FsHttp emits console logs per default. They can be disabled by putting this line before any request is made:
FsHttp.Fsi.disableDebugLogs ()
Release Notes / Migrating to new versions
- See https://www.nuget.org/packages/FsHttp#release-body-tab
- For different upgrade paths, please read the Migrations docs section.
Building
.Net SDK:
You need to have a recent .NET SDK installed, which is specified in ./global.json.
Build Tasks
There is a F# build script (./build.fsx) that can be used to perform several build tasks from command line.
For common tasks, there are bash scripts located in the repo root:
./test.sh: Runs all tests (sources in./src/Tests).- You can pass args to this task. E.g. for executing only some tests:
./test.sh --filter Name~'Response Decompression'
- You can pass args to this task. E.g. for executing only some tests:
./docu.sh: Rebuilds the FsHttp documentation site (sources in./src/docs)../docu-watch.sh: Run it if you are working on the documentation sources, and want to see the result in a browser../publish.sh: Publishes all packages (FsHttp and it's integration packages for Newtonsoft and FSharp.Data) to NuGet.- Always have a look at
./src/Directory.Build.propsand keep the file up-to-date.
- Always have a look at
Credits
- Parts of the code were taken from the HTTP utilities of FSharp.Data.
- Credits to all critics, supporters, contributors, promoters, users, and friends.
Downloads by Version
Similar & Alternative Packages
Hand-picked matching NuGet libraries based on tags & ecosystem
Depended On By
Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.