diff --git a/Rest.Net/Rest.Net/Extensions/HttpListenerResponseExtensions.cs b/Rest.Net/Rest.Net/Extensions/HttpListenerResponseExtensions.cs
index c856ed0..d18c596 100644
--- a/Rest.Net/Rest.Net/Extensions/HttpListenerResponseExtensions.cs
+++ b/Rest.Net/Rest.Net/Extensions/HttpListenerResponseExtensions.cs
@@ -19,7 +19,7 @@ namespace MontoyaTech.Rest.Net
///
///
///
- ///
+ /// This response.
public static HttpListenerResponse WithText(this HttpListenerResponse response, string text)
{
response.ContentType = "text/plain; charset=utf-16";
@@ -35,7 +35,7 @@ namespace MontoyaTech.Rest.Net
///
///
///
- ///
+ /// This response.
public static HttpListenerResponse WithJson(this HttpListenerResponse response, object obj)
{
response.ContentType = "application/json; charset=utf-16";
@@ -51,7 +51,7 @@ namespace MontoyaTech.Rest.Net
///
///
///
- ///
+ /// This response.
public static HttpListenerResponse WithFile(this HttpListenerResponse response, string filePath)
{
response.ContentType = "application/octet-stream";
@@ -70,7 +70,7 @@ namespace MontoyaTech.Rest.Net
///
///
///
- ///
+ /// This response.
public static HttpListenerResponse WithStatus(this HttpListenerResponse response, HttpStatusCode status)
{
try
@@ -83,5 +83,22 @@ namespace MontoyaTech.Rest.Net
return response;
}
}
+
+ ///
+ /// Sets a cookie for a given response.
+ ///
+ ///
+ /// The name of the cookie
+ /// The value of the cookie
+ /// This response.
+ public static HttpListenerResponse WithCookie(this HttpListenerResponse response, string name, string value)
+ {
+ if (response.Cookies[name] == null)
+ response.Cookies.Add(new Cookie(name, value));
+ else
+ response.Cookies[name].Value = value;
+
+ return response;
+ }
}
}
diff --git a/Rest.Net/Rest.Net/Rest.Net.csproj b/Rest.Net/Rest.Net/Rest.Net.csproj
index dc3d9c1..84ab016 100644
--- a/Rest.Net/Rest.Net/Rest.Net.csproj
+++ b/Rest.Net/Rest.Net/Rest.Net.csproj
@@ -14,7 +14,7 @@
MontoyaTech.Rest.Net
MontoyaTech.Rest.Net
True
- 1.0.1
+ 1.0.2