Change the completionhandler to accept Res

These modifications are from WIP:Redfish:Query parameters:Only
(https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/47474). And they
will be used in Redfish:Query Parameters:Only.
(https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38952)
The code changed the completion handle to accept Res to be able to
recall handle with a new Response object.
AsyncResp owns a new res, so there is no need to pass in a res.

Tested:
1.Basic and Token auth both still work.
2.Use scripts/websocket_test.py to test websockets. It is still work
correctly.
python3 websocket_test.py --host 127.0.0.1:2443
This modification is a public part, so you can use any URL to test
this function. The response is the same as before.

Signed-off-by: zhanghaicheng <zhanghch05@inspur.com>
Change-Id: I570e32fb47a9a90fe111fcd1f4054060cd21def3
diff --git a/include/async_resp.hpp b/include/async_resp.hpp
index 8e9584c..7306017 100644
--- a/include/async_resp.hpp
+++ b/include/async_resp.hpp
@@ -15,28 +15,17 @@
 class AsyncResp
 {
   public:
-    AsyncResp(crow::Response& response) : res(response)
-    {}
-
-    AsyncResp(crow::Response& response, std::function<void()>&& function) :
-        res(response), func(std::move(function))
-    {}
+    AsyncResp() = default;
 
     AsyncResp(const AsyncResp&) = delete;
     AsyncResp(AsyncResp&&) = delete;
 
     ~AsyncResp()
     {
-        if (func && res.result() == boost::beast::http::status::ok)
-        {
-            func();
-        }
-
         res.end();
     }
 
-    crow::Response& res;
-    std::function<void()> func;
+    crow::Response res;
 };
 
 } // namespace bmcweb