Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When using builder.Services.AddProblemDetails();
error output like 400 will have a traceId
- which is useful.
{
"type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "00-9a91dea3f49537ea081001f1435df8f6-9a48ee11db3f47a3-00"
}
However when writing tests using WebApplicationFactory
the returned traceId
is out of my control or at least not straight forward to set to a known value.
Expected Behavior
traceId
and similar tracking ids should be fixed or easily configurable when testing via WebApplicationFactory.
Steps To Reproduce
- Spin up a asp net web api
- Add
builder.Services.AddProblemDetails();
- Make an endpoint return a bad request
- Write a test that checks the returned data
- Notice the traceId change
Exceptions (if any)
No response
.NET Version
9.0.202
Anything else?
The easy workaround is to ignore traceId
in the test. But that's not the point.