File tree Expand file tree Collapse file tree 4 files changed +117
-95
lines changed Expand file tree Collapse file tree 4 files changed +117
-95
lines changed Original file line number Diff line number Diff line change @@ -339,8 +339,9 @@ int main() {
339339
340340## How to ignore SSL certificate errors?
341341
342- If you need to ignore SSL certificate errors for any valid reason, you can continue working
343- by passing the ** "true"** value to the ** "ignoreSslErrors"** parameter at the end of the functions.
342+ If you need to ignore SSL certificate errors for any valid reason, you can continue
343+ working by passing ** "true"** value to the ** "ignoreSslErrors"** variable of the
344+ HttpClient class.
344345
345346``` cpp
346347#include < fstream>
@@ -351,10 +352,11 @@ using namespace lklibs;
351352int main () {
352353
353354 HttpClient httpClient;
355+
356+ // If you need to ignore SSL errors, you can set the "ignoreSslErrors" field to true
357+ httpClient.ignoreSslErrors = true;
354358
355- std::string payload = "param1=7¶m2=test";
356-
357- auto response = httpClient.postRequest("https://api.myinvalidssl.com", payload, true).get();
359+ auto response = httpClient.getRequest("https://api.myinvalidssl.com").get();
358360
359361 return 0;
360362}
Original file line number Diff line number Diff line change @@ -160,6 +160,20 @@ void simplePatch() {
160160 std::cout << " Data: " << response.textData << std::endl;
161161}
162162
163+ void ignoreSslErrors () {
164+
165+ HttpClient httpClient;
166+
167+ // If you need to ignore SSL errors, you can set the "ignoreSslErrors" field to true
168+ httpClient.ignoreSslErrors = true ;
169+
170+ auto response = httpClient.getRequest (" https://self-signed-cert.httpbun.com" ).get ();
171+
172+ std::cout << " Succeed: " << response.succeed << std::endl;
173+ std::cout << " Http Status Code: " << response.statusCode << std::endl;
174+ std::cout << " Data: " << response.textData << std::endl;
175+ }
176+
163177
164178int main () {
165179
@@ -183,5 +197,7 @@ int main() {
183197
184198 simplePatch ();
185199
200+ ignoreSslErrors ();
201+
186202 return 0 ;
187203}
You can’t perform that action at this time.
0 commit comments