private bool ParsePrefer(KeyValuePair <string, StringValues> Header) { string TermHandling = "handling"; if (Header.Key.Trim().Equals(TermPrefer, StringComparison.OrdinalIgnoreCase)) { //We should not get many but if we do we will just use the last one foreach (string Value in Header.Value.Reverse()) { if (Value.Equals($"{TermHandling}={PreferHandlingType.Strict.GetCode()}", StringComparison.OrdinalIgnoreCase)) { this.PreferHandling = PreferHandlingType.Strict; return(true); } else if (Value.Equals($"{TermHandling}={PreferHandlingType.Lenient.GetCode()}", StringComparison.OrdinalIgnoreCase)) { this.PreferHandling = PreferHandlingType.Lenient; return(true); } } } return(false); }
public FhirHeaders() { this.PreferHandling = PreferHandlingType.Lenient; //This is the default as per FHIR spec this.HeaderDictionary = new Dictionary <string, StringValues>(); }