Skip to content

RequestSizeGatewayFilterFactory added #376

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

Closed
wants to merge 3 commits into from
Closed

RequestSizeGatewayFilterFactory added #376

wants to merge 3 commits into from

Conversation

ninja-panda
Copy link
Contributor

RequestSizeGatewayFilterFactory added. Which can restrict a request from reaching the downstream service , if the size of request is greater than the permissible limit. The filter can be configured in standard way. Following is an example:

And the configuration for the filter is: When it works as a default filter:

spring:
  application:
    name: somename
  cloud:
    gateway:
      default-filters:
      - Hystrix=default
      - RequestSize=7000000

When needs to be applied in some API

# ===========================================
  - id: request_size_route
    uri: ${test.uri}/upload
    predicates:
    - Path=/upload
    filters:
    - name: RequestSize
      args:
        maxSize: 5000000

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@ninja-panda
Copy link
Contributor Author

Hi, Any comment on this

@spencergibb
Copy link
Member

When I get back from holidays next week

Copy link
Member

@spencergibb spencergibb left a comment

Choose a reason for hiding this comment

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

Please add a test.

@@ -17,6 +17,9 @@

package org.springframework.cloud.gateway.config;


import com.netflix.hystrix.HystrixObservableCommand;
Copy link
Member

Choose a reason for hiding this comment

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

Please use our import rules.

* @author Arpan
*/
public class RequestSizeGatewayFilterFactory
extends AbstractGatewayFilterFactory<RequestSizeGatewayFilterFactory.RequestSizeConfig> {
Copy link
Member

Choose a reason for hiding this comment

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

Tabs not spaces

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Take the updated code
@codecov-io
Copy link

Codecov Report

Merging #376 into master will decrease coverage by 2.92%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #376      +/-   ##
==========================================
- Coverage   65.36%   62.43%   -2.93%     
==========================================
  Files           4        8       +4     
  Lines         231      410     +179     
  Branches       17       34      +17     
==========================================
+ Hits          151      256     +105     
- Misses         68      130      +62     
- Partials       12       24      +12
Impacted Files Coverage Δ
.../webflux/config/ProxyExchangeArgumentResolver.java 76.19% <0%> (ø)
.../cloud/gateway/webflux/config/ProxyProperties.java 42.85% <0%> (ø)
...webflux/config/ProxyResponseAutoConfiguration.java 100% <0%> (ø)
...framework/cloud/gateway/webflux/ProxyExchange.java 54.13% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2816605...a2f4da4. Read the comment docs.

@ninja-panda
Copy link
Contributor Author

Created a new pull request with the review comment integrated;
#426

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.

None yet

4 participants