Update to linzer 0.7 (#34765)
This commit is contained in:
		
							
								
								
									
										32
									
								
								config/initializers/linzer.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								config/initializers/linzer.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require 'linzer/http/signature_feature'
 | 
			
		||||
require 'linzer/message/adapter/http_gem/response'
 | 
			
		||||
 | 
			
		||||
module Linzer::Message::Adapter
 | 
			
		||||
  module ActionDispatch
 | 
			
		||||
    class Response < Linzer::Message::Adapter::Abstract
 | 
			
		||||
      def initialize(operation, **_options) # rubocop:disable Lint/MissingSuper
 | 
			
		||||
        @operation = operation
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def header(name)
 | 
			
		||||
        @operation.headers[name]
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def attach!(signature)
 | 
			
		||||
        signature.to_h.each { |h, v| @operation.headers[h] = v }
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      # Incomplete, but sufficient for FASP
 | 
			
		||||
      def [](field_name)
 | 
			
		||||
        return @operation.status if field_name == '@status'
 | 
			
		||||
 | 
			
		||||
        @operation.headers[field_name]
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
Linzer::Message.register_adapter(HTTP::Response, Linzer::Message::Adapter::HTTPGem::Response)
 | 
			
		||||
Linzer::Message.register_adapter(ActionDispatch::Response, Linzer::Message::Adapter::ActionDispatch::Response)
 | 
			
		||||
		Reference in New Issue
	
	Block a user