Пример #1
0
        public async Task <IActionResult> Get([FromRoute(Name = "data")] string data, [FromRoute(Name = "endpoint")] Guid endpointId)
        {
            var endpoint = await EndpointService.FindById(endpointId, true);

            var outputData = endpoint.OutputData;

            //TODO: get rid of try/catch
            try
            {
                var json = JsonConvert.DeserializeObject(endpoint.OutputData);
                HttpContext.Response.Headers["Content-Type"] = "application/json; charset=utf-8";
            }
            catch { }
            HttpContext.Response.StatusCode = endpoint.OutputStatusCode;
            endpoint.OutputData             = null;
            await LoggingService.Create(new RequestLog
            {
                Received = data,
                Endpoint = endpoint
            });

            if (endpoint.CallbackType == CallbackType.Asynchronous)
            {
                await Task.Run(async() => await AsyncRequestService.Call(endpoint));
            }

            return(Content(outputData));
        }