Return empty 204 on http OPTIONS method

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/2/head
trivernis 4 years ago
parent fb61f5ba66
commit 530458cfcd
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -82,7 +82,11 @@ impl UserHttpServer {
(POST) (/logout) => { (POST) (/logout) => {
Self::logout(&database, request).unwrap_or_else(HTTPError::into) 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" { if dotenv::var(ENV_ENABLE_CORS).unwrap_or("false".to_string()) == "true" {

Loading…
Cancel
Save