From 530458cfcd1ac37a3cfbf1e39b43c675257df773 Mon Sep 17 00:00:00 2001 From: trivernis Date: Thu, 17 Sep 2020 15:44:33 +0200 Subject: [PATCH] Return empty 204 on http OPTIONS method Signed-off-by: trivernis --- src/server/http_server.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/server/http_server.rs b/src/server/http_server.rs index 53ecd30..d3b8998 100644 --- a/src/server/http_server.rs +++ b/src/server/http_server.rs @@ -82,7 +82,11 @@ impl UserHttpServer { (POST) (/logout) => { Self::logout(&database, request).unwrap_or_else(HTTPError::into) }, - _ => Response::empty_404() + _ => if request.method() == "OPTIONS" { + Response::empty_204() + } else { + Response::empty_404() + } ); if dotenv::var(ENV_ENABLE_CORS).unwrap_or("false".to_string()) == "true" {