Skip to content

Commit

Permalink
Correction in encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosHe committed Dec 22, 2020
1 parent 9e907b9 commit 0dbb820
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Horse.Jhonson.pas
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ procedure Middleware(Req: THorseRequest; Res: THorseResponse; Next: {$IF DEFINED

if Assigned(LContent) and LContent.InheritsFrom({$IF DEFINED(FPC)}TJsonData{$ELSE}TJSONValue{$ENDIF}) then
begin
LWebResponse.Content := {$IF DEFINED(FPC)}TJsonData(LContent).AsJSON {$ELSE}{$IF CompilerVersion > 27.0}TJSONValue(LContent).ToJSON{$ELSE}TJSONValue(LContent).ToString{$ENDIF}{$ENDIF};
{$IF DEFINED(FPC)}
LWebResponse.ContentStream := TStringStream.Create(TJsonData(LContent).AsJSON);
{$ELSE}
LWebResponse.Content := {$IF CompilerVersion > 27.0}TJSONValue(LContent).ToJSON{$ELSE}TJSONValue(LContent).ToString{$ENDIF};
{$ENDIF}
LWebResponse.ContentType := 'application/json; charset=' + Charset;
end;
end;
Expand Down

0 comments on commit 0dbb820

Please sign in to comment.