public void SetResponse(int httpCode, string payload, bool setTextMime = true) { if (setTextMime) { this.ResponseContentType = PowerLineContextContentType.Text; } this.SetResponse(httpCode, System.Text.Encoding.UTF8.GetBytes(payload)); }
public static string GetMimeType(this PowerLineContextContentType contextType) { switch (contextType) { case PowerLineContextContentType.Json: return("application/json"); case PowerLineContextContentType.Text: return("text/plain"); case PowerLineContextContentType.Html: return("text/plain"); case PowerLineContextContentType.Xml: return("application/xml"); default: return(null); } }
public void SetResponse(int httpCode, JObject obj, Newtonsoft.Json.Formatting formatting) { this.ResponseContentType = PowerLineContextContentType.Json; this.SetResponse(httpCode, System.Text.Encoding.UTF8.GetBytes(obj.ToString(formatting))); }