inversify-express-utils icon indicating copy to clipboard operation
inversify-express-utils copied to clipboard

inversify-express-utils: BaseHttpController's conflict should take an argument

Open tgiardina opened this issue 4 years ago • 0 comments

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.

tgiardina avatar Aug 06 '20 17:08 tgiardina