Commit 6f6e7871 authored by knowledge4igor's avatar knowledge4igor

Improve string usage

parent 60fbaa25
......@@ -271,7 +271,7 @@ public:
}
RequestBuilder& cookie(const Cookie& cookie);
RequestBuilder& body(std::string val);
RequestBuilder& body(const std::string& val);
RequestBuilder& timeout(std::chrono::milliseconds value);
......
......@@ -190,8 +190,8 @@ public:
friend class FragmentTreeNode;
friend class Router;
bool hasParam(std::string name) const;
TypedParam param(std::string name) const;
bool hasParam(const std::string& name) const;
TypedParam param(const std::string& name) const;
TypedParam splatAt(size_t index) const;
std::vector<TypedParam> splat() const;
......
......@@ -734,8 +734,8 @@ RequestBuilder::cookie(const Cookie& cookie) {
}
RequestBuilder&
RequestBuilder::body(std::string val) {
request_.body_ = std::move(val);
RequestBuilder::body(const std::string& val) {
request_.body_ = val;
return *this;
}
......
......@@ -23,7 +23,7 @@ Request::Request(
}
bool
Request::hasParam(std::string name) const {
Request::hasParam(const std::string& name) const {
auto it = std::find_if(params_.begin(), params_.end(), [&](const TypedParam& param) {
return param.name() == std::string_view(name.data(), name.length());
});
......@@ -32,7 +32,7 @@ Request::hasParam(std::string name) const {
}
TypedParam
Request::param(std::string name) const {
Request::param(const std::string& name) const {
auto it = std::find_if(params_.begin(), params_.end(), [&](const TypedParam& param) {
return param.name() == std::string_view(name.data(), name.length());
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment