Update file type for uploaded Javascript file. (#256)
This commit is contained in:
Родитель
a2e01dbacb
Коммит
4e5144a161
|
@ -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.");
|
||||
|
|
Загрузка…
Ссылка в новой задаче