public async Task HandleAsync()

in processing-pipelines/image-v3/filter/csharp/Function.cs [39:65]


        public async Task HandleAsync(HttpContext context)
        {
            _logger.LogInformation("Function received request");

            try
            {
                var (bucket, file) = await _requestReader.ReadCloudStorageData(context);

                var storageUrl = $"gs://{bucket}/{file}";
                _logger.LogInformation($"Storage url: {storageUrl}");

                var safe = await IsPictureSafe(storageUrl);
                _logger.LogInformation($"Is the picture safe? {safe}");

                var replyData = new {safe = safe};
                var json = JsonConvert.SerializeObject(replyData);
                _logger.LogInformation($"Replying back with json: {json}");

                context.Response.ContentType = "application/json";
                await context.Response.WriteAsync(json);
            }
            catch (Exception e)
            {
                _logger.LogError($"Error processing: " + e.Message);
                throw e;
            }
        }