Fixed headers parsing in CurlHttpClient

1. substr(pos, pos_end) was used instead of substr(pos, pos_end - pos)
2. CURLOPT_HEADERFUNCTION is called for single header so no need to
   merge and split them later

Change-Id: Iad852212258f870c2fe0683b0021ae99a020d12b
Reviewed-on: https://weave-review.googlesource.com/1562
Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/src/device_registration_info.cc b/src/device_registration_info.cc
index d2b10a9..8b8e752 100644
--- a/src/device_registration_info.cc
+++ b/src/device_registration_info.cc
@@ -201,9 +201,9 @@
       SplitAtFirst(response.GetContentType(), ";", true).first;
 
   if (content_type != http::kJson && content_type != http::kPlain) {
-    Error::AddTo(error, FROM_HERE, errors::json::kDomain,
-                 "non_json_content_type",
-                 "Unexpected response content type: " + content_type);
+    Error::AddTo(
+        error, FROM_HERE, errors::json::kDomain, "non_json_content_type",
+        "Unexpected content type: \'" + response.GetContentType() + "\'");
     return std::unique_ptr<base::DictionaryValue>();
   }
 
diff --git a/src/device_registration_info_unittest.cc b/src/device_registration_info_unittest.cc
index 9edd396..8174b90 100644
--- a/src/device_registration_info_unittest.cc
+++ b/src/device_registration_info_unittest.cc
@@ -222,10 +222,9 @@
   url += "client_id=";
   url += test_data::kClientId;
   EXPECT_EQ(url, dev_reg_->GetOAuthURL(
-                     "auth",
-                     {{"redirect_uri", "urn:ietf:wg:oauth:2.0:oob"},
-                      {"response_type", "code"},
-                      {"client_id", test_data::kClientId}}));
+                     "auth", {{"redirect_uri", "urn:ietf:wg:oauth:2.0:oob"},
+                              {"response_type", "code"},
+                              {"client_id", test_data::kClientId}}));
 }
 
 TEST_F(DeviceRegistrationInfoTest, HaveRegistrationCredentials) {