FsHttp is a .Net HTTP client library for C# and F#. It aims for describing and executing HTTP requests in convenient ways that can be used in production and interactive environments.
FsHttp is authored by @ronaldschlenker. Feel free to leave a message.
Please see FsHttp Documentation site for a detailed documentation.
An example in F#:
#r "nuget: FsHttp"
open FsHttp
http {
POST "https://reqres.in/api/users"
CacheControl "no-cache"
body
jsonSerialize
{|
name = "morpheus"
job = "leader"
|}
}
|> Request.send
An example in C#:
#r "nuget: FsHttp"
using FsHttp.CSharp;
await "https://reqres.in/api/users".Post()
.CacheControl("no-cache")
.Body()
.JsonSerialize(new
{
name = "morpheus",
job = "leader"
}
)
.SendAsync();
For different upgrade paths, please read the Migrations section in the docu.
You need to have the latest .Net 5 SDK installed.
There is a F# script that can be used to perform several build tasks from command line. It can be executed in this way:
PS> dotnet fsi .\build.fsx [task]
Common tasks are:
- build
- test
- publish
The documentation in ./docs
is auto-generated from the files in ./src/Docu
. In order to build them, run:
PS> .\docu.ps1
Parts of the code is taken from the HTTP utilities of FSharp.Data.