From 3a2677cbe8e8fb8bf7925dc59e8386b34de1a624 Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Sun, 15 Sep 2019 16:49:21 +0200 Subject: [PATCH] fix: filters were applied on OPTIOBS --- filters/controllers_valid_json.cc | 6 ++++++ filters/json_required.cc | 5 +++++ filters/relays_valid_json.cc | 6 ++++++ filters/schedules_valid_json.cc | 6 ++++++ 4 files changed, 23 insertions(+) diff --git a/filters/controllers_valid_json.cc b/filters/controllers_valid_json.cc index fa44442..0553aa9 100644 --- a/filters/controllers_valid_json.cc +++ b/filters/controllers_valid_json.cc @@ -8,6 +8,12 @@ void valid_json::doFilter(const HttpRequestPtr &req, FilterCallback &&fcb, FilterChainCallback &&fccb) { + if(req->getMethod() == Options) + { + fccb(); + return; + } + Json::Value body = *req->jsonObject(); bool is_valid = true; diff --git a/filters/json_required.cc b/filters/json_required.cc index c384bb9..6b10bfc 100644 --- a/filters/json_required.cc +++ b/filters/json_required.cc @@ -7,6 +7,11 @@ void json_required::doFilter(const HttpRequestPtr &req, FilterCallback &&fcb, FilterChainCallback &&fccb) { + if(req->getMethod() == Options) + { + fccb(); + return; + } // TODO remove this workaround HttpMethod original_method = req->getMethod(); diff --git a/filters/relays_valid_json.cc b/filters/relays_valid_json.cc index 4c6d736..1d57b1f 100644 --- a/filters/relays_valid_json.cc +++ b/filters/relays_valid_json.cc @@ -8,6 +8,12 @@ void valid_json::doFilter(const HttpRequestPtr &req, FilterCallback &&fcb, FilterChainCallback &&fccb) { + if(req->getMethod() == Options) + { + fccb(); + return; + } + Json::Value body = *req->jsonObject(); bool is_valid = true; diff --git a/filters/schedules_valid_json.cc b/filters/schedules_valid_json.cc index 669d4ec..da49d03 100644 --- a/filters/schedules_valid_json.cc +++ b/filters/schedules_valid_json.cc @@ -7,6 +7,12 @@ void valid_json::doFilter(const HttpRequestPtr &req, FilterCallback &&fcb, FilterChainCallback &&fccb) { + if(req->getMethod() == Options) + { + fccb(); + return; + } + Json::Value body = *req->jsonObject(); bool is_valid = true;