You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suggested code fix which correctly extracts the charset and them recombines all of the other parameters procedure SplitContentMediaTypeAndCharset(const aContentType: string; var aContentMediaType: string; var aContentCharSet: string); var lContentTypeValues: TArray<string>; begin if not aContentType.IsEmpty then begin lContentTypeValues := aContentType.Split([';']); aContentCharSet := ''; for var I := Low(lContentTypeValues) to High(lContentTypeValues) do begin if lContentTypeValues[I].Trim.StartsWith('charset', True) then begin aContentCharSet := lContentTypeValues[I].Trim.Split(['='])[1].Trim; for var J := I + 1 to High(lContentTypeValues) do lContentTypeValues[J-1] := lContentTypeValues[J]; SetLength(lContentTypeValues, Length(lContentTypeValues) - 1); Break; end; end; aContentMediaType := string.Join(';', lContentTypeValues); end else begin aContentMediaType := ''; aContentCharSet := ''; end; end;
The http specification allows for optional parameters to be added to the Content-Type response header
https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types
The form of the header is
type/subtype;parameter=value
I wish to add a header to a response of "application/fhir+xml; fhirVersion=4.0"
The procedure SplitContentMediaTypeAndCharset which is called by the Render method discards all parameters except for "charset"
A fix would be to split the passed in value by ";", find the charset if any and recombine all other parameters
The text was updated successfully, but these errors were encountered: