Added more examples. WithText and WithJson now specify Utf16 to support rich content.
This commit is contained in:
@@ -22,7 +22,7 @@ namespace MontoyaTech.Rest.Net
|
||||
/// <returns></returns>
|
||||
public static HttpListenerResponse WithText(this HttpListenerResponse response, string text)
|
||||
{
|
||||
response.ContentType = "text/plain";
|
||||
response.ContentType = "text/plain; charset=utf-16";
|
||||
|
||||
var bytes = Encoding.Unicode.GetBytes(text);
|
||||
response.OutputStream.Write(bytes, 0, bytes.Length);
|
||||
@@ -38,7 +38,7 @@ namespace MontoyaTech.Rest.Net
|
||||
/// <returns></returns>
|
||||
public static HttpListenerResponse WithJson(this HttpListenerResponse response, object obj)
|
||||
{
|
||||
response.ContentType = "application/json";
|
||||
response.ContentType = "application/json; charset=utf-16";
|
||||
|
||||
var bytes = Encoding.Unicode.GetBytes(JsonConvert.SerializeObject(obj));
|
||||
response.OutputStream.Write(bytes, 0, bytes.Length);
|
||||
|
Reference in New Issue
Block a user