public void GetUrl(string package, string page, string expectedSuffix) { var actualUrl = Canonicalizer.GetUrl(package, page); Assert.NotNull(actualUrl); Assert.StartsWith(Canonicalizer.CloudSitePrefix, actualUrl); var actualSuffix = actualUrl[Canonicalizer.CloudSitePrefix.Length..];
/// <summary> /// Logic for your function goes here. /// </summary> /// <param name="context">The HTTP context, containing the request and the response.</param> /// <returns>A task representing the asynchronous operation.</returns> public async Task HandleAsync(HttpContext context) { var request = context.Request; var response = context.Response; string package = request.Query["package"]; string page = request.Query["page"]; if (string.IsNullOrEmpty(package) || string.IsNullOrEmpty(page)) { response.StatusCode = 400; await response.WriteAsync("Error: both package and page must be specified"); } string url = Canonicalizer.GetUrl(package, page); await response.WriteAsync(url ?? ""); }