Disable authenthication for OPTIONS requests ()

This commit is contained in:
Quentin Le Sceller 2018-12-11 12:47:10 -05:00 committed by Ignotus Peverell
parent 3bb615a753
commit ec1713320b

View file

@ -39,6 +39,9 @@ impl Handler for BasicAuthMiddleware {
req: Request<Body>,
mut handlers: Box<dyn Iterator<Item = HandlerObj>>,
) -> ResponseFuture {
if req.method().as_str() == "OPTIONS" {
return handlers.next().unwrap().call(req, handlers);
}
if req.headers().contains_key(AUTHORIZATION)
&& verify_slices_are_equal(
req.headers()[AUTHORIZATION].as_bytes(),