inversify-express-utils
inversify-express-utils copied to clipboard
inversify-express-utils: BaseHttpController's conflict should take an argument
This is a feature request for inversify-express-utils. Controllers that extend BaseHttpController
have access to a this.conflict
method, but this method does not take any arguments. Using this.json
is an easy workaround, but I would still like this.conflict
to take an optional generic argument.
Expected Behavior
I would expect this.conflict
to take a generic argument that allows me to explain why the conflict occurred.
Current Behavior
I cannot provide an argument, so this.conflict
just returns a 409
code.
Context
Let's say I get a POST /users
request. It may conflict because (1) the provided username already exists or (2) the provided email already exists. The API should return which conflict actually occurred.