Sha256: 93d99a024d0675e3e4655d6f7a29d4b0ea04ee9f025810c04dcc8689c70d68fa

Contents?: true

Size: 966 Bytes

Versions: 6829

Compression:

Stored size: 966 Bytes

Contents

module Typhoeus
  class Request

    # This module contians the logic for response streaming.
    module Streamable

      # Set on_body callback.
      #
      # This callback will be called each time a portion of the body is read from the socket.
      # Setting an on_body callback will cause the response body to be empty.
      #
      # @example Set on_body.
      #   request.on_body { |body_chunk, response| puts "Got #{body_chunk.bytesize} bytes" }
      #
      # @param [ Block ] block The block to execute.
      #
      # @yield [ Typhoeus::Response, String ]
      #
      # @return [ Array<Block> ] All on_body blocks.
      def on_body(&block)
        @on_body ||= []
        @on_body << block if block_given?
        @on_body
      end

      # Is this request using streaming?
      #
      # @return [ Boolean ] True if any on_body blocks have been set.
      def streaming?
        defined?(@on_body) && @on_body.any?
      end
    end
  end
end

Version data entries

6,829 entries across 6,826 versions & 25 rubygems

Version Path
ory-client-0.0.1.alpha77 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha76 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha75 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha74 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha73 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha72 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha71 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha70 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha69 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha68 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha67 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha66 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-oathkeeper-client-0.38.19.beta1 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-oathkeeper-client-0.38.18.beta1 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-oathkeeper-client-0.38.17.beta1 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
avalara_sdk-2.4.7 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha58 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha57 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha56 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb
ory-client-0.0.1.alpha55 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/request/streamable.rb