Unverified Commit 3a72456c authored by Igor [hyperxor]'s avatar Igor [hyperxor] Committed by GitHub

Remove redundant copy in Request API getter (#738)

parent e623e353
......@@ -160,7 +160,7 @@ public:
Request &operator=(Request &&other) = default;
Method method() const;
std::string resource() const;
const std::string &resource() const;
const Uri::Query &query() const;
......
......@@ -549,7 +549,7 @@ CookieJar &Message::cookies() { return cookies_; }
Method Request::method() const { return method_; }
std::string Request::resource() const { return resource_; }
const std::string &Request::resource() const { return resource_; }
const Uri::Query &Request::query() const { return query_; }
......
......@@ -33,7 +33,8 @@ struct FastEvenPagesHandler : public Http::Handler {
void onRequest(const Http::Request &request,
Http::ResponseWriter writer) override {
std::string page = request.resource().erase(0, 1);
std::string page = request.resource();
page.erase(0, 1);
int num = std::stoi(page);
if (num % 2 != 0) {
std::this_thread::sleep_for(std::chrono::milliseconds(2500));
......
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