HttpRequest.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef HTTPREQUEST_H
  2. #define HTTPREQUEST_H
  3. #include <string>
  4. #include <vector>
  5. namespace Http {
  6. class HttpRequest
  7. {
  8. public:
  9. struct Method
  10. {
  11. enum type
  12. {
  13. GET,
  14. HEAD,
  15. POST,
  16. PUT,
  17. DELETE,
  18. CONNECT,
  19. TRACE,
  20. PATCH
  21. };
  22. };
  23. struct ReturnType
  24. {
  25. enum type
  26. {
  27. None,
  28. Code,
  29. Content,
  30. Redirect
  31. };
  32. };
  33. public:
  34. HttpRequest(const std::string url);
  35. ~HttpRequest();
  36. HttpRequest::Method::type Method() const;
  37. void Method(HttpRequest::Method::type method);
  38. HttpRequest::ReturnType::type ReturnType() const;
  39. void ReturnType(HttpRequest::ReturnType::type returnType);
  40. std::string URL() const;
  41. void URL(const std::string& url);
  42. std::vector<std::string> Headers() const;
  43. void Headers(const std::vector<std::string>& headers);
  44. std::string Data() const;
  45. void Data(const std::string& data);
  46. std::string CookieFile() const;
  47. void CookieFile(const std::string& cookieFile);
  48. std::string Filename() const;
  49. void Filename(const std::string& filename);
  50. std::string FileFieldname() const;
  51. void FileFieldname(const std::string& fileFieldname);
  52. private:
  53. HttpRequest::Method::type m_method;
  54. HttpRequest::ReturnType::type m_returnType;
  55. std::string m_url;
  56. std::vector<std::string> m_headers;
  57. std::string m_data;
  58. std::string m_cookieFile;
  59. std::string m_filename;
  60. std::string m_fileFieldname;
  61. };
  62. } // namespace Http
  63. #endif // HTTPREQUEST_H