private ResponseModel CreateProcessResponse()

in src/ApiForFhirMigrationTool.Function/Processors/FhirProcessor.cs [77:103]


        private ResponseModel CreateProcessResponse(HttpResponseMessage fhirResponse)
        {
            var response = new ResponseModel();
            var exportStatusUrl = string.Empty;
            if (fhirResponse.StatusCode == HttpStatusCode.Accepted)
            {
                response.Status = ResponseStatus.Accepted;
                HttpHeaders headers = fhirResponse.Content.Headers;
                IEnumerable<string> values;
                if (headers.GetValues("Content-Location") != null)
                {
                    values = headers.GetValues("Content-Location");
                    exportStatusUrl = values.First();
                }

                response.Content = exportStatusUrl;

                // #TODO - not sure wny we are changing the response code? Uncomment if this is needed.
                // response.Status = ResponseStatus.Completed;
            }
            else
            {
                string responseBody = fhirResponse.Content.ReadAsStringAsync().Result;
                response.Content = responseBody;
            }
            return response;
        }