MinimalApi vs Mvc - ValidationOfHeaders
I have been playing around with MinimalApi, and was surprised to see that MinimalApi could not handle validating Required HttpHeaders in the same way that MvcControllers can:
MinimalApi Code
Mvc Code
The Mvc Examples returns a ValidationProblemDetails-based error if TraceId while MinimalApi just retuns 400.
Does anyone know, how I can get MinimalApi to validate headers and send a meaningful error back (hopefully a ValidationProblemDetails).
6 Replies
The Error from Mvc Looks like this for both Environment set to Development and Production
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1238215805900947590/image.png)
The Error from MinimalApi Looks like this for Environment set to Development
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1238216130653323304/image.png)
The Error from MinimalApi Looks like this for Environment set to Production
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1238216430504382616/image.png)
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1238216430915158016/image.png)