Sha256: 01e4419c353d921c8ea309973722edcc4d150fdc7218bab1c4588fb35e6663d9

Contents?: true

Size: 385 Bytes

Versions: 11

Compression:

Stored size: 385 Bytes

Contents

# frozen_string_literal: true

module Grape
  module DSL
    module Headers
      # Set an individual header or retrieve
      # all headers that have been set.
      def header(key = nil, val = nil)
        if key
          val ? header[key.to_s] = val : header.delete(key.to_s)
        else
          @header ||= {}
        end
      end
      alias headers header
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
grape-1.6.0 lib/grape/dsl/headers.rb
grape-1.5.3 lib/grape/dsl/headers.rb
grape-1.5.2 lib/grape/dsl/headers.rb
grape-1.5.1 lib/grape/dsl/headers.rb
grape-1.5.0 lib/grape/dsl/headers.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.4.0/lib/grape/dsl/headers.rb
grape-1.4.0 lib/grape/dsl/headers.rb
grape-1.3.3 lib/grape/dsl/headers.rb
grape-1.3.2 lib/grape/dsl/headers.rb
grape-1.3.1 lib/grape/dsl/headers.rb
grape-1.3.0 lib/grape/dsl/headers.rb