Пример #1
0
        public async Task <DicomWebResponse <string> > QueryWithBadRequest(string requestUri, CancellationToken cancellationToken = default)
        {
            using (var request = new HttpRequestMessage(HttpMethod.Get, requestUri))
            {
                request.Headers.Accept.Add(MediaTypeApplicationDicomJson);

                using (HttpResponseMessage response = await HttpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken))
                {
                    var result = new DicomWebResponse <string>(response, await response.Content.ReadAsStringAsync());

                    if (response.IsSuccessStatusCode)
                    {
                        return(result);
                    }

                    throw new DicomWebException <string>(result);
                }
            }
        }
Пример #2
0
        public DicomWebException(DicomWebResponse response)
        {
            EnsureArg.IsNotNull(response, nameof(response));

            Response = response;
        }