Class: Gitlab::Octokit::ResponseValidation
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Gitlab::Octokit::ResponseValidation
- Defined in:
- lib/gitlab/octokit/response_validation.rb
Constant Summary collapse
- ResponseSizeTooLarge =
Class.new(StandardError)
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/gitlab/octokit/response_validation.rb', line 8 def on_complete(env) return if env.url.host == "api.github.com" body = env.response.body return if body.empty? if (max_allowed_bytes != 0 && body.bytesize > max_allowed_bytes) || (max_allowed_values != 0 && total_value_count_estimate(body) > max_allowed_values) raise ResponseSizeTooLarge end end |