private static void SendWADOResponse(WADOResponse response, HttpListenerContext context)
{
context.Response.StatusCode = (int) HttpStatusCode.OK; // TODO: what does http protocol say about how error that occurs after OK status has been sent should be handled?
context.Response.ContentType = response.ContentType;
if (response.Output == null)
{
context.Response.ContentLength64 = 0;
}
else
{
context.Response.ContentLength64 = response.Output.Length;
Stream output = context.Response.OutputStream;
output.Write(response.Output, 0, response.Output.Length);
}
}