Sha256: 4a40671d75ebb03679abbc371b1cec1e7542f23db5db2128ab37fff37a354b6b

Contents?: true

Size: 399 Bytes

Versions: 19

Compression:

Stored size: 399 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

19 entries across 19 versions & 1 rubygems

Version Path
finapps_core-2.0.20 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.19 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.18 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.17 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.16 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.15 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.14 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.13 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.12 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.11 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.10 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.9 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.8 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.7 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.6 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.5 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.4 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.3 lib/finapps_core/middleware/request/accept_json.rb
finapps_core-2.0.2 lib/finapps_core/middleware/request/accept_json.rb