Skip to content

Commit

Permalink
Ajuste na função do content do motor NetHTTP.
Browse files Browse the repository at this point in the history
Após tentar realizar um POST e uma api me deparei com um erro de “Invalid encoding name”.

Após analise e testes percebi que o problema estava na função Content do motor NetHTTP. Na análise, comparei o retorno dele com o retorno do motor do Indy. Foi nesse momento, que foi percebido que a função content do Indy trata o retorno com a possibilidade do mesmo ser um stream, convertendo-o para string usando TStreamString.DataString,  já o motor NetHTTP não faz tal tratativa, mesmo tendo essa possibilidade. Com isso, foi realizado a alteração do result da função para que o content do NetHTTP tenha o mesmo comportamento do motor Indy.
  • Loading branch information
fabiohmribeiro authored Jun 9, 2023
1 parent 052d003 commit 8513a0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/RESTRequest4D.Response.NetHTTP.pas
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function TResponseNetHTTP.JSONValue: TJSONValue;
function TResponseNetHTTP.Content: string;
begin
if Assigned(FHTTPResponse) then
Result := FHTTPResponse.ContentAsString;
Result := TStringStream(FHTTPResponse.ContentStream).DataString;
end;

function TResponseNetHTTP.ContentEncoding: string;
Expand Down

0 comments on commit 8513a0d

Please sign in to comment.