Ejemplo n.º 1
0
        public override Task WriteResponseAsync(byte[] data)
        {
            return(Task.Run(() =>
            {
                if (IsBatchRequest)
                {
                    // batch requests need to be wrapped
                    ResponseContentType = String.Format(CultureInfo.InvariantCulture, "multipart/mixed;boundary=batchresponse_{0}", _batchBoundaryId);
                    string s = InterceptFormatting.MakeBatchEntry(_batchBoundaryId, data);
                    _data = new MemoryStream(Encoding.UTF8.GetBytes(s));
                }
                else
                {
                    _data = new MemoryStream(data);
                }

                _sem.Set();
            }));
        }