Skip to content

Commit

Permalink
Updated the indexer property of FakeHttpRequest so that it mimics the…
Browse files Browse the repository at this point in the history
… actual implementation in System.Web.HttpRequest.
  • Loading branch information
Dan Pettersson committed Nov 5, 2015
1 parent cacfba1 commit a1ac55c
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions SpecsFor.Helpers.Web/Mvc/FakeHttpRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,31 @@ public override HttpBrowserCapabilitiesBase Browser
return this._browser.Object;
}
}
public override String this[String key]

public String this[String key]
{
get { return null; }
get
{
String s;

s = QueryString[key];
if (s != null)
return s;

s = Form[key];
if (s != null)
return s;

HttpCookie c = Cookies[key];
if (c != null)
return c.Value;

s = ServerVariables[key];
if (s != null)
return s;

return null;
}
}

public override NameValueCollection Headers
Expand All @@ -37,6 +58,13 @@ public override NameValueCollection Headers
}
}

public override NameValueCollection ServerVariables
{
get
{
return new NameValueCollection();
}
}

public override NameValueCollection Form
{
Expand Down

0 comments on commit a1ac55c

Please sign in to comment.