Skip to content

feat: add IsJsonContent extensions#54

Merged
vbreuss merged 2 commits intomainfrom
topic/add-isjsoncontent
Jan 18, 2026
Merged

feat: add IsJsonContent extensions#54
vbreuss merged 2 commits intomainfrom
topic/add-isjsoncontent

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Jan 18, 2026

This PR introduces IsJsonContent extensions for parameter matching with Mockolate, enabling JSON HTTP content validation in mocked HTTP clients. The changes add comprehensive support for matching JSON bodies with various options including custom media types, additional property handling, and JSON document parsing options.

Key Changes:

  • Added IsJsonContent() extension methods for matching JSON HTTP content
  • Implemented JSON body comparison with support for objects, arrays, primitives, and nested structures
  • Added option to ignore additional properties when matching JSON content

@vbreuss vbreuss self-assigned this Jan 18, 2026
Copilot AI review requested due to automatic review settings January 18, 2026 20:57
@vbreuss vbreuss added the enhancement New feature or request label Jan 18, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces IsJsonContent extensions for parameter matching with Mockolate, enabling JSON HTTP content validation in mocked HTTP clients. The changes add comprehensive support for matching JSON bodies with various options including custom media types, additional property handling, and JSON document parsing options.

Changes:

  • Added IsJsonContent() extension methods for matching JSON HTTP content
  • Implemented JSON body comparison with support for objects, arrays, primitives, and nested structures
  • Added option to ignore additional properties when matching JSON content

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Tests/aweXpect.Mockolate.Tests/Web/ItExtensionsTests.cs Added test class container for new JSON content tests
Tests/aweXpect.Mockolate.Tests/Web/ItExtensionsTests.HttpContentTests.IsJsonContentTests.cs Comprehensive test coverage for JSON content matching including primitives, objects, arrays, and various options
Tests/aweXpect.Mockolate.Api.Tests/Expected/aweXpect.Mockolate_net8.0.txt Updated API surface with new AweXpectItExtensions types and methods for JSON content
Tests/aweXpect.Mockolate.Api.Tests/Expected/aweXpect.Mockolate_net10.0.txt Updated API surface with new AweXpectItExtensions types and methods for JSON content
Source/aweXpect.Mockolate/Web/ItExtensions.HttpContent.IsJsonContent.cs Core implementation of JSON content parameter matching with support for body comparison, media type validation, and property ignoring
Directory.Packages.props Updated aweXpect.Core dependency version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 18, 2026

Test Results

  8 files  ±  0    8 suites  ±0   4s ⏱️ -1s
139 tests + 46  138 ✅ + 46  1 💤 ±0  0 ❌ ±0 
903 runs  +276  902 ✅ +276  1 💤 ±0  0 ❌ ±0 

Results for commit bf0986a. ± Comparison against base commit 6ee6925.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 18, 2026

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.59GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.102
[Host] : .NET 10.0.2 (10.0.2, 10.0.225.61305), X64 RyuJIT x86-64-v3
DefaultJob : .NET 10.0.2 (10.0.2, 10.0.225.61305), X64 RyuJIT x86-64-v3

Method Mean Error StdDev Median Allocated
Dummy_aweXpect 0.0004 ns 0.0008 ns 0.0007 ns 0.0 ns -

@vbreuss vbreuss enabled auto-merge (squash) January 18, 2026 21:08
@sonarqubecloud
Copy link
Copy Markdown

@vbreuss vbreuss merged commit b618b17 into main Jan 18, 2026
12 checks passed
@vbreuss vbreuss deleted the topic/add-isjsoncontent branch January 18, 2026 21:11
@github-actions
Copy link
Copy Markdown

This is addressed in release v1.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants