Change response status from a mapper
GeReinhart opened this issue · comments
Gérald Reinhart commented
This code do not return a 404. The response is lost : the client never get the response back... I'm using redstone 0.5.20
@app.Group("/services")
@Encode()
class UserService extends MongoDbService<User> {
UserService() : super("users");
@app.Route("/login/:openId", methods: const [app.POST])
Future<User> login(@Decode() User user) {
return findOne({"openId": user.openId}).then((user) {
if (user == null) {
throw new app.ErrorResponse(404, {"error": "no user with openId ${user.openId}"});
}
...
Is there another way to do it ?
Gérald Reinhart commented
Just upgraded to redstone 0.5.21 and it's working fine.