Skip to content

Commit

Permalink
Refactor HttpContentImpl to improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
ajkauffmann committed Dec 10, 2024
1 parent 16bdfbe commit 160d87f
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,29 +197,32 @@ codeunit 2355 "Http Content Impl."
Json: Text;
begin
Json := AsText();
if Json <> '' then
if not ReturnValue.ReadFrom(AsText()) then
ThrowInvalidJsonException();
if Json = '' then
exit;
if not ReturnValue.ReadFrom(Json) then
ThrowInvalidJsonException();
end;

procedure AsJsonObject() ReturnValue: JsonObject
var
Json: Text;
begin
Json := AsText();
if Json <> '' then
if not ReturnValue.ReadFrom(AsText()) then
ThrowInvalidJsonException();
if Json = '' then
exit;
if not ReturnValue.ReadFrom(Json) then
ThrowInvalidJsonException();
end;

procedure AsJsonArray() ReturnValue: JsonArray
var
Json: Text;
begin
Json := AsText();
if Json <> '' then
if not ReturnValue.ReadFrom(AsText()) then
ThrowInvalidJsonException();
if Json = '' then
exit;
if not ReturnValue.ReadFrom(Json) then
ThrowInvalidJsonException();
end;

procedure SetContent(Content: Text; ContentType: Text)
Expand Down

0 comments on commit 160d87f

Please sign in to comment.