Log to info when Fairing's `on_response` changes

the status code of a 404 OPTIONS

Fixes #20
This commit is contained in:
Yong Wen Chua 2017-07-24 13:55:35 +08:00
parent 92d7775b93
commit 8eb782a7ca
1 changed files with 4 additions and 0 deletions

View File

@ -105,6 +105,10 @@ fn on_response_wrapper(
if request.method() == http::Method::Options && request.method() == http::Method::Options &&
request.route().is_none()
{
info_!(
"CORS Fairing: Turned missing route {} into an OPTIONS pre-flight request",
request
);
response.set_status(Status::NoContent);
let _ = response.take_body();
}