Update to linzer 0.7 (#34765)
This commit is contained in:
parent
e0ce4b9b6b
commit
3acd87419c
6 changed files with 79 additions and 74 deletions
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)
|
Loading…
Add table
Add a link
Reference in a new issue