skwas.MockHttp 3.0.1

.NET 5.0 .NET Standard 2.0 .NET Framework 4.6.2
There is a newer prerelease version of this package available.
See the version list below for details.
NuGet\Install-Package skwas.MockHttp -Version 3.0.1
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.
dotnet add package skwas.MockHttp --version 3.0.1
<PackageReference Include="skwas.MockHttp" Version="3.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add skwas.MockHttp --version 3.0.1
#r "nuget: skwas.MockHttp, 3.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install skwas.MockHttp as a Cake Addin
#addin nuget:?package=skwas.MockHttp&version=3.0.1

// Install skwas.MockHttp as a Cake Tool
#tool nuget:?package=skwas.MockHttp&version=3.0.1

.NET library to mock HTTP responses for HttpClient and verify request expectations with an experience inspired by Moq.

Documentation

Please see the wiki for documentation.

Usage example

MockHttpHandler mockHttp = new MockHttpHandler();

// Configure setup(s).
mockHttp
    .When(matching => matching
        .Method("GET")
        .RequestUri("http://localhost/controller/*")
    )
    .Respond(HttpStatusCode.OK)
    .Verifiable();

var client = new HttpClient(mockHttp);

var response = await client.GetAsync("http://localhost/controller/action?test=1");

// Verify the expectations.
mockHttp.Verify();

Contributions

Please check out the contribution guidelines.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on skwas.MockHttp:

Package Downloads
skwas.MockHttp.Json

JSON and MediaTypeFormatter extensions for skwas.MockHttp.

skwas.MockHttp.Server

.NET library to mock HTTP responses for any HTTP client and verify request expectations with an experience inspired by Moq.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.1.0-rc0002 111 7/15/2022
3.1.0-rc0001 402 7/9/2022
3.0.1 16,217 1/15/2022
3.0.0 1,580 12/24/2021
3.0.0-rc0002 78 12/24/2021
3.0.0-rc0001 238 11/22/2021
2.4.0 11,130 2/19/2021
2.3.0 4,013 11/28/2020
2.2.1 8,220 1/17/2020
2.2.0 622 1/13/2020
2.1.0 379 1/11/2020
2.0.8 1,227 11/13/2019
2.0.4 386 9/6/2019
2.0.0 3,085 9/4/2019
1.3.0 348 7/27/2019
1.2.0 391 7/7/2019
1.1.2 351 7/4/2019
1.1.0 348 7/4/2019
1.0.0 368 7/3/2019

v3.0.0
     - Added .NET 6.0 and .NET Framework 4.8/4.7.2/4.6.2 target framework support.
     - Removed .NET Standard < 2 and .NET Framework 4.5 support.