Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for other verbs for aggregation. #1389

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

crb02005
Copy link

@crb02005 crb02005 commented Dec 7, 2020

This changes the FileAggregateRoute to allow other verbs.
It is for consumers not following traditional REST. Several APIs do not follow the REST guidelines and may use POST for getting data. In cases like these being able to specify a verb is helpful.

stefancruz added a commit to stefancruz/Ocelot that referenced this pull request Dec 23, 2022
@raman-m
Copy link
Member

raman-m commented Jul 15, 2023

Hi Carl!
Thanks for your interest in Ocelot!

Could you Sync fork please? So, your develop branch is outdated!

@raman-m raman-m self-requested a review July 15, 2023 10:51
@raman-m raman-m added proposal Proposal for a new functionality in Ocelot needs feedback Issue is waiting on feedback before acceptance labels Jul 15, 2023
Copy link
Member

@raman-m raman-m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything is OK.
But we have to write a few acceptance tests which will cover added logic.

Could you write at least one acceptance test please?

// Only supports GET..are you crazy!! POST, PUT WOULD BE CRAZY!! :)
public List<string> UpstreamHttpMethod => new() { "Get" };

public List<string> UpstreamHttpMethod { get; private set; } = new();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private set means you can assign the value by constructor only.
In this case default constructor creates the list.
No much sense to make setter private:

  • another properties have public setter
  • we can unit test this property

Comment on lines 26 to +33
private Route SetUpAggregateRoute(IEnumerable<Route> routes, FileAggregateRoute aggregateRoute, FileGlobalConfiguration globalConfiguration)
{
if (!aggregateRoute.UpstreamHttpMethod.Any())
{
// Default method to Get for standard use case
aggregateRoute.UpstreamHttpMethod.Add(HttpMethod.Get.ToString());
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to unit test this code.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HttpMethod.Get.ToString() should be a static field of class

@raman-m raman-m force-pushed the user/carl-aggregate-methods branch from 5b5bfb0 to 8596743 Compare August 22, 2023 12:02
@raman-m
Copy link
Member

raman-m commented Aug 22, 2023

The feature branch has been rebased onto ThreeMammals:develop!
Welcome to code review!


I see that develop branch in your fork is too old!
Could you Sync fork please? So, develop branch will be updated with top commits!
Could you add me as collaborator to your forked repo please?

Comment on lines 26 to +33
private Route SetUpAggregateRoute(IEnumerable<Route> routes, FileAggregateRoute aggregateRoute, FileGlobalConfiguration globalConfiguration)
{
if (!aggregateRoute.UpstreamHttpMethod.Any())
{
// Default method to Get for standard use case
aggregateRoute.UpstreamHttpMethod.Add(HttpMethod.Get.ToString());
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HttpMethod.Get.ToString() should be a static field of class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs feedback Issue is waiting on feedback before acceptance proposal Proposal for a new functionality in Ocelot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants