Commit 94e343e3 authored by Stan Hu's avatar Stan Hu Committed by Igor Drozdov

Update to Grape v1.4.0

Grape v1.4.0 fixes a memory leak that was present in v1.3.3
(https://github.com/ruby-grape/grape/pull/2084).

Full list of changes:

* https://github.com/ruby-grape/grape/blob/master/CHANGELOG.md
* https://github.com/ruby-grape/grape/compare/v1.3.3..v1.4.0
parent e948fb1c
...@@ -81,7 +81,9 @@ gem 'gitlab_omniauth-ldap', '~> 2.1.1', require: 'omniauth-ldap' ...@@ -81,7 +81,9 @@ gem 'gitlab_omniauth-ldap', '~> 2.1.1', require: 'omniauth-ldap'
gem 'net-ldap' gem 'net-ldap'
# API # API
gem 'grape', '~> 1.3.3' # Locked at Grape v1.4.0 until https://github.com/ruby-grape/grape/pull/2088 is merged
# Remove config/initializers/grape_patch.rb
gem 'grape', '= 1.4.0'
gem 'grape-entity', '~> 0.7.1' gem 'grape-entity', '~> 0.7.1'
gem 'rack-cors', '~> 1.0.6', require: 'rack/cors' gem 'rack-cors', '~> 1.0.6', require: 'rack/cors'
......
...@@ -453,7 +453,7 @@ GEM ...@@ -453,7 +453,7 @@ GEM
signet (~> 0.14) signet (~> 0.14)
gpgme (2.0.20) gpgme (2.0.20)
mini_portile2 (~> 2.3) mini_portile2 (~> 2.3)
grape (1.3.3) grape (1.4.0)
activesupport activesupport
builder builder
dry-types (>= 1.1) dry-types (>= 1.1)
...@@ -1268,7 +1268,7 @@ DEPENDENCIES ...@@ -1268,7 +1268,7 @@ DEPENDENCIES
google-api-client (~> 0.33) google-api-client (~> 0.33)
google-protobuf (~> 3.8.0) google-protobuf (~> 3.8.0)
gpgme (~> 2.0.19) gpgme (~> 2.0.19)
grape (~> 1.3.3) grape (= 1.4.0)
grape-entity (~> 0.7.1) grape-entity (~> 0.7.1)
grape-path-helpers (~> 1.3) grape-path-helpers (~> 1.3)
grape_logging (~> 1.7) grape_logging (~> 1.7)
......
---
title: Update to Grape v1.4.0
merge_request: 36628
author:
type: fixed
# frozen_string_literal: true
# Monkey patch for Grape v1.4.0: https://github.com/ruby-grape/grape/pull/2088
require 'grape'
# rubocop:disable Gitlab/ModuleWithInstanceVariables
module Grape
module DSL
module InsideRoute
def stream(value = nil)
return if value.nil? && @stream.nil?
header 'Content-Length', nil
header 'Transfer-Encoding', nil
header 'Cache-Control', 'no-cache' # Skips ETag generation (reading the response up front)
if value.is_a?(String)
file_body = Grape::ServeStream::FileBody.new(value)
@stream = Grape::ServeStream::StreamResponse.new(file_body)
elsif value.respond_to?(:each)
@stream = Grape::ServeStream::StreamResponse.new(value)
elsif !value.is_a?(NilClass)
raise ArgumentError, 'Stream object must respond to :each.'
else
@stream
end
end
end
end
end
# rubocop:enable Gitlab/ModuleWithInstanceVariables
...@@ -494,7 +494,7 @@ module API ...@@ -494,7 +494,7 @@ module API
header['X-Sendfile'] = path header['X-Sendfile'] = path
body body
else else
file path sendfile path
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment