Header menu logo FsHttp

FsHttp

Build & Tests NuGet NuGet Downloads

logo

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.

👍 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 :)

image

Find out more info on the PXL-Clock Discord Server or check out the PXL-Clock Repo on GitHub.

Join the PXL-Clock Community on Discord

Join Our Discord


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 bash scripts located in the repo root:

Credits

namespace FsHttp
Multiple items
static member HttpBuilder.http: HeaderContext

--------------------
property HttpBuilder.http: HeaderContext with get
custom operation: POST (string) Calls IRequestContext.Post
custom operation: CacheControl (string) Calls IRequestContext.CacheControl
<summary> Used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain </summary>
custom operation: body Calls IRequestContext.Body
<summary> An explicit transformation from a previous context to allow for describing the request body. </summary>
custom operation: jsonSerialize ('a) Calls IRequestContext.JsonSerialize
Multiple items
module Request from FsHttp.Print

--------------------
module Request from FsHttp

--------------------
type Request = { header: Header content: BodyContent config: Config printHint: PrintHint }
val send: request: IToRequest -> Response
<summary> Sends a request synchronously. </summary>

Type something to start searching.