HttpRequest.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright 1999-2019 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPREQUEST_H_
  17. #define CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPREQUEST_H_
  18. #include <string>
  19. #include "HttpMessage.h"
  20. #include "Url.h"
  21. namespace AlibabaCloud {
  22. class ALIBABACLOUD_CORE_EXPORT HttpRequest : public HttpMessage {
  23. public:
  24. enum Method {
  25. Get,
  26. Head,
  27. Post,
  28. Put,
  29. Delete,
  30. Connect,
  31. Options,
  32. Patch,
  33. Trace
  34. };
  35. explicit HttpRequest(const Url &url = Url(), Method method = Get);
  36. ~HttpRequest();
  37. Method method()const;
  38. void setMethod(Method method);
  39. void setUrl(const Url &url);
  40. Url url()const;
  41. long connectTimeout() const;
  42. long readTimeout() const;
  43. void setConnectTimeout(const long connectTimeout);
  44. void setReadTimeout(const long readTimeout);
  45. private:
  46. Method method_;
  47. Url url_;
  48. long connectTimeout_;
  49. long readTimeout_;
  50. };
  51. } // namespace AlibabaCloud
  52. #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPREQUEST_H_