rename
parent
2f58cdfe50
commit
13d1a194bf
|
@ -33,13 +33,13 @@ namespace LeanCloud.Storage.Internal.File {
|
||||||
MaxAge = TimeSpan.FromMilliseconds(31536000)
|
MaxAge = TimeSpan.FromMilliseconds(31536000)
|
||||||
};
|
};
|
||||||
request.Content.Headers.ContentType = new MediaTypeHeaderValue(mimeType);
|
request.Content.Headers.ContentType = new MediaTypeHeaderValue(mimeType);
|
||||||
HttpUtils.PrintRequest(client, request);
|
LCHttpUtils.PrintRequest(client, request);
|
||||||
HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
||||||
request.Dispose();
|
request.Dispose();
|
||||||
|
|
||||||
string resultString = await response.Content.ReadAsStringAsync();
|
string resultString = await response.Content.ReadAsStringAsync();
|
||||||
response.Dispose();
|
response.Dispose();
|
||||||
HttpUtils.PrintResponse(response, resultString);
|
LCHttpUtils.PrintResponse(response, resultString);
|
||||||
|
|
||||||
HttpStatusCode statusCode = response.StatusCode;
|
HttpStatusCode statusCode = response.StatusCode;
|
||||||
|
|
||||||
|
|
|
@ -36,13 +36,13 @@ namespace LeanCloud.Storage.Internal.File {
|
||||||
Content = content
|
Content = content
|
||||||
};
|
};
|
||||||
HttpClient client = new HttpClient();
|
HttpClient client = new HttpClient();
|
||||||
HttpUtils.PrintRequest(client, request);
|
LCHttpUtils.PrintRequest(client, request);
|
||||||
HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
||||||
request.Dispose();
|
request.Dispose();
|
||||||
|
|
||||||
string resultString = await response.Content.ReadAsStringAsync();
|
string resultString = await response.Content.ReadAsStringAsync();
|
||||||
response.Dispose();
|
response.Dispose();
|
||||||
HttpUtils.PrintResponse(response, resultString);
|
LCHttpUtils.PrintResponse(response, resultString);
|
||||||
|
|
||||||
HttpStatusCode statusCode = response.StatusCode;
|
HttpStatusCode statusCode = response.StatusCode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,13 +52,13 @@ namespace LeanCloud.Storage.Internal.Http {
|
||||||
};
|
};
|
||||||
await FillHeaders(request.Headers, headers);
|
await FillHeaders(request.Headers, headers);
|
||||||
|
|
||||||
HttpUtils.PrintRequest(client, request);
|
LCHttpUtils.PrintRequest(client, request);
|
||||||
HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
||||||
request.Dispose();
|
request.Dispose();
|
||||||
|
|
||||||
string resultString = await response.Content.ReadAsStringAsync();
|
string resultString = await response.Content.ReadAsStringAsync();
|
||||||
response.Dispose();
|
response.Dispose();
|
||||||
HttpUtils.PrintResponse(response, resultString);
|
LCHttpUtils.PrintResponse(response, resultString);
|
||||||
|
|
||||||
if (response.IsSuccessStatusCode) {
|
if (response.IsSuccessStatusCode) {
|
||||||
T ret = JsonConvert.DeserializeObject<T>(resultString, new LeanCloudJsonConverter());
|
T ret = JsonConvert.DeserializeObject<T>(resultString, new LeanCloudJsonConverter());
|
||||||
|
@ -85,13 +85,13 @@ namespace LeanCloud.Storage.Internal.Http {
|
||||||
requestContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
requestContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||||
request.Content = requestContent;
|
request.Content = requestContent;
|
||||||
}
|
}
|
||||||
HttpUtils.PrintRequest(client, request, content);
|
LCHttpUtils.PrintRequest(client, request, content);
|
||||||
HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
||||||
request.Dispose();
|
request.Dispose();
|
||||||
|
|
||||||
string resultString = await response.Content.ReadAsStringAsync();
|
string resultString = await response.Content.ReadAsStringAsync();
|
||||||
response.Dispose();
|
response.Dispose();
|
||||||
HttpUtils.PrintResponse(response, resultString);
|
LCHttpUtils.PrintResponse(response, resultString);
|
||||||
|
|
||||||
if (response.IsSuccessStatusCode) {
|
if (response.IsSuccessStatusCode) {
|
||||||
T ret = JsonConvert.DeserializeObject<T>(resultString, new LeanCloudJsonConverter());
|
T ret = JsonConvert.DeserializeObject<T>(resultString, new LeanCloudJsonConverter());
|
||||||
|
@ -118,13 +118,13 @@ namespace LeanCloud.Storage.Internal.Http {
|
||||||
requestContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
requestContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||||
request.Content = requestContent;
|
request.Content = requestContent;
|
||||||
}
|
}
|
||||||
HttpUtils.PrintRequest(client, request, content);
|
LCHttpUtils.PrintRequest(client, request, content);
|
||||||
HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
||||||
request.Dispose();
|
request.Dispose();
|
||||||
|
|
||||||
string resultString = await response.Content.ReadAsStringAsync();
|
string resultString = await response.Content.ReadAsStringAsync();
|
||||||
response.Dispose();
|
response.Dispose();
|
||||||
HttpUtils.PrintResponse(response, resultString);
|
LCHttpUtils.PrintResponse(response, resultString);
|
||||||
|
|
||||||
if (response.IsSuccessStatusCode) {
|
if (response.IsSuccessStatusCode) {
|
||||||
T ret = JsonConvert.DeserializeObject<T>(resultString, new LeanCloudJsonConverter());
|
T ret = JsonConvert.DeserializeObject<T>(resultString, new LeanCloudJsonConverter());
|
||||||
|
@ -141,13 +141,13 @@ namespace LeanCloud.Storage.Internal.Http {
|
||||||
};
|
};
|
||||||
await FillHeaders(request.Headers);
|
await FillHeaders(request.Headers);
|
||||||
|
|
||||||
HttpUtils.PrintRequest(client, request);
|
LCHttpUtils.PrintRequest(client, request);
|
||||||
HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
HttpResponseMessage response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
||||||
request.Dispose();
|
request.Dispose();
|
||||||
|
|
||||||
string resultString = await response.Content.ReadAsStringAsync();
|
string resultString = await response.Content.ReadAsStringAsync();
|
||||||
response.Dispose();
|
response.Dispose();
|
||||||
HttpUtils.PrintResponse(response, resultString);
|
LCHttpUtils.PrintResponse(response, resultString);
|
||||||
|
|
||||||
if (response.IsSuccessStatusCode) {
|
if (response.IsSuccessStatusCode) {
|
||||||
Dictionary<string, object> ret = JsonConvert.DeserializeObject<Dictionary<string, object>>(resultString, new LeanCloudJsonConverter());
|
Dictionary<string, object> ret = JsonConvert.DeserializeObject<Dictionary<string, object>>(resultString, new LeanCloudJsonConverter());
|
||||||
|
@ -165,7 +165,7 @@ namespace LeanCloud.Storage.Internal.Http {
|
||||||
code = (int)error["code"];
|
code = (int)error["code"];
|
||||||
message = error["error"].ToString();
|
message = error["error"].ToString();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.Error(e.Message);
|
LCLogger.Error(e.Message);
|
||||||
}
|
}
|
||||||
return new LCException(code, message);
|
return new LCException(code, message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue