fix: filters were applied on OPTIOBS

This commit is contained in:
Tobias Reisinger 2019-09-15 16:49:21 +02:00
parent 3aa0c514a5
commit 3a2677cbe8
4 changed files with 23 additions and 0 deletions

View file

@ -8,6 +8,12 @@ void valid_json::doFilter(const HttpRequestPtr &req,
FilterCallback &&fcb, FilterCallback &&fcb,
FilterChainCallback &&fccb) FilterChainCallback &&fccb)
{ {
if(req->getMethod() == Options)
{
fccb();
return;
}
Json::Value body = *req->jsonObject(); Json::Value body = *req->jsonObject();
bool is_valid = true; bool is_valid = true;

View file

@ -7,6 +7,11 @@ void json_required::doFilter(const HttpRequestPtr &req,
FilterCallback &&fcb, FilterCallback &&fcb,
FilterChainCallback &&fccb) FilterChainCallback &&fccb)
{ {
if(req->getMethod() == Options)
{
fccb();
return;
}
// TODO remove this workaround // TODO remove this workaround
HttpMethod original_method = req->getMethod(); HttpMethod original_method = req->getMethod();

View file

@ -8,6 +8,12 @@ void valid_json::doFilter(const HttpRequestPtr &req,
FilterCallback &&fcb, FilterCallback &&fcb,
FilterChainCallback &&fccb) FilterChainCallback &&fccb)
{ {
if(req->getMethod() == Options)
{
fccb();
return;
}
Json::Value body = *req->jsonObject(); Json::Value body = *req->jsonObject();
bool is_valid = true; bool is_valid = true;

View file

@ -7,6 +7,12 @@ void valid_json::doFilter(const HttpRequestPtr &req,
FilterCallback &&fcb, FilterCallback &&fcb,
FilterChainCallback &&fccb) FilterChainCallback &&fccb)
{ {
if(req->getMethod() == Options)
{
fccb();
return;
}
Json::Value body = *req->jsonObject(); Json::Value body = *req->jsonObject();
bool is_valid = true; bool is_valid = true;