Example #1
0
        public static HttpResponse TeapotResult(ApiOffence offense, string propertName)
        {
            var res = new HttpResponse();

            res.Content    = getContent(offense, propertName);
            res.StatusCode = 418;
            return(res);
        }
Example #2
0
        private static byte[] getContent(ApiOffence offense, string propertName)
        {
            var obj = new Dictionary <string, object>()
            {
                [propertName] = new { ErrorCode = offense.ErrorCode }
            };

            return(UTF8Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(obj)));
        }