diff --git a/Rest.Net/HttpListenerResponseExtensions.cs b/Rest.Net/HttpListenerResponseExtensions.cs
index d1a3d72..2eab1bd 100644
--- a/Rest.Net/HttpListenerResponseExtensions.cs
+++ b/Rest.Net/HttpListenerResponseExtensions.cs
@@ -49,6 +49,27 @@ namespace MontoyaTech.Rest.Net
return response;
}
+ ///
+ /// Sets the response content type to text encoded as utf16 and writes the given text to it.
+ ///
+ ///
+ ///
+ /// This response.
+ public static HttpListenerResponse WithText16(this HttpListenerResponse response, string text)
+ {
+ response.ContentType = "text/plain; charset=utf-16";
+
+ var bytes = Encoding.Unicode.GetBytes(text);
+
+ response.ContentLength64 = bytes.Length;
+
+ response.OutputStream.Write(bytes, 0, bytes.Length);
+
+ response.OutputStream.Dispose();
+
+ return response;
+ }
+
///
/// Sets the response content type to text and writes the given text compressed to it.
///
@@ -101,6 +122,27 @@ namespace MontoyaTech.Rest.Net
return response;
}
+ ///
+ /// Sets the response content type to json encoded as utf16 and serializes the object as json and writes it.
+ ///
+ ///
+ ///
+ /// This response.
+ public static HttpListenerResponse WithJson16(this HttpListenerResponse response, object obj)
+ {
+ response.ContentType = "application/json; charset=utf-16";
+
+ var bytes = Encoding.Unicode.GetBytes(JsonConvert.SerializeObject(obj));
+
+ response.ContentLength64 = bytes.Length;
+
+ response.OutputStream.Write(bytes, 0, bytes.Length);
+
+ response.OutputStream.Dispose();
+
+ return response;
+ }
+
///
/// Sets the response content type to json and writes the given json compressed to it.
///
@@ -312,6 +354,25 @@ namespace MontoyaTech.Rest.Net
return response;
}
+ ///
+ /// Sets the response content type to html encoded in utf 16 and writes the given html to it.
+ ///
+ ///
+ ///
+ /// This response.
+ public static HttpListenerResponse WithHtml16(this HttpListenerResponse response, string html)
+ {
+ response.ContentType = "text/html; charset=utf-16";
+
+ var bytes = Encoding.Unicode.GetBytes(html);
+
+ response.ContentLength64 = bytes.Length;
+
+ response.OutputStream.Write(bytes, 0, bytes.Length);
+
+ return response;
+ }
+
///
/// Sets the status code for a given response.
///
diff --git a/Rest.Net/Rest.Net.csproj b/Rest.Net/Rest.Net.csproj
index 104d26c..58b5c70 100644
--- a/Rest.Net/Rest.Net.csproj
+++ b/Rest.Net/Rest.Net.csproj
@@ -17,7 +17,7 @@
MontoyaTech.Rest.Net
MontoyaTech.Rest.Net
True
- 1.6.8
+ 1.6.9
Logo_Symbol_Black_Outline.png
diff --git a/Rest.Net/RouteListener.cs b/Rest.Net/RouteListener.cs
index 485a8ea..df28b9c 100644
--- a/Rest.Net/RouteListener.cs
+++ b/Rest.Net/RouteListener.cs
@@ -17,7 +17,7 @@ namespace MontoyaTech.Rest.Net
///
/// The internal http listener.
///
- private HttpListener HttpListener = null;
+ protected HttpListener HttpListener = null;
///
/// The list of routes this RouteListener is listening for.