jezzsantos / saastack

A comprehensive codebase template for starting your real-world, fully featured SaaS web products. On the .NET platform
The Unlicense
15 stars 5 forks source link

Post without body #37

Open jezzsantos opened 1 month ago

jezzsantos commented 1 month ago

If you POST a request with no body, we get this exception (500).

We should probably return something more helpful than a 500.

07:43:55 fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1] An unhandled exception has occurred while executing the request. System.ArgumentNullException: Value cannot be null. (Parameter 'request')    at MediatR.Mediator.Send[TResponse](IRequest`1 request, CancellationToken cancellationToken)    at ApiHost1.MinimalApiRegistration.<>c.<<RegisterRoutes>b__0_14>d.MoveNext() in C:\Projects\github\jezzsantos\saastack\src\ApiHost1\Tools.Generators.Web.Api\Tools.Generators.Web.Api.MinimalApiMediatRGenerator\MinimalApiMediatRGeneratedHandlers.g.cs:line 126 --- End of stack trace from previous location ---    at Microsoft.AspNetCore.Http.RequestDelegateFactory.<TaskOfTToValueTaskOfObject>g__ExecuteAwaited|92_0[T](Task`1 task)    at Infrastructure.Web.Api.Common.Endpoints.ContentNegotiationFilter.InvokeAsync(EndpointFilterInvocationContext context, EndpointFilterDelegate next) in C:\Projects\github\jezzsantos\saastack\src\Infrastructure.Web.Api.Common\Endpoints\ContentNegotiationFilter.cs:line 24    at Infrastructure.Web.Api.Common.Endpoints.RequestCorrelationFilter.InvokeAsync(EndpointFilterInvocationContext context, EndpointFilterDelegate next) in C:\Projects\github\jezzsantos\saastack\src\Infrastructure.Web.Api.Common\Endpoints\RequestCorrelationFilter.cs:line 32    at Infrastructure.Web.Api.Common.Endpoints.ApiUsageFilter.InvokeAsync(EndpointFilterInvocationContext context, EndpointFilterDelegate next) in C:\Projects\github\jezzsantos\saastack\src\Infrastructure.Web.Api.Common\Endpoints\ApiUsageFilter.cs:line 67    at Microsoft.AspNetCore.Http.RequestDelegateFactory.<ExecuteValueTaskOfObject>g__ExecuteAwaited|129_0(ValueTask`1 valueTask, HttpContext httpContext, JsonTypeInfo`1 jsonTypeInfo)    at Microsoft.AspNetCore.Http.RequestDelegateFactory.<>c__DisplayClass102_2.<<HandleRequestBodyAndCompileRequestDelegateForJson>b__2>d.MoveNext() --- End of stack trace from previous location ---    at Infrastructure.Web.Hosting.Common.Extensions.WebApplicationExtensions.<>c.<<EnableEventingPropagation>b__4_1>d.MoveNext() in C:\Projects\github\jezzsantos\saastack\src\Infrastructure.Web.Hosting.Common\Extensions\WebApplicationExtensions.cs:line 155 --- End of stack trace from previous location ---    at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)    at Infrastructure.Web.Hosting.Common.Pipeline.MultiTenancyMiddleware.InvokeAsync(HttpContext context, ITenancyContext tenancyContext, ICallerContextFactory callerContextFactory, ITenantDetective tenantDetective, IEndUsersService endUsersService, IOrganizationsService organizationsService) in C:\Projects\github\jezzsantos\saastack\src\Infrastructure.Web.Hosting.Common\Pipeline\MultiTenancyMiddleware.cs:line 52    at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)    at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)