public async Task DefaultGET(String pathInfo) { Guid apiGuid = Guid.NewGuid(); try { var qs = Request.QueryString?.ToString(); if (!String.IsNullOrEmpty(qs)) { qs = $" query:{qs}"; } _logger.LogApi($"get: {pathInfo}{qs}", Request.UserHostAddress, apiGuid); var rm = await RequestModel.CreateFromApiUrl(_baseController.Host, "_api/" + pathInfo); var ac = rm.CurrentCommand; if (ac.AllowOriginForCheck == null) { throw new RequestModelException($"'allowOrigin' is required for '{ac.command}' command"); } if (!ac.IsGet()) { throw new RequestModelException($"Method 'get' is required for '{ac.command}' command"); } if (!ValidAllowAddress(ac)) { return; } if (!ValidHosts(ac)) { return; } Response.AddHeader("Access-Control-Allow-Origin", ac.AllowOriginForCheck); switch (ac.type) { case CommandType.file: if (ac.file == null) { throw new RequestModelException($"'file' is required for '{ac.command}' command"); } GetFile(ac); break; case CommandType.clr: await ExecuteClrCommand(ac, GetDataToInvokeGet(ac.wrapper, apiGuid, ac.authorize), apiGuid); break; default: throw new NotImplementedException(nameof(DefaultGET)); } await _baseController.ProcessDbEvents(ac); } catch (Exception ex) { if (ex.InnerException != null) { ex = ex.InnerException; } Response.ContentType = "text/plain"; Response.Output.Write(ex.Message); } }