Skip to content

Commit

Permalink
(#14) nuar: has transoformation method check udpated [pack-all-force]
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintAngeLs committed Sep 29, 2024
1 parent 0437681 commit 98aec01
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Nuar/src/Nuar/Requests/PayloadTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,26 @@ public PayloadTransformer(NuarOptions options, IPayloadManager payloadManager, I

public bool HasTransformations(string resourceId, Route route)
{
// Check if resourceId is not null or empty
if (!string.IsNullOrWhiteSpace(resourceId))
{
return true;
}

if (route.Bind.Any())
// Check if 'Bind' collection in the route is not null or has any elements
if (route.Bind != null && route.Bind.Any())
{
return true;
}

return route.Transform.Any() || _payloads.ContainsKey(GetPayloadKey(route));
// Check if 'Transform' collection in the route is not null or has any elements
if (route.Transform != null && route.Transform.Any())
{
return true;
}

// Check if payloads dictionary contains the key for the route
return _payloads.ContainsKey(GetPayloadKey(route));
}

public PayloadSchema Transform(string payload, string resourceId, Route route, HttpRequest request, RouteData data)
Expand Down

0 comments on commit 98aec01

Please sign in to comment.