From 2962142306673109d47e86be94d3584674c04c21 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Tue, 11 Sep 2018 18:05:42 -0400 Subject: [PATCH] force basic --- lib/src/middleware/require_auth.dart | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/src/middleware/require_auth.dart b/lib/src/middleware/require_auth.dart index bf286e95..98d97d9e 100644 --- a/lib/src/middleware/require_auth.dart +++ b/lib/src/middleware/require_auth.dart @@ -6,11 +6,8 @@ import 'package:angel_framework/angel_framework.dart'; RequestHandler forceBasicAuth({String realm}) { return (RequestContext req, ResponseContext res) async { if (req.container.has()) return true; - - res - ..statusCode = 401 - ..headers['www-authenticate'] = 'Basic realm="${realm ?? 'angel_auth'}"' - ..close(); + res.headers['www-authenticate'] = 'Basic realm="${realm ?? 'angel_auth'}"'; + throw new AngelHttpException.notAuthenticated(); }; }