Sha256: c08c65dbe16b04a1a5e4b6df2caaa55a359bbffda3a6328240a9a02d36d72656

Contents?: true

Size: 406 Bytes

Versions: 11

Compression:

Stored size: 406 Bytes

Contents

# frozen_string_literal: true

module FinAppsCore
  module Middleware
    # This middleware sets the Accept request-header field to specify JSON
    # as acceptable media type for the response.
    class AcceptJson < Faraday::Middleware
      KEY = 'Accept' unless defined? KEY

      def call(env)
        env[:request_headers][KEY] = 'application/json'
        @app.call(env)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
finapps_core-6.0.2 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-6.0.1 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-6.0.0 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-5.0.16 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-5.0.15 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-5.0.14 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-5.0.13 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-5.0.11 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-5.0.10 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-5.0.9 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-5.0.8 lib/finapps_core/middleware/request/accept_json.rb