public new static HttpLink From(string value, bool strict = true) { var schemeParts = value.Split(new[] { Uri.SchemeDelimiter }, StringSplitOptions.None); if (schemeParts.Length == 2) { var pathSeparatorIndex = schemeParts[1].IndexOf('/'); if (pathSeparatorIndex == -1 || pathSeparatorIndex == schemeParts[1].Length - 1) { var host = HttpHost.From(value, strict: false); if (host != null) { return(new HttpLink(host, HttpResource.Root)); } } else { var hostText = schemeParts[0] + Uri.SchemeDelimiter + schemeParts[1].Substring(0, pathSeparatorIndex); var resourceText = schemeParts[1].Substring(pathSeparatorIndex + 1); var host = HttpHost.From(hostText, strict: false); if (host != null) { var resource = HttpResource.From(resourceText, strict: false); if (resource != null) { return(new HttpLink(host, resource)); } } } } ExpectNot(strict, "Failed to parse HTTP link: " + value); return(null); }
public static HttpLink From(string host, HttpResource resource, bool strict = true) { var parsedHost = HttpHost.From(host, strict); return(parsedHost == null ? null : new HttpLink(parsedHost, resource)); }
public static HttpLink From(HttpHost host, string resource, bool strict = true) { var parsedResource = HttpResource.From(resource, strict); return(parsedResource == null ? null : new HttpLink(host, parsedResource)); }
// // Factory // public static HttpLink From(HttpHost host, HttpResource resource) { return(new HttpLink(host, resource)); }
public HttpLink Then(HttpResource resource) { return(new HttpLink(Host, Resource.Then(resource))); }
private HttpLink(HttpHost host, HttpResource resource) { Host = host; Resource = resource; }