https://github.com/fsprojects/fshttp
HTTP library for F#
https://github.com/fsprojects/fshttp
fsharp http http-client rest rest-client
Last synced: 23 days ago
JSON representation
HTTP library for F#
- Host: GitHub
- URL: https://github.com/fsprojects/fshttp
- Owner: fsprojects
- License: apache-2.0
- Created: 2018-08-22T18:53:00.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-05-05T08:03:51.000Z (12 months ago)
- Last Synced: 2025-05-05T08:39:30.186Z (12 months ago)
- Topics: fsharp, http, http-client, rest, rest-client
- Language: F#
- Homepage: https://fsprojects.github.io/FsHttp/
- Size: 3.68 MB
- Stars: 469
- Watchers: 14
- Forks: 43
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**Support my Work**
Buy a **PXL Clock** and help me create more videos like this!
Use code **RONALD** for a **25โฌ discount**:
[https://www.pxlclock.com/?ref=RONALD](https://www.pxlclock.com/?ref=RONALD)
PXL Clock is a fun device, made with โค๏ธ - and it's programmable in an easy and quick way.
Find out more:
- On the [PXL Clock Discord Server](https://discord.gg/KDbVdKQh5j)
- check out the [PXL Clock Repo on GitHub](https://github.com/CuminAndPotato/PXL-Clock)
- Visit the official [PXL Clock Store](https://www.pxlclock.com/?ref=RONALD)
Join the PXL Clock Community on Discord
---
# FsHttp
[](https://github.com/schlenkr/FsHttp/actions/workflows/build-and-test.yml)
[](https://www.nuget.org/packages/FsHttp)
[](https://www.nuget.org/packages/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 `.http` files, *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
---
## Documentation
* ๐ Please see [FsHttp Documentation](https://fsprojects.github.io/FsHttp) site for detailed documentation.
* ๐งช In addition, have a look at the [Integration Tests](https://github.com/schlenkr/FsHttp/tree/master/src/Tests) that show various library details.
### F# syntax example
```fsharp
#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
```csharp
#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:
```fsharp
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](https://schlenkr.github.io/FsHttp/Release_Notes.html).
## 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'`
* `./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.props` and keep the file up-to-date.
## Credits
* Parts of the code were taken from the [HTTP utilities of FSharp.Data](https://fsprojects.github.io/FSharp.Data/library/Http.html).
* Credits to all critics, supporters, contributors, promoters, users, and friends.