Update to linzer 0.7 (#34765)

This commit is contained in:
David Roetzel 2025-05-23 08:43:02 +02:00 committed by GitHub
parent e0ce4b9b6b
commit 3acd87419c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 79 additions and 74 deletions

View 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)