public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); // Builds a URI to what we will imagine is an external endpoint that is unreliable. For this sample we are hosting our own unreliable endpoint to demonstrate! var url = "https://www.microsoft.com"; // call the typed client that has been registered in ConfigureServices var status = await _unreliableEndpointCallerService.GetDataFromUnreliableEndpoint(url); return(new OkObjectResult(status)); }
public async Task <IActionResult> UnreliableEndpointConsumer() { // Builds a URI to what we will imagine is an external endpoint that is unreliable. For this sample we are hosting our own unreliable endpoint to demonstrate! var url = Url.Action("UnreliableEndpoint", "ThirdParty"); var uriBuilder = new UriBuilder { Scheme = HttpContext.Request.Scheme, Host = HttpContext.Request.Host.Host, Port = HttpContext.Request.Host.Port ?? 80, Path = url }; // call the typed client that has been registered in ConfigureServices var status = await _unreliableEndpointCallerService.GetDataFromUnreliableEndpoint(uriBuilder.Uri.ToString()); return(Ok(status)); }
public async Task <IActionResult> Index() { var status = await _unreliableEndpointCallerService.GetDataFromUnreliableEndpoint("http://localhost:5001/helloworld"); return(Ok(status)); }