Open apchenjun opened 3 years ago
I hope the same IdempotencyKey throws an error and I can return a custom formatted error message like this
Hi @apchenjun
This error happened with me too
In my case, i am using swagger to generate openapi documentation
It occurs by a validation of swagger filter..
In your method or controller class you must add a (ProducessAtributte("application/json"))
Hope that it can help you
Hello @apchenjun,
As @william-keller mentioned, the No output formatter was found for content types 'application/json; charset=utf-8, application/json; charset=utf-8' to write the response.
warning is shown when we have not defined the Consumes and Produces media type.
Can you try to define it at your controller? For example, see the following sample code:
[ApiController]
[Route("[controller]")]
[Consumes("application/json")]
[Produces("application/json")]
[Idempotent(Enabled = true)]
public class SimpleController : ControllerBase
{
// ...
}
In general, the concept of the library and Idempotency as described in the README file is to return the cached response (generated on the first try) in the subsequent requests (i.e., second, third, etc.) when using the same IdempotencyKey. That means that the actual code of the controller (action) will not be executed multiple times.
The first request can normally receive the returned custom format message The second request cannot receive the custom format message The second request with postman return 500 The first The second