Commit 907d7499 authored by Stan Hu's avatar Stan Hu

Upgrade to Grape v1.5.1

This fixes a few Ruby 2.7 deprecation warnings and eliminates the need
for the monkey patch in https://github.com/ruby-grape/grape/pull/2088.
parent a09aa50a
......@@ -84,9 +84,7 @@ gem 'gitlab_omniauth-ldap', '~> 2.1.1', require: 'omniauth-ldap'
gem 'net-ldap', '~> 0.16.3'
# API
# 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', '~> 1.5.1'
gem 'grape-entity', '~> 0.7.1'
gem 'rack-cors', '~> 1.0.6', require: 'rack/cors'
......
......@@ -265,21 +265,19 @@ GEM
doorkeeper-openid_connect (1.7.4)
doorkeeper (>= 5.2, < 5.5)
json-jwt (>= 1.11.0)
dry-configurable (0.11.5)
dry-configurable (0.12.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.4, >= 0.4.7)
dry-equalizer (~> 0.2)
dry-core (~> 0.5, >= 0.5.0)
dry-container (0.7.2)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1, >= 0.1.3)
dry-core (0.4.9)
dry-core (0.5.0)
concurrent-ruby (~> 1.0)
dry-equalizer (0.3.0)
dry-inflector (0.2.0)
dry-logic (1.0.6)
dry-logic (1.1.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.2)
dry-equalizer (~> 0.2)
dry-core (~> 0.5, >= 0.5)
dry-types (1.4.0)
concurrent-ruby (~> 1.0)
dry-container (~> 0.3)
......@@ -496,7 +494,7 @@ GEM
signet (~> 0.14)
gpgme (2.0.20)
mini_portile2 (~> 2.3)
grape (1.4.0)
grape (1.5.1)
activesupport
builder
dry-types (>= 1.1)
......@@ -1375,7 +1373,7 @@ DEPENDENCIES
google-api-client (~> 0.33)
google-protobuf (~> 3.12)
gpgme (~> 2.0.19)
grape (= 1.4.0)
grape (~> 1.5.1)
grape-entity (~> 0.7.1)
grape-path-helpers (~> 1.5)
grape_logging (~> 1.7)
......
---
title: Upgrade to Grape v1.5.0
merge_request: 44554
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
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