本文整理汇总了C#中Hl7.Fhir.Model.Bundle.ToHttpRequest方法的典型用法代码示例。如果您正苦于以下问题:C# Bundle.ToHttpRequest方法的具体用法?C# Bundle.ToHttpRequest怎么用?C# Bundle.ToHttpRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hl7.Fhir.Model.Bundle
的用法示例。
在下文中一共展示了Bundle.ToHttpRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: doRequest
private Bundle.EntryComponent doRequest(Bundle.EntryComponent interaction)
{
byte[] outBody;
var request = interaction.ToHttpRequest(Prefer, PreferredFormat, UseFormatParameter, out outBody);
#if !PORTABLE45
request.Timeout = Timeout;
#endif
LastRequest = request;
if (BeforeRequest != null) BeforeRequest(request, outBody);
// Make sure the HttpResponse gets disposed!
// using (HttpWebResponse webResponse = (HttpWebResponse)await request.GetResponseAsync(new TimeSpan(0, 0, 0, 0, Timeout)))
using (HttpWebResponse webResponse = (HttpWebResponse)request.GetResponseNoEx())
{
try
{
//Read body before we call the hook, so the hook cannot read the body before we do
var inBody = readBody(webResponse);
LastResponse = webResponse;
if (AfterResponse != null) AfterResponse(webResponse,inBody);
// Do this call after AfterResponse, so this will be called, even if exceptions are thrown by ToBundleEntry()
return webResponse.ToBundleEntry(inBody);
}
catch (AggregateException ae)
{
//EK: This code looks weird. Is this correct?
if (ae.GetBaseException() is WebException)
{
}
throw ae.GetBaseException();
}
}
}