Skip to content

Conversation

sourabhgomebs
Copy link

No description provided.

@@ -407,7 +407,17 @@ public Reply<?> addResponseFilter(@Named("port") int port, Request<String> reque
String script = getEntityBodyFromRequest(request);
requestResponseFilter.setResponseFilterScript(script);

proxy.addResponseFilter(requestResponseFilter);
String bufferSize = request.param("bufferSize");
if (bufferSize != null && !bufferSize.isEmpty()) {

Choose a reason for hiding this comment

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

Return early instead of conditional checks, and writing repeated code.

Copy link
Author

Choose a reason for hiding this comment

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

Can't return early, because we need to perform some actions depending on this condition.

*/
@Override
public void addResponseFilterWithCustomBufferSize(ResponseFilter filter, int bufferSize) {
addLastHttpFilterFactory(new ResponseFilterAdapter.FilterSource(filter, bufferSize));

Choose a reason for hiding this comment

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

What's difference between addLast or addFirst ?

Copy link
Author

Choose a reason for hiding this comment

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

For modifying request we use addFirstHttpFilterFactory and for modifying response we used addLastHttpFilterFactory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants