• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

AKlaus / DomainResult / 44684916576
87%

Build:
DEFAULT BRANCH: master
Ran 20 Nov 2026 06:02AM UTC
Jobs 1
Files 22
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

20 Nov 2026 06:01AM UTC coverage: 84.615% (+0.1%) from 84.507%
44684916576

push

github

web-flow
Mvc: Return 200 OK for a success with a default value (#104)

### Why

A success with a value converted to `204 No Content` when the value equalled `default(T)`. The client lost a valid value, such as `0`, `false` or `Guid.Empty`. A custom conversion was skipped too, so `Success(0).ToCustomResult(...)` never returned its `201 Created`.

### What changed

- **Mvc** — for a result with a value, only the 200 OK conversions return 204, and only for a `null` value
- **Mvc** — a custom conversion runs for every success, a `null` value included
- **Tests** — `0` rows in the 200 OK theories, `0` and `null` rows in the custom-conversion theories, and `null` cases in the 204 tests
- **README** — the `Success` status row and the custom-response section describe both rules
- **Samples** — a default value, a `null` value, and a `null`-aware custom conversion, in both sample apps

A `null` value still converts to 204 for the 200 OK conversions. On the controller side, ASP.NET Core already sends 204 for a `null` body. Keeping it gives the same response for minimal APIs. A custom conversion receives the `null` value. `ValueToActionResultFunc` and `ValueToResultFunc` mark the value `[AllowNull]`, but the `Func<V, ActionResult<V>>` of `ToCustomActionResultOfT` does not.

#94 lists `0`, `false` and `Guid.Empty` as test rows. The tests keep only `0`, because all three take one branch.

### Changes at a glance

No tangible change that `scope` detects.

**Areas**: `samples`, `src`, `tests`

**Behaviour** (not seen by `scope`)

> **Breaking**: a success with a non-null default value, such as `0`, `false` or `Guid.Empty`, now converts to `200 OK` with the value, or calls the custom conversion. Before, it converted to `204 No Content`. This applies to `ToActionResult`, `ToActionResultOfT`, `ToResult`, `ToCustomActionResult`, `ToCustomActionResultOfT` and `ToCustomResult`, for `IDomainResult<T>` and `(T, IDomainResult)`.

> **Breaking**: for a `null` value, `ToCustomActionResu... (continued)

84 of 106 branches covered (79.25%)

Branch coverage included in aggregate %.

18 of 18 new or added lines in 6 files covered. (100.0%)

3 existing lines in 3 files now uncovered.

334 of 388 relevant lines covered (86.08%)

27.92 hits per line

Coverage Regressions

Lines Coverage ∆ File
1
91.67
-0.83% src/Mvc/ActionResult/DomainResultToActionResult.cs
1
30.0
-7.5% src/Mvc/ActionResult/DomainResultToActionResultOfT.cs
1
91.67
-0.83% src/Mvc/IResult/DomainResultToResult.cs
Jobs
ID Job ID Ran Files Coverage
1 44684916576.1 20 Nov 2026 06:02AM UTC 22
84.62
GitHub Action Run
Source Files on build 44684916576
  • Tree
  • List 22
  • Changed 6
  • Source Changed 0
  • Coverage Changed 6
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • c53c4a73 on github
  • Prev Build on master (#44662408505)
  • Next Build on master (#44690077893)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc