Commit 250a081e authored by Honfika's avatar Honfika

Body proerties are not browsable, ExpandableObjectConverter

parent 3c1c659f
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Titanium.Web.Proxy.Models;
namespace Titanium.Web.Proxy.Http
{
[TypeConverter(typeof(ExpandableObjectConverter))]
public class HeaderCollection : IEnumerable<HttpHeader>
{
/// <summary>
/// Unique Request header collection
/// </summary>
public Dictionary<string, HttpHeader> Headers { get; set; }
public Dictionary<string, HttpHeader> Headers { get; }
/// <summary>
/// Non Unique headers
/// </summary>
public Dictionary<string, List<HttpHeader>> NonUniqueHeaders { get; set; }
public Dictionary<string, List<HttpHeader>> NonUniqueHeaders { get; }
/// <summary>
/// Initializes a new instance of the <see cref="HeaderCollection"/> class.
......@@ -52,6 +54,7 @@ namespace Titanium.Web.Proxy.Http
Headers[name]
};
}
if (NonUniqueHeaders.ContainsKey(name))
{
return new List<HttpHeader>(NonUniqueHeaders[name]);
......
using System;
using System.ComponentModel;
using System.Text;
using Titanium.Web.Proxy.Exceptions;
using Titanium.Web.Proxy.Extensions;
......@@ -10,6 +11,7 @@ namespace Titanium.Web.Proxy.Http
/// <summary>
/// A HTTP(S) request object
/// </summary>
[TypeConverter(typeof(ExpandableObjectConverter))]
public class Request
{
/// <summary>
......@@ -210,6 +212,7 @@ namespace Titanium.Web.Proxy.Http
/// <summary>
/// Request body as byte array
/// </summary>
[Browsable(false)]
public byte[] Body
{
get
......@@ -228,6 +231,7 @@ namespace Titanium.Web.Proxy.Http
/// Request body as string
/// Use the encoding specified in request to decode the byte[] data to string
/// </summary>
[Browsable(false)]
public string BodyString => bodyString ?? (bodyString = Encoding.GetString(Body));
/// <summary>
......
using System;
using System.ComponentModel;
using System.Text;
using Titanium.Web.Proxy.Extensions;
using Titanium.Web.Proxy.Models;
......@@ -9,6 +10,7 @@ namespace Titanium.Web.Proxy.Http
/// <summary>
/// Http(s) response object
/// </summary>
[TypeConverter(typeof(ExpandableObjectConverter))]
public class Response
{
/// <summary>
......@@ -181,6 +183,7 @@ namespace Titanium.Web.Proxy.Http
/// <summary>
/// Response body as byte array
/// </summary>
[Browsable(false)]
public byte[] Body
{
get
......@@ -199,6 +202,7 @@ namespace Titanium.Web.Proxy.Http
/// Response body as string
/// Use the encoding specified in response to decode the byte[] data to string
/// </summary>
[Browsable(false)]
public string BodyString => bodyString ?? (bodyString = Encoding.GetString(Body));
/// <summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment