Skip to content

Commit

Permalink
update unhandledexmw to set statuscode for apiexceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
halilkocaoz authored Sep 23, 2023
1 parent 6879d69 commit bc9e1a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cu.Yemekhane.API/Middlewares/UnhandledExceptionsMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public async Task Invoke(HttpContext context)
var message = $"Api exception: {exception.Message}.";

response.ErrorMessage = message;
context.Response.StatusCode = 200;
context.Response.StatusCode = 400;
context.Response.ContentType = "application/json";
await context.Response.WriteAsync(JsonConvert.SerializeObject(response));
}
Expand All @@ -36,4 +36,4 @@ public async Task Invoke(HttpContext context)
await context.Response.WriteAsync(JsonConvert.SerializeObject(response));
}
}
}
}

0 comments on commit bc9e1a4

Please sign in to comment.