Sha256: c4eb09a088b542f141c96fd6c9d880119cef72bdf64892d62d55401a501762c6
Contents?: true
Size: 959 Bytes
Versions: 4
Compression:
Stored size: 959 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' describe Rack::Sendfile do subject do send_file = file_streamer app = Class.new(Grape::API) do use Rack::Sendfile format :json get do file send_file end end options = { method: 'GET', 'HTTP_X_SENDFILE_TYPE' => 'X-Accel-Redirect', 'HTTP_X_ACCEL_MAPPING' => '/accel/mapping/=/replaced/' } env = Rack::MockRequest.env_for('/', options) app.call(env) end context do let(:file_streamer) do double(:file_streamer, to_path: '/accel/mapping/some/path') end it 'contains Sendfile headers' do headers = subject[1] expect(headers).to include('X-Accel-Redirect') end end context do let(:file_streamer) do double(:file_streamer) end it 'not contains Sendfile headers' do headers = subject[1] expect(headers).to_not include('X-Accel-Redirect') end end end
Version data entries
4 entries across 4 versions & 1 rubygems