Skip to content

Commit

Permalink
replaced += by append and changed the order of strings to remove nece…
Browse files Browse the repository at this point in the history
…ssitity to substring at the the end.
  • Loading branch information
gittiver committed Jan 6, 2025
1 parent ccb1fa8 commit 6b33ffc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions include/crow/routing.h
Original file line number Diff line number Diff line change
Expand Up @@ -1574,7 +1574,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
}
else if (req.method == HTTPMethod::Options)
{
std::string allow = "OPTIONS, HEAD, ";
std::string allow = "OPTIONS, HEAD";

if (req.url == "/*")
{
Expand All @@ -1585,10 +1585,10 @@ namespace crow // NOTE: Already documented in "crow/app.h"

if (!per_methods_[i].trie.is_empty())
{
allow += method_name(static_cast<HTTPMethod>(i)) + ", ";
allow.append(", ");
allow.append(method_name(static_cast<HTTPMethod>(i)));
}
}
allow = allow.substr(0, allow.size() - 2);
res = response(204);
res.set_header("Allow", allow);
res.end();
Expand All @@ -1607,12 +1607,12 @@ namespace crow // NOTE: Already documented in "crow/app.h"
if (static_cast<int>(HTTPMethod::Head) == i)
continue; // HEAD is always allowed

allow += method_name(static_cast<HTTPMethod>(i)) + ", ";
allow.append(", ");
allow.append(method_name(static_cast<HTTPMethod>(i)));
}
}
if (rules_matched)
{
allow = allow.substr(0, allow.size() - 2);
res = response(204);
res.set_header("Allow", allow);
res.end();
Expand Down

0 comments on commit 6b33ffc

Please sign in to comment.