diff --git a/include/crow/routing.h b/include/crow/routing.h index e19561332..02fd5d56c 100644 --- a/include/crow/routing.h +++ b/include/crow/routing.h @@ -1628,7 +1628,8 @@ namespace crow // NOTE: Already documented in "crow/app.h" } } allow = allow.substr(0, allow.size() - 2); - res = response(204); + /// TODO add switch between 200 and 204 + res = response(200); res.set_header("Allow", allow); res.end(); found->method = method_actual; @@ -1652,7 +1653,8 @@ namespace crow // NOTE: Already documented in "crow/app.h" if (rules_matched) { allow = allow.substr(0, allow.size() - 2); - res = response(204); + /// TODO add switch between 200 and 204 + res = response(200); res.set_header("Allow", allow); res.end(); found->method = method_actual; diff --git a/tests/unittest.cpp b/tests/unittest.cpp index e78a01384..2e75aa3a5 100644 --- a/tests/unittest.cpp +++ b/tests/unittest.cpp @@ -498,7 +498,10 @@ TEST_CASE("http_method") req.method = "OPTIONS"_method; app.handle_full(req, res); - CHECK(204 == res.code); + if ((204 == res.code) || (200==res.code)){ + } else { + CHECK(204 == res.code); + } CHECK("OPTIONS, HEAD, GET, POST" == res.get_header_value("Allow")); } @@ -521,7 +524,10 @@ TEST_CASE("http_method") req.method = "OPTIONS"_method; app.handle_full(req, res); - CHECK(204 == res.code); + if ((204 == res.code) || (200==res.code)){ + } else { + CHECK(204 == res.code); + } CHECK("OPTIONS, HEAD, GET, POST, PATCH, PURGE" == res.get_header_value("Allow")); } @@ -533,8 +539,11 @@ TEST_CASE("http_method") req.method = "OPTIONS"_method; app.handle_full(req, res); + if ((204 == res.code) || (200==res.code)){ + } else { CHECK(204 == res.code); - CHECK("OPTIONS, HEAD" == res.get_header_value("Allow")); + } + CHECK("OPTIONS, HEAD" == res.get_header_value("Allow")); } } // http_method