@@ -36,13 +36,16 @@ RESTClient::~RESTClient() {
36
36
/* *
37
37
* @brief Perform an HTTP GET request.
38
38
*/
39
- void RESTClient::get () {
39
+ long RESTClient::get () {
40
+ long response_code; // Added return response_code 2018_4_12
40
41
prepForCall ();
41
42
::curl_easy_setopt (m_curlHandle, CURLOPT_HTTPGET, 1 );
42
43
int rc = ::curl_easy_perform (m_curlHandle);
43
44
if (rc != CURLE_OK) {
44
45
ESP_LOGE (tag, " get(): %s" , getErrorMessage ().c_str ());
45
46
}
47
+ curl_easy_getinfo (m_curlHandle, CURLINFO_RESPONSE_CODE, &response_code); // Added return response_code 2018_4_12
48
+ return response_code; // Added return response_code 2018_4_12
46
49
} // get
47
50
48
51
@@ -52,13 +55,16 @@ void RESTClient::get() {
52
55
* @param [in] body The body of the payload to send with the post request.
53
56
*
54
57
*/
55
- void RESTClient::post (std::string body) {
58
+ long RESTClient::post (std::string body) {
59
+ long response_code; // Added return response_code 2018_4_12
56
60
prepForCall ();
57
61
::curl_easy_setopt (m_curlHandle, CURLOPT_POSTFIELDS, body.c_str());
58
62
int rc = ::curl_easy_perform (m_curlHandle);
59
63
if (rc != CURLE_OK) {
60
64
ESP_LOGE (tag, " post(): %s" , getErrorMessage ().c_str ());
61
65
}
66
+ curl_easy_getinfo (m_curlHandle, CURLINFO_RESPONSE_CODE, &response_code);// Added return response_code 2018_4_12
67
+ return response_code;// Added return response_code 2018_4_12
62
68
} // post
63
69
64
70
0 commit comments