Sha256: 984bfd5a5a2ae812df520db9933ba921e66c37417a9c9f2300c2d85fb202f4de

Contents?: true

Size: 831 Bytes

Versions: 9

Compression:

Stored size: 831 Bytes

Contents

module Rack
  module OAuth2
    module Server
      module Rails
        module ResponseExt
          def redirect?
            ensure_finish do
              super
            end
          end

          def location
            ensure_finish do
              super
            end
          end

          def json
            ensure_finish do
              @body
            end
          end

          def headers
            ensure_finish do
              @headers
            end
          end

          def finish
            @finished = true
            super
          end

          private

          def finished?
            !!@finished
          end

          def ensure_finish
            @status, @headers, @body = finish unless finished?
            yield
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rack-oauth2-2.2.1 lib/rack/oauth2/server/rails/response_ext.rb
rack-oauth2-2.2.0 lib/rack/oauth2/server/rails/response_ext.rb
rack-oauth2-2.1.0 lib/rack/oauth2/server/rails/response_ext.rb
rack-oauth2-2.0.1 lib/rack/oauth2/server/rails/response_ext.rb
rack-oauth2-2.0.0 lib/rack/oauth2/server/rails/response_ext.rb
rack-oauth2-2.0.0.rc3 lib/rack/oauth2/server/rails/response_ext.rb
rack-oauth2-2.0.0.rc2 lib/rack/oauth2/server/rails/response_ext.rb
rack-oauth2-2.0.0.rc1 lib/rack/oauth2/server/rails/response_ext.rb
rack-oauth2-1.21.3 lib/rack/oauth2/server/rails/response_ext.rb