Update file type for uploaded Javascript file. (#256)

This commit is contained in:
Hugh Xiong 2018-09-19 13:16:22 -07:00 коммит произвёл Harleen Thind
Родитель a2e01dbacb
Коммит 4e5144a161
2 изменённых файлов: 4 добавлений и 4 удалений

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

@ -184,7 +184,7 @@ namespace WebService.Test.v1.Controllers
private IFormFile SetupFileMock()
{
var fileMock = new Mock<IFormFile>();
const string CONTENT_TYPE = "application/javascript";
const string CONTENT_TYPE = "text/javascript";
const string CONTENT = "awesome javascript";
const string FILENAME = "test.js";
var ms = new MemoryStream(Encoding.UTF8.GetBytes(CONTENT));

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

@ -22,7 +22,7 @@ namespace Microsoft.Azure.IoTSolutions.DeviceSimulation.WebService.v1.Controller
[ExceptionsFilter]
public class DeviceModelScriptsController : Controller
{
private const string APPLICATION_JAVASCRIPT = "application/javascript";
private const string TEXT_JAVASCRIPT = "text/javascript";
private readonly ILogger log;
private readonly IDeviceModelScripts simulationScriptService;
private readonly IJavascriptInterpreter javascriptInterpreter;
@ -58,7 +58,7 @@ namespace Microsoft.Azure.IoTSolutions.DeviceSimulation.WebService.v1.Controller
throw new BadRequestException("No data provided.");
}
if (file.ContentType != APPLICATION_JAVASCRIPT)
if (file.ContentType != TEXT_JAVASCRIPT)
{
this.log.Warn("Wrong content type provided", () => new { file.ContentType });
throw new BadRequestException("Wrong content type provided.");
@ -93,7 +93,7 @@ namespace Microsoft.Azure.IoTSolutions.DeviceSimulation.WebService.v1.Controller
throw new BadRequestException("No data provided.");
}
if (file.ContentType != APPLICATION_JAVASCRIPT)
if (file.ContentType != TEXT_JAVASCRIPT)
{
this.log.Warn("Wrong content type provided", () => new { file.ContentType });
throw new BadRequestException("Wrong content type provided.");