HttpClient MakeRequest deprecated - any similar function ?
tagopinath opened this issue · 3 comments
Describe the bug
Hello,
When i am trying to call MakeRequest from HttpClient, its showing the error like,
error C2027: use of undefined type 'Aws::Http::HttpClient'
note: see declaration of 'Aws::Http::HttpClient'
error C2039: 'MakeRequest': is not a member of 'std::shared_ptrAws::Http::HttpClient'
Here is the code i am using
std::shared_ptrAws::Http::HttpClient myclient = Aws::Http::CreateHttpClient(clientConfig);
Aws::Http::URI url("some path);
std::shared_ptrAws::Http::HttpRequest req(Aws::Http::CreateHttpRequest(url, Aws::Http::HttpMethod::HTTP_POST, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod));
std::shared_ptrAws::IOStream body = Aws::MakeSharedAws::StringStream(extParam.c_str());
req->AddContentBody(body);
std::shared_ptrAws::Http::HttpResponse res = myclient->MakeRequest(*req); // getting error here
Aws::Http::HttpResponseCode resCode = res->GetResponseCode();
Is there any other way to send request to retrieve the results ?
Regards,
Gopinath.
Expected Behavior
compile
Current Behavior
showing error
Reproduction Steps
no special steps
Possible Solution
No response
Additional Information/Context
No response
AWS CPP SDK version used
1.6.2
Compiler and Version used
visual studio 2015
Operating System and version
windows 10
Why are you trying to invoke the http client directly? This is most likely a anti pattern and you should not be doing this, but lets see if we can point you in the right direction.
Are you trying to make a http request to a non aws service?
if yes, you likely should be using the underlying http client to do such. if on windows as you mention you could use the win http client which the SDK uses under the hood. Alternatively you could install and use easy_curl/libcurl or curl for people
Are your trying to make a request to a aws service?
if yes, then why are you not using the higher level client?
depending one which category you fall in we can discuss what you should do next.
Thats aside
AWS CPP SDK version used
1.6.2
thats is a very old version and no more updates will be added to the 1.6 tag. if you dont update your version to HEAD you will be missing some very important changes. any reason you are not using HEAD? if you update your version the code you have mentioned in the ticket will work, although I would recommend against using the http client directly.
Thank you,
Will try with libcurl, that is enough for my task.
⚠️ COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.