stevejgordon / CorrelationId

An ASP.NET Core middleware component which synchronises a correlation ID for cross API request logging.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Customisable response when EnforceHeader is set

colin-sim opened this issue · comments

When EnforceHeader is set to true a 400 is returned with a plaintext explanation, when a correlation ID is not provided.

Could this be changed so that ProblemDetails is returned instead to be consistent with default ApiController behaviour. Alternatively, provide an option to throw an exception instead, that way, anyone implementing a catch-all handler can wrap the error in a ProblemDetails response.

it will be useful when it will be possible to set up some response factory on EnforceHeader executed. I believe it's also can be done with full backward compatibility
cc @stevejgordon