Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private static bool CheckIsText(string contentType)
if (extensionKey != null)
{
string perceivedType = extensionKey.GetValue("PerceivedType") as string;
isText = (perceivedType == "text");
isText = perceivedType == "text";
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ internal override void ProcessResponse(HttpResponseMessage response)

bool convertSuccess = false;

// Default to try json first since it's more common
if (returnType == RestReturnType.Json)
{
convertSuccess = TryConvertToJson(str, out obj, ref ex) || TryConvertToXml(str, out obj, ref ex);
}
// default to try xml first since it's more common
else
{
convertSuccess = TryConvertToXml(str, out obj, ref ex) || TryConvertToJson(str, out obj, ref ex);
Expand Down Expand Up @@ -216,10 +216,9 @@ private bool TryProcessFeedStream(Stream responseStream)
while (!reader.EOF)
{
// If node is Element and it's the 'Item' or 'Entry' node, emit that node.
if ((reader.NodeType == XmlNodeType.Element) &&
(string.Equals("Item", reader.Name, StringComparison.OrdinalIgnoreCase) ||
string.Equals("Entry", reader.Name, StringComparison.OrdinalIgnoreCase))
)
if (reader.NodeType == XmlNodeType.Element
&& (string.Equals("Item", reader.Name, StringComparison.OrdinalIgnoreCase)
|| string.Equals("Entry", reader.Name, StringComparison.OrdinalIgnoreCase)))
{
// This one will do reader.Read() internally
XmlNode result = workingDocument.ReadNode(reader);
Expand All @@ -232,7 +231,10 @@ private bool TryProcessFeedStream(Stream responseStream)
}
}
}
catch (XmlException) { }
catch (XmlException)
{
// Catch XmlException
}
finally
{
responseStream.Seek(0, SeekOrigin.Begin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ internal static Dictionary<string, IEnumerable<string>> GetHeadersDictionary(Htt
{
headers[entry.Key] = entry.Value;
}

// In CoreFX, HttpResponseMessage separates content related headers, such as Content-Type to
// HttpResponseMessage.Content.Headers. The remaining headers are in HttpResponseMessage.Headers.
// The keys in both should be unique with no duplicates between them.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class WebResponseObject
public HttpResponseMessage BaseResponse { get; set; }

/// <summary>
/// Gets or protected sets the response body content.
/// Gets or sets the response body content.
/// </summary>
public byte[] Content { get; protected set; }

Expand All @@ -35,7 +35,7 @@ public class WebResponseObject
private Dictionary<string, IEnumerable<string>> _headers = null;

/// <summary>
/// Gets or protected sets the full response content.
/// Gets or sets the full response content.
/// </summary>
/// <value>
/// Full response content, including the HTTP status line, headers, and body.
Expand All @@ -48,7 +48,7 @@ public class WebResponseObject
public long RawContentLength => RawContentStream is null ? -1 : RawContentStream.Length;

/// <summary>
/// Gets or protected sets the response body content as a <see cref="MemoryStream"/>.
/// Gets or sets the response body content as a <see cref="MemoryStream"/>.
/// </summary>
public MemoryStream RawContentStream { get; protected set; }

Expand Down Expand Up @@ -150,7 +150,8 @@ private void SetResponse(HttpResponseMessage response, Stream contentStream)
int initialCapacity = (int)Math.Min(contentLength, StreamHelper.DefaultReadBuffer);
RawContentStream = new WebResponseContentMemoryStream(st, initialCapacity, cmdlet: null, response.Content.Headers.ContentLength.GetValueOrDefault());
}
// set the position of the content stream to the beginning

// Set the position of the content stream to the beginning
RawContentStream.Position = 0;
}

Expand Down