fsprojects / FsHttp

A lightweight F# HTTP library by @SchlenkR and @dawedawe
https://fsprojects.github.io/FsHttp/
Apache License 2.0
424 stars 42 forks source link
fsharp http http-client rest rest-client

FsHttp Build & Tests NuGet Badge

logo

FsHttp ("Full Stack HTTP") 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.

๐Ÿ‘ Postman? โค๏ธ FsHttp! https://youtu.be/F508wQu7ET0

Developed and maintained by @SchlenkR and @dawedawe. Feel free to leave us a message.

Documentation

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();

Release Notes / Migrating to new versions

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 powershell files located in the repo root:

Credits