-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Header dictionary has a class for itself now, and some tests
- Some additions to OwinContext - Much improved StatsLogger and StatsPageMiddleware (still public) - ShuntMiddleware added to map requests to a different IAppBuilder based on request path matching - License added (BSD License)
- Loading branch information
Showing
19 changed files
with
595 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Copyright (c) 2013, Marcelo Zabani | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
The views and conclusions contained in the software and documentation are those | ||
of the authors and should not be interpreted as representing official policies, | ||
either expressed or implied, of the FreeBSD Project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using NUnit.Framework; | ||
using Fos; | ||
|
||
namespace Fos.Tests | ||
{ | ||
[TestFixture] | ||
public class ResponseAndRequestHeaders | ||
{ | ||
[Test] | ||
public void HeadersValuesAreArrayCopies() | ||
{ | ||
var headerDict = new HeaderDictionary(); | ||
headerDict.Add("Name", new string[1] { "Value" }); | ||
|
||
string[] copy = headerDict["Name"]; | ||
|
||
Assert.AreEqual("Value", copy [0]); | ||
|
||
// Change and make sure it is still the same in the original! | ||
copy [0] = "Something different"; | ||
|
||
string[] copy2 = headerDict["Name"]; | ||
Assert.AreEqual("Value", copy2 [0]); | ||
} | ||
|
||
[Test] | ||
public void OrdinalInsensitiveKeyComparison() | ||
{ | ||
var headerDict = new HeaderDictionary(); | ||
headerDict.Add("Name", new string[1] { "Value" }); | ||
|
||
Assert.Throws<ArgumentException>(() => headerDict.Add("nAmE", new string[1] { "whatever" })); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
|
||
namespace Fos.Logging | ||
{ | ||
public class ApplicationError | ||
{ | ||
public string HttpMethod { get; private set; } | ||
public string RelativePath { get; private set; } | ||
|
||
/// <summary> | ||
/// All request cookies concatenaded as one big string. | ||
/// </summary> | ||
public string Cookies { get; private set; } | ||
|
||
public Exception Error { get; private set; } | ||
|
||
/// <summary> | ||
/// The time when the application error happened, in UTC. | ||
/// </summary> | ||
public DateTime When { get; private set; } | ||
|
||
internal ApplicationError(string verb, string relativePath, Exception e) | ||
{ | ||
HttpMethod = verb; | ||
RelativePath = relativePath; | ||
Error = e; | ||
|
||
//TODO: Cookies | ||
|
||
When = DateTime.UtcNow; | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.