private string ResolveQueryUriPart(string value, FhirUri fhirUri) { if (value.Contains('?')) { var Split = value.Split('?'); fhirUri.Query = Split[1]; return(Split[0]); } else { return(value); } }
public bool TryParse(string requestUri, FhirVersion fhirVersion, out IFhirUri?fhirUri, out string errorMessage) { FhirUri fhirUriParse = new FhirUri(fhirVersion, this.IServiceBaseUrl.Url(fhirVersion)); if (ProcessRequestUri(System.Net.WebUtility.UrlDecode(requestUri), fhirUriParse)) { fhirUri = fhirUriParse; errorMessage = string.Empty; return(true); } else { errorMessage = fhirUriParse.ParseErrorMessage; fhirUri = null; return(false); } }
private string ResolvePrimaryServiceRoot(string RequestUri, FhirUri fhirUri) { string RequestRelativePath; if (RequestUri.StripHttp().ToLower().StartsWith(fhirUri.PrimaryServiceRootServers !.OriginalString.StripHttp().ToLower())) { //If the request URL starts with our known servers root then cut it off and return relative part , job done. fhirUri.IsRelativeToServer = true; RequestUri = RequestUri.StripHttp(); string PrimaryServiceRootServers = fhirUri.PrimaryServiceRootServers !.OriginalString.StripHttp(); RequestRelativePath = RequestUri.Substring(PrimaryServiceRootServers.Count(), RequestUri.Count() - PrimaryServiceRootServers.Count()); if (RequestRelativePath.StartsWith("/")) { RequestRelativePath = RequestRelativePath.TrimStart('/'); } return(RequestRelativePath); }