示例#1
0
 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));
 }
示例#2
0
        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);
            }
        }
示例#3
0
 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)));
 }