httpclient.h 677 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. #include "sol/sol.hpp"
  3. #include "net/http_client_plus.h"
  4. namespace module
  5. {
  6. class httpclient
  7. {
  8. public:
  9. httpclient();
  10. ~httpclient();
  11. void set_timeout(uint32 connect_msec = 3000, uint32 recv_msec = 8000);
  12. bool get(const std::string& url);
  13. bool post(const std::string& url,const std::string& body);
  14. void request_header(const std::string& name,const std::string& value);
  15. std::string response_header(const std::string& name);
  16. std::string response();
  17. ushort status();
  18. static void regist(sol::state* lua);
  19. private:
  20. network::http::client_plus m_client;
  21. };
  22. }