Example #1
0
        /// <summary>
        ///     Sends object serialized to text using the current IXmlConverter plugin
        /// </summary>
        /// <param name="data">The object to be serialized and send</param>
        /// <param name="status">The status code for the response</param>
        public async Task SendXml(object data, HttpStatusCode status = HttpStatusCode.OK)
        {
            var xml = ServerPlugins.Get <IXmlConverter>().Serialize(data);

            await SendString(xml, "application/xml", status : status);
        }
Example #2
0
        /// <summary>
        ///     Sends object serialized to text using the current IJsonConverter plugin
        /// </summary>
        /// <param name="data">The object to be serialized and send</param>
        /// <param name="status">The status code for the response</param>
        public async Task SendJson(object data, HttpStatusCode status = HttpStatusCode.OK)
        {
            var json = ServerPlugins.Get <IJsonConverter>().Serialize(data);

            await SendString(json, "application/json", status : status);
        }