FsHttp 15.0.1
dotnet add package FsHttp --version 15.0.1
NuGet\Install-Package FsHttp -Version 15.0.1
<PackageReference Include="FsHttp" Version="15.0.1" />
paket add FsHttp --version 15.0.1
#r "nuget: FsHttp, 15.0.1"
// Install FsHttp as a Cake Addin #addin nuget:?package=FsHttp&version=15.0.1 // Install FsHttp as a Cake Tool #tool nuget:?package=FsHttp&version=15.0.1
<div align="center"> <h2>๐ <strong>Win a PXL-Clock - Watch How on YouTube</strong> ๐</h2> <a href="https://youtu.be/q5-QTpEMGdU"><img src="https://img.youtube.com/vi/q5-QTpEMGdU/0.jpg" alt="Watch the PXL-JAM video" style="width: 60%;"></a> <p>YouTube</p> </div>
The PXL PAM 2024 is a fun and engaging way to come together and have a joyful time! Watch the video or check out our PXL-JAM repo!
FsHttp
<img align="right" width="200" alt='logo' src='https://raw.githubusercontent.com/schlenkr/FsHttp/master/docs/img/logo_big.png' />
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 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();
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.props
and 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.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- FSharp.Core (>= 5.0.2)
NuGet packages (13)
Showing the top 5 NuGet packages that depend on FsHttp:
Package | Downloads |
---|---|
Functional.SplinterBots.API
Package Description |
|
FsHttp.FSharpData
FSharp.Data (JSON) integration package for FsHttp |
|
FsHttp.NewtonsoftJson
JSON.Net (Newtonsoft.Json) integration package for FsHttp |
|
Swate.Api
Dotnet library for easy access to Swate API. |
|
AVPRIndex
Type system and utils for the indexing backend of avpr.nfdi4plants.org |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
15.0.1 | 3,331 | 12/3/2024 |
14.5.2 | 137 | 12/3/2024 |
14.5.1 | 110,048 | 8/9/2024 |
14.5.0 | 157,454 | 3/5/2024 |
14.4.2 | 312 | 3/5/2024 |
14.4.1 | 73,146 | 2/5/2024 |
14.4.0 | 79,186 | 1/7/2024 |
14.2.0 | 837 | 1/5/2024 |
14.1.0 | 792 | 1/3/2024 |
14.0.0 | 633 | 1/2/2024 |
13.3.0 | 13,020 | 12/28/2023 |
13.2.0 | 617 | 12/28/2023 |
12.2.0-preview01 | 654 | 12/24/2023 |
12.1.0 | 2,894 | 11/27/2023 |
12.0.0 | 51,688 | 10/31/2023 |
11.0.0 | 49,947 | 8/5/2023 |
11.0.0-preview01 | 1,284 | 3/25/2023 |
10.0.0 | 196,543 | 11/25/2022 |
10.0.0-preview3 | 905 | 11/23/2022 |
10.0.0-preview2 | 1,121 | 11/12/2022 |
10.0.0-preview1 | 935 | 11/12/2022 |
9.1.2 | 32,425 | 6/5/2022 |
9.1.1 | 3,584 | 4/24/2022 |
9.1.0 | 1,740 | 4/19/2022 |
9.0.6 | 1,782 | 4/19/2022 |
9.0.5 | 1,787 | 4/14/2022 |
9.0.4 | 1,539 | 4/8/2022 |
9.0.3 | 1,424 | 4/8/2022 |
9.0.2 | 3,873 | 4/6/2022 |
9.0.1 | 1,342 | 4/5/2022 |
9.0.0 | 13,858 | 4/5/2022 |
8.0.1 | 8,426 | 3/6/2022 |
8.0.0 | 1,189 | 3/2/2022 |
7.0.0 | 42,040 | 12/13/2021 |
6.0.1 | 2,371 | 11/23/2021 |
6.0.0 | 1,019 | 11/22/2021 |
0.9.0 | 1,951 | 7/14/2019 |
**************************************************************
+---------+
| | PXL-JAM 2024
| PXL | - github.com/CuminAndPotato/PXL-JAM
| CLOCK | - WIN a PXL-Clock MK1
| | - until 8th of January 2025
+---------+
**************************************************************
15.0.1
- Added PXK-Clock Promo Message on first FSI evaluation (when logs are enabled)
15.0.0
- Added 'enumerable' and 'enumerablePart' as body content functions
- Removed Utf8StringBufferingStream
14.5.1
- Fixed untracked bug: using config_useBaseUrl as http template won't crash when printing unfinished requests
14.5.0
- Added 'useBaseUrl' and 'transformUrl' to Config for better composability
- Fixed some extension methods
14.4.2
- Thanks @bartelink
Pinned FSharp.Core to 5.0.2 in all library projects
Removed net7.0, net8.0 TFM-specific builds
Lots of other cool stability-oriented stuff and detail-work
14.4.1
- Fixed missing explicit dependency on FSharp.Core
14.4.0
- Fixed pre-configured requests
14.3.0
- Added `GetList` JsonElement extension
14.2.0
- (Breaking change) Separated Config and PrintHint (...and many more things in these domains)
14.1.0
- (Breaking change) Renamed `Extensions.To...Enumerable` to `Extensions.To...Seq`
- Added `toJsonList...` overloads
14.0.0
- (Breaking change) Renamed types in Domain:
BodyContent -> SinglepartContent
RequestContent -> BodyContent
FsHttpUrl -> FsHttpTarget
- (Breaking change) FsHttpUrl (now FsHttpTarget) and Header restructured: method, address and queryParams are now part of the FsHttpTarget type.
- Added `headerTransformers` to Config for better composability
13.3.0
- (Breaking change) All `Response._TAsync` functions (task based) in F# require a CancellationToken now.
- (Breaking change) Extension methods rework
- (Breaking change) There's no more StartingContext, which means:
we give up a little bit of safety here, for the sake of pre-configuring HTTP requests
without specifying the URL. This is a trade-off we are willing to take.
12.2.0
- added HttpMethods for better composability
12.1.0
- net8.0
12.0.0
- #137 / #102: Change the type for FsHttpUrl.additionalQueryParams from obj to string
- Removed (auto opened) Async.await and Task.map/await
- Moved (auto opened) Async.map to FsHttp.Helper.Async.map
11.1.0
- #130 / #105: Add method for user-supplied cancellation token
11.0.0
- #121 (Breaking change): Turning off debug logs in FSI (breaking change in signature / namespace)
- #124: Support Repeating Query Parameters (thanks @DaveJohnson8080)
- #106 (Breaking change): Allow filename metadata with other "parts" (thanks @dawedawe)
- Breaking change: ContentTypeForPart custom operations should come after part definition
- #104 (Breaking change): Automatic GZip response decompression per Default
- Other breaking changes:
- Removed `ContentTypeWithEncoding` and used optional `charset` parameter in `ContentType` overloads.
- Renamed `byteArray` to `binary` in Dsl, DslCE and CSharp.
- Caution (!!): Renamed `stringPart` to `textPart` and changed argument order for `name` and `value` in Dsl and DslCE.
- Restructured types in Domain
- `Helper` is a module instead of a namespace, and some things were moved.
- All transformers in config are a list of transformers instead of a single item.
- Removed `setHttpClient`. Please use `setHttpClientFactory` instead.
- `setHttpClientFactory` takes a `Config` as input argument.
-----------------------------
-- Old release notes below --
-----------------------------
7.0.0
- #92: `expect` and `assert` pass through the original response instead of unit.
8.0.0
- #93 (thanks @drhumlen): Changed content type 'text/json' to 'application/json'.
- Http modules are always AutoOpen in both Dsl and DslCE.
- No extra modules for builder methods.
8.0.1
- #89: No more blocking requests using net5 with FSI.
9.0.0 / 9.0.1
- Redefined builders (see README.md).
- Many breaking changes (see "Migrations" sections in the docu).
9.0.2
- Added JSON toArray functions
- Fixed #99: Response.saveFile should create the directory if not present.
9.0.3
- Supporting netstandard2.1 again.
9.0.4
- Referenced lowest possible FSharp.Core and other referenced packages version.
9.0.5
- Support for netstandard2.0.
- New 'FsHttp.NewtonsoftJson' integration package.
- More JSON functions and defaults config.
9.0.6
- #100 - Removed FSI print messages.
9.1.0
- Fixed naming inconsistency for 'Response.deserialize...' functions.
- More C# JSON functions.
9.1.1
- Fix: Using GlobalConfig.Json.defaultJsonSerializerOptions as default for jsonSerialize.
9.1.2
- Fixed #103: FSI response printing and initialization doesn't work out of the box anymore.
10.0.0
- .Net 7 support (thank you @Samuel-Dufour)
- Breaking change: Corrected typo "guessMineTypeFromPath" -> "guessMimeTypeFromPath"
- Breaking change: Module 'Helper', 'HelperInternal' and 'HelperAutos' refactored
- #115: Remove print messages when downloading streams
- Printing: Separate print functions for response and request via Request.print and Response.print
- Printing: Default request (IToRequest) printing in FSI
- Removed net5.0 targets in all projects
- PrintHint.printDebugMessages: Moved to FsHttp.Helper.Fsi.logDebugMessages as a global switch
- #113 - Config.timeoutInSeconds bug
10.1.0
- #117: Escape string for query params values (by @maciej-izak - thank you)
(!!) This can be seen as breaking change.
- #112: Allow to add (multiple) headers (by @Samuel-Dufour - thank you)