|
@@ -84,9 +84,15 @@ struct HttpClientRequestConfig
|
|
|
/*
|
|
|
* Start with "http://" or "https://"
|
|
|
*/
|
|
|
- HttpClientRequestConfig(const std::string& uri) :mMethod(HttpRequestMethod::GET), mUri(uri) {}
|
|
|
- HttpClientRequestConfig(HttpRequestMethod method) : mMethod(method) {}
|
|
|
- HttpClientRequestConfig(HttpRequestMethod method, const std::string& uri) :mMethod(method), mUri(uri) {}
|
|
|
+ HttpClientRequestConfig(const std::string& uri) :mMethod(HttpRequestMethod::GET), mUri(uri), mToValidCert(false)
|
|
|
+ {
|
|
|
+ }
|
|
|
+ HttpClientRequestConfig(HttpRequestMethod method) : mMethod(method), mToValidCert(false)
|
|
|
+ {
|
|
|
+ }
|
|
|
+ HttpClientRequestConfig(HttpRequestMethod method, const std::string& uri) :mMethod(method), mUri(uri), mToValidCert(false)
|
|
|
+ {
|
|
|
+ }
|
|
|
|
|
|
void SetRequestType(HttpRequestMethod method) { mMethod = method; }
|
|
|
void SetUri(const std::string& uri) { mUri = uri; }
|
|
@@ -102,6 +108,8 @@ struct HttpClientRequestConfig
|
|
|
|
|
|
HttpRequestMethod GetType() const { return mMethod; }
|
|
|
|
|
|
+ bool NeedValidCert() const { return mToValidCert; }
|
|
|
+
|
|
|
private:
|
|
|
|
|
|
HttpRequestMethod mMethod;
|
|
@@ -109,12 +117,18 @@ private:
|
|
|
std::string mSubUri;
|
|
|
|
|
|
std::map<std::string, std::string> mQueryPairs;
|
|
|
+
|
|
|
+ bool mToValidCert;
|
|
|
};
|
|
|
|
|
|
struct HttpClientResponseResult
|
|
|
{
|
|
|
int statusCode;
|
|
|
std::string content;
|
|
|
+ /** 子类继承实现 */
|
|
|
+ virtual bool ConsiderAsSucc() const {
|
|
|
+ return (statusCode == 200);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
class RESTFULFUNC_API RestfulClient
|