MockHttp is a testing layer for Microsoft's HttpClient library. It allows stubbed responses to be configured for matched HTTP requests and can be used to test your application's service layer. MockHttp defines a replacement HttpMessageHandler, the engine that drives HttpClient, that provides a fluent configuration API and provides a canned response. The caller (eg. your application's service layer) remains unaware of its presence. MockHttpMessageHandler defines both When and Expect, which can be used to define responses. They both expose the same fluent API, but each works in a slightly different way. Using When specifies a "Backend Definition". Backend Definitions can be matched against multiple times and in any order, but they won't match if there are any outstanding Request Expectations present (unless BackendDefinitionBehavior.Always is specified).

Features

  • The Fallback property handles all requests that weren't handled by the match behavior
  • MockHttp is compiled for .NET Standard 2.0, .NET Standard 1.1, .NET 4, and .NET 4.5, as well a Portable Class Library (Profile 328)
  • License under the MIT license
  • MockHttpMessageHandler defines both When and Expect, which can be used to define responses
  • MockHttp defines a replacement HttpMessageHandler
  • MockHttp is a testing layer for Microsoft's HttpClient library

Project Samples

Project Activity

See All Activity >

Categories

Frameworks

License

MIT License

Follow MockHttp for HttpClient

MockHttp for HttpClient Web Site

Other Useful Business Software
AI-powered service management for IT and enterprise teams Icon
AI-powered service management for IT and enterprise teams

Enterprise-grade ITSM, for every business

Give your IT, operations, and business teams the ability to deliver exceptional services—without the complexity. Maximize operational efficiency with refreshingly simple, AI-powered Freshservice.
Try it Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of MockHttp for HttpClient!

Additional Project Details

Operating Systems

Android, Apple iPhone, Windows

Programming Language

C#

Related Categories

C# Frameworks

Registered

2022-09-19