I have this basic http_request performing correctly. I receive the 200 OK status code and respective body correctly, for all the times I perform a request (I even tried to perform several requests before leaving the application). The problem is that I always receive a SIGSEV before the application return with the message:
"Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)"
Any clue of what could be causing this?
#include <iostream>
#include <cpprest/http_client.h>
#include <thread>
main(){
const std::string URI = "https://192.168.13.141/v1/testing/stats/add";
//Defining configuration to accept self signed certificates
http_client_config config;
config.set_validate_certificates(false);
//Creating the client
http_client client(U(newURI),config);
//The auth token
const std::string token = "Bearer testToken";
const std::string authTag = "Authorization";
//Creating the request
http_request request;
request.headers().add(authTag,token);
request.set_method(methods::GET);
client.request(request).then([](http_response response) {
if(response.status_code() == status_codes::OK) {
std::cout << response.to_string() << std::endl;
}else{
std::cout << response.to_string() << std::endl;
}
}).wait();
return 0;
}