Skip to content

Commit

Permalink
Merge pull request #2 from fanoframework/master
Browse files Browse the repository at this point in the history
Refactor JSON content type middleware
  • Loading branch information
zamronypj authored Oct 15, 2022
2 parents 2af6bd5 + 989851a commit ba77b21
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/Middleware/BuiltIns/JsonContentTypeMiddlewareImpl.pas
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ implementation
const args : IRouteArgsReader;
const nextMdlwr : IRequestHandler
) : IResponse;
var jsonRequest : IRequest;
var req : IRequest;
isJsonRequest : boolean;
method : string;
begin
Expand All @@ -63,15 +63,12 @@ implementation

if isJsonRequest then
begin
jsonRequest := TJsonRequest.create(request);
try
result := nextMdlwr.handleRequest(jsonRequest, response, args);
finally
jsonRequest := nil;
end;
end else
req := TJsonRequest.create(request);
end else
begin
result := nextMdlwr.handleRequest(request, response, args);
req := request;
end;

result := nextMdlwr.handleRequest(req, response, args);
end;
end.

0 comments on commit ba77b21

Please sign in to comment.