Browse Source

include status code in body when invalid

master
Odilitime 5 years ago
parent
commit
fdcd33c2da
  1. 7
      src/WebResource.cpp

7
src/WebResource.cpp

@ -124,7 +124,7 @@ WebResource getOnlineWebResource(URL const& url, std::unique_ptr<std::map<std::s @@ -124,7 +124,7 @@ WebResource getOnlineWebResource(URL const& url, std::unique_ptr<std::map<std::s
} else if (response.statusCode != 200) {
returnRes.resourceType = ResourceType::INVALID;
returnRes.raw = "Unsupported status code";
returnRes.raw = "Unsupported status code: " + std::to_string(response.statusCode);
} else {
// TODO: Set resourceType based on Content-Type field.
std::string contentType = "";
@ -146,13 +146,16 @@ WebResource getOnlineWebResource(URL const& url, std::unique_ptr<std::map<std::s @@ -146,13 +146,16 @@ WebResource getOnlineWebResource(URL const& url, std::unique_ptr<std::map<std::s
}
};
//logDebug() << "Scheme: " << uri->scheme << std::endl;
if (uri->scheme == "https") {
HTTPSRequest secure(uri);
if (formData) {
secure.method = Method::POST;
}
//secure.version = Version::HTTP11;
secure.sendRequest(responseCallback, std::move(ptrPostBody));
//logDebug() << "sending request over SSL" << std::endl;
bool res = secure.sendRequest(responseCallback, std::move(ptrPostBody));
//logDebug() << "SSL result: " << res << std::endl;
} else {
HTTPRequest request(uri);
if (formData) {

Loading…
Cancel
Save