public static DurableHttpRequest ConvertTestRequestToDurableHttpRequest(TestDurableHttpRequest testRequest) { Dictionary <string, StringValues> testHeaders = new Dictionary <string, StringValues>(StringComparer.OrdinalIgnoreCase); if (testRequest.Headers != null) { foreach (KeyValuePair <string, string> header in testRequest.Headers) { StringValues stringValues; if (testHeaders.TryGetValue(header.Key, out stringValues)) { stringValues.Append(header.Value); testHeaders[header.Key] = stringValues; } else { stringValues = new StringValues(header.Value); testHeaders[header.Key] = stringValues; } } } DurableHttpRequest durableHttpRequest = new DurableHttpRequest( method: testRequest.HttpMethod, uri: new Uri(testRequest.Uri), headers: testHeaders, content: testRequest.Content, tokenSource: testRequest.TokenSource, asynchronousPatternEnabled: testRequest.AsynchronousPatternEnabled); return(durableHttpRequest); }
public static async Task <DurableHttpResponse> CallHttpAsyncOrchestrator([OrchestrationTrigger] IDurableOrchestrationContext ctx) { TestDurableHttpRequest testRequest = ctx.GetInput <TestDurableHttpRequest>(); DurableHttpRequest durableHttpRequest = ConvertTestRequestToDurableHttpRequest(testRequest); DurableHttpResponse response = await ctx.CallHttpAsync(durableHttpRequest); return(response); }