public static T ReadJson <T>(this HttpListenerRequest req) { try { string json = req.ReadString(); return(JsonConvert.DeserializeObject <T>(json)); } catch (Exception e) { throw new ApiException(400, e.Message); } }