Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Handlers/ResultResponseWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public ResultResponseWriter(
string contentType,
ISerializer serializer,
Func<T, string> locationBuilder = null)

Check warning on line 21 in src/Handlers/ResultResponseWriter.cs

View workflow job for this annotation

GitHub Actions / build-and-publish

Cannot convert null literal to non-nullable reference type.

Check warning on line 21 in src/Handlers/ResultResponseWriter.cs

View workflow job for this annotation

GitHub Actions / build-and-publish

Cannot convert null literal to non-nullable reference type.
{
this.contentType = contentType;
this.serializer = serializer;
Expand Down Expand Up @@ -48,6 +48,13 @@
cancellationToken);
break;

case ForbiddenResult<T> r:
res.StatusCode = 403;
await res.WriteAsync(
this.SerializeOptional(r.Message, r.Body),
cancellationToken);
break;

case NotFoundResult<T> _:
res.StatusCode = 404;
break;
Expand Down
6 changes: 3 additions & 3 deletions src/Linn.Common.Service.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>.NET utilities for consistent API and service responses. Provides standard result types (e.g., SuccessResult, BadRequestResult, NotFoundResult) and helpers for generating HTTP responses with correct status codes and serialized content.</Description>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>Linn.Common.Service</AssemblyName>
<PackageId>Linn.Common.Service</PackageId>
<Version>3.0.0</Version>
<Version>3.1.0</Version>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Linn.Common.Configuration" Version="3.0.0" />
<PackageReference Include="Linn.Common.Facade" Version="13.1.0" />
<PackageReference Include="Linn.Common.Facade" Version="13.5.0" />
<PackageReference Include="Linn.Common.Rendering" Version="1.0.0" />
<PackageReference Include="Linn.Common.Reporting.Resources" Version="1.7.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
Expand Down
2 changes: 1 addition & 1 deletion tests/Linn.Common.Service.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.10.0" />
<PackageReference Include="Linn.Common.Facade" Version="13.1.0" />
<PackageReference Include="Linn.Common.Facade" Version="13.5.0" />
<PackageReference Include="Linn.Common.Rendering" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="7.0.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
Expand Down
Loading