cosmetics

master
UbitUmarov 2020-05-11 19:35:13 +01:00
parent 8da733c485
commit 4bf4c76a64
1 changed files with 19 additions and 21 deletions

View File

@ -404,36 +404,34 @@ namespace OpenSim.Framework
{ {
await dst.WriteAsync(src, 0, src.Length).ConfigureAwait(false); await dst.WriteAsync(src, 0, src.Length).ConfigureAwait(false);
} }
_response = (HttpWebResponse)await _request.GetResponseAsync().ConfigureAwait(false);
using(HttpWebResponse response = (HttpWebResponse)await _request.GetResponseAsync().ConfigureAwait(false))
{
if (WebUtil.DebugLevel >= 5)
{
using (Stream responseStream = response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(responseStream))
{
string responseStr = await reader.ReadToEndAsync().ConfigureAwait(false);
WebUtil.LogResponseDetail(reqnum, responseStr);
}
}
}
}
} }
catch (WebException e) catch (WebException e)
{ {
m_log.WarnFormat("[REST]: Request {0} {1} failed with status {2} and message {3}", m_log.WarnFormat("[REST]: AsyncPOST {0} failed with status {1} and message {2}",
RequestMethod, _request.RequestUri, e.Status, e.Message); _request.RequestUri, e.Status, e.Message);
return; return;
} }
catch (Exception e) catch (Exception e)
{ {
m_log.WarnFormat( m_log.WarnFormat("[REST]: AsyncPOST {0} failed with exception {1} {2}",
"[REST]: Request {0} {1} failed with exception {2} {3}", _request.RequestUri, e.Message, e.StackTrace);
RequestMethod, _request.RequestUri, e.Message, e.StackTrace);
return; return;
} }
if (WebUtil.DebugLevel >= 5)
{
using (Stream responseStream = _response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(responseStream))
{
string responseStr = await reader.ReadToEndAsync().ConfigureAwait(false);
WebUtil.LogResponseDetail(reqnum, responseStr);
}
}
}
if (_response != null)
_response.Close();
} }
#region Async Invocation #region Async Invocation