[xharness] Show html as html by serving the right mime type. (#3917)

This commit is contained in:
Rolf Bjarne Kvinge 2018-04-11 09:08:23 +02:00 коммит произвёл GitHub
Родитель b0f9d91b9d
Коммит bb79afdfb7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -1166,7 +1166,14 @@ namespace xharness
using (var fs = new FileStream (path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) {
int read;
response.ContentLength64 = fs.Length;
switch (Path.GetExtension (path).ToLowerInvariant ()) {
case ".html":
response.ContentType = System.Net.Mime.MediaTypeNames.Text.Html;
break;
default:
response.ContentType = System.Net.Mime.MediaTypeNames.Text.Plain;
break;
}
while ((read = fs.Read (buffer, 0, buffer.Length)) > 0)
response.OutputStream.Write (buffer, 0, read);
}