-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
base: develop
Are you sure you want to change the base?
Add support for other verbs for aggregation. #1389
Conversation
Cherry picked from ThreeMammals#1389
Hi Carl! Could you Sync fork please? So, your develop branch is outdated! |
There was a problem hiding this 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(); |
There was a problem hiding this comment.
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
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()); | ||
} | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
5b5bfb0
to
8596743
Compare
The feature branch has been rebased onto ThreeMammals:develop! I see that develop branch in your fork is too old! |
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()); | ||
} | ||
|
There was a problem hiding this comment.
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
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.