Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(883)

Unified Diff: components/proximity_auth/cryptauth/cryptauth_api_call_flow.cc

Issue 789353003: Fix CryptAuthApiCallFlow resulting in an error if the server returns an empty string. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/proximity_auth/cryptauth/cryptauth_api_call_flow.cc
diff --git a/components/proximity_auth/cryptauth/cryptauth_api_call_flow.cc b/components/proximity_auth/cryptauth/cryptauth_api_call_flow.cc
index 399b949200f1d311b3c16332abe2716ad6a4c7d9..570075656674d1294236b7c71387fcf3fc90a950 100644
--- a/components/proximity_auth/cryptauth/cryptauth_api_call_flow.cc
+++ b/components/proximity_auth/cryptauth/cryptauth_api_call_flow.cc
@@ -11,7 +11,7 @@ namespace proximity_auth {
namespace {
-const char kNoResponseBodyError[] = "No response body";
+const char kResponseBodyError[] = "Failed to get response body";
const char kRequestFailedError[] = "Request failed";
const char kHttpStatusErrorPrefix[] = "HTTP status: ";
@@ -50,9 +50,8 @@ std::string CryptAuthApiCallFlow::CreateApiCallBodyContentType() {
void CryptAuthApiCallFlow::ProcessApiCallSuccess(
const net::URLFetcher* source) {
std::string serialized_response;
- if (!source->GetResponseAsString(&serialized_response) ||
- serialized_response.empty()) {
- error_callback_.Run(kNoResponseBodyError);
+ if (!source->GetResponseAsString(&serialized_response)) {
+ error_callback_.Run(kResponseBodyError);
return;
}
result_callback_.Run(serialized_response);

Powered by Google App Engine
This is Rietveld 408576698