Use standard unauthorized response body
Updates the authorization middleware to use the standard response body
when providing a `401 Unauthorized` response.
@@ -206,7 +206,11 @@ where
AuthorizationResult::NoAuthorizationNecessary => {}
AuthorizationResult::Unauthorized => {
return Box::new(
- req.into_response(HttpResponse::Unauthorized().finish().into_body())
+ req.into_response(
+ HttpResponse::Unauthorized()
+ .json(ErrorResponse::unauthorized())
+ .into_body(),
+ )
.into_future(),
)
}
