diff --git a/include/crow/routing.h b/include/crow/routing.h index 26690a50a..546e59bb1 100644 --- a/include/crow/routing.h +++ b/include/crow/routing.h @@ -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 == "/*") { @@ -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(i)) + ", "; + allow.append(", "); + allow.append(method_name(static_cast(i))); } } - allow = allow.substr(0, allow.size() - 2); res = response(204); res.set_header("Allow", allow); res.end(); @@ -1607,12 +1607,12 @@ namespace crow // NOTE: Already documented in "crow/app.h" if (static_cast(HTTPMethod::Head) == i) continue; // HEAD is always allowed - allow += method_name(static_cast(i)) + ", "; + allow.append(", "); + allow.append(method_name(static_cast(i))); } } if (rules_matched) { - allow = allow.substr(0, allow.size() - 2); res = response(204); res.set_header("Allow", allow); res.end();