PlainHttp 1.1.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package PlainHttp --version 1.1.2
NuGet\Install-Package PlainHttp -Version 1.1.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PlainHttp" Version="1.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PlainHttp --version 1.1.2
#r "nuget: PlainHttp, 1.1.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PlainHttp as a Cake Addin
#addin nuget:?package=PlainHttp&version=1.1.2

// Install PlainHttp as a Cake Tool
#tool nuget:?package=PlainHttp&version=1.1.2

PlainHttp NuGet License

An easy HTTP client for .NET Core 2.2 with support for serialization, proxies, testing, and more

Features

  • Wraps HttpClient and provides a cleaner and easier interface
  • Supports any HTTP method
  • Per-request timeout with a custom HttpRequestTimeoutException
  • Per-request proxy with transparent pooling
  • Automatic serialization of objects to JSON/XML/URL encoded
  • (no deserialization support)
  • Download a file to disk
  • Set a response encoding
  • Option to disable automatic reading of the response body
  • Automatically enabled decompression of GZIP and DEFLATE responses
  • Allows to mock requests for unit testing
  • Heavily used in production by @botfactoryit to send 4 million requests per day

Why .NET Core 2.2

This library targets .NET Core 2.2 because it requires the PooledConnectionLifetime property on HttpMessageHandler, introduced in .NET Core 2.2. This makes sure that reusing the same HttpClient for a long time doesn't have unintended consequences affecting DNS resolution. This library in fact keeps a pool of HttpClient instances that are never disposed.

In particular, the library keeps:

  • One HttpClient per request host
  • One HttpClient per proxy

There is currently no mechanism that disposes HttpClient instances that are unused, so if you use a lot of random proxies or many different hostnames, you might get into trouble. This can be easily improved by creating a custom IHttpClientFactory, and then passing the factory to each request through the HttpClientFactory property.

Usage

Full usage instructions are available on GitHub.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.2 is compatible.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 641 1/24/2024
2.0.0-pre3 70 1/24/2024
2.0.0-pre2 296 11/21/2023
2.0.0-pre1 215 10/28/2023
1.3.0 1,524 8/1/2022
1.2.0 1,309 11/27/2020
1.1.2 760 6/24/2020
1.1.1 407 6/19/2020
1.1.0 420 6/18/2020
1.0.3 892 12/12/2019
1.0.2 520 12/4/2019
1.0.1 750 10/3/2019
1.0.0 901 8/16/2019