Sha256: 2df1d0a3d5b71f27036976209b97b6b6fb6ab18d2a749d2bdc203f8f82538a09

Contents?: true

Size: 383 Bytes

Versions: 3

Compression:

Stored size: 383 Bytes

Contents

# frozen_string_literal: true

module SimpleHelper
  module HeadersProcessor
    attr_reader :headers

    def self.perform(headers)
      return {} if headers.nil? || !headers.respond_to?(:to_hash)

      @headers = headers.stringify_keys!

      return @headers unless @headers['Content-Type'].nil?

      { 'Content-Type' => 'application/json' }.merge(@headers)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_request-0.1.5 lib/simple_helper/headers_processor.rb
simple_request-0.1.4 lib/simple_helper/headers_processor.rb
simple_request-0.1.3 lib/simple_helper/headers_processor.rb