Skip to content

Commit 9f675e0

Browse files
committed
Update linzer
1 parent 6248dbc commit 9f675e0

File tree

5 files changed

+30
-34
lines changed

5 files changed

+30
-34
lines changed

fasp_base/Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ PATH
44
fasp_base (0.1.0)
55
bcrypt
66
httpx
7-
linzer (>= 0.7.2)
7+
linzer (>= 0.7.7)
88
openssl
99
rails (>= 8.0.0)
1010

@@ -121,7 +121,7 @@ GEM
121121
json (2.12.1)
122122
language_server-protocol (3.17.0.5)
123123
lint_roller (1.1.0)
124-
linzer (0.7.3)
124+
linzer (0.7.7)
125125
cgi (~> 0.4.2)
126126
forwardable (~> 1.3, >= 1.3.3)
127127
logger (~> 1.7, >= 1.7.0)
@@ -196,7 +196,7 @@ GEM
196196
puma (6.6.0)
197197
nio4r (~> 2.0)
198198
racc (1.8.1)
199-
rack (3.1.15)
199+
rack (3.1.16)
200200
rack-session (2.1.1)
201201
base64 (>= 0.1.0)
202202
rack (>= 3.0.0)

fasp_base/fasp_base.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
2020
spec.add_dependency "rails", ">= 8.0.0"
2121
spec.add_dependency "bcrypt"
2222
spec.add_dependency "httpx"
23-
spec.add_dependency "linzer", ">= 0.7.2"
23+
spec.add_dependency "linzer", ">= 0.7.7"
2424
spec.add_dependency "openssl"
2525

2626
spec.add_development_dependency "webmock"

fasp_base/lib/fasp_base/linzer/adapter/action_dispatch/response.rb

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,11 @@ module FaspBase
22
module Linzer
33
module Adapter
44
module ActionDispatch
5-
class Response < ::Linzer::Message::Adapter::Abstract
6-
def initialize(operation, **_options) # rubocop:disable Lint/MissingSuper
7-
@operation = operation
8-
end
9-
10-
def header(name)
11-
@operation.headers[name]
12-
end
13-
14-
def attach!(signature)
15-
signature.to_h.each { |h, v| @operation.headers[h] = v }
16-
end
17-
5+
class Response < ::Linzer::Message::Adapter::Generic::Response
6+
private
187
# Incomplete, but sufficient for FASP
19-
def [](field_name)
20-
return @operation.status if field_name == "@status"
21-
22-
@operation.headers[field_name]
8+
def derived(name)
9+
@operation.status if name.value == "@status"
2310
end
2411
end
2512
end

fasp_base/lib/fasp_base/linzer/adapter/httpx/request.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module FaspBase
22
module Linzer
33
module Adapter
44
module HTTPX
5-
class Request < ::Linzer::Message::Adapter::Abstract
5+
class Request < ::Linzer::Message::Adapter::Generic::Request
66
def initialize(operation, **options)
77
@operation = operation
88
end
@@ -20,14 +20,14 @@ def attach!(signature)
2020

2121
def derived(name)
2222
case name.value
23-
when :method then @operation.verb
24-
when :"target-uri" then @operation.uri.to_s
25-
when :authority then @operation.authority
26-
when :scheme then @operation.scheme
27-
when :"request-target" then @operation.uri.request_uri
28-
when :path then @operation.path
29-
when :query then "?%s" % String(@operation.query)
30-
when :"query-param" then query_param(name)
23+
when "@method" then @operation.verb
24+
when "@target-uri" then @operation.uri.to_s
25+
when "@authority" then @operation.authority
26+
when "@scheme" then @operation.scheme
27+
when "@request-target" then @operation.uri.request_uri
28+
when "@path" then @operation.path
29+
when "@query" then "?%s" % String(@operation.query)
30+
when "@query-param" then query_param(name)
3131
end
3232
end
3333

fasp_base/lib/fasp_base/linzer/adapter/httpx/response.rb

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module FaspBase
22
module Linzer
33
module Adapter
44
module HTTPX
5-
class Response < ::Linzer::Message::Adapter::Abstract
5+
class Response < ::Linzer::Message::Adapter::Generic::Response
66
def initialize(operation, **options)
77
@operation = operation
88
end
@@ -16,9 +16,18 @@ def attach!(signature)
1616
@operation
1717
end
1818

19-
def [](field_name)
20-
return @operation.status if field_name == "@status"
21-
@operation.headers[field_name]
19+
private
20+
21+
def derived(name)
22+
@operation.status if name.value == "@status"
23+
end
24+
25+
def field(name)
26+
has_tr = name.parameters["tr"]
27+
return nil if has_tr
28+
29+
value = @operation.headers[name.value.to_s]
30+
value.dup&.strip
2231
end
2332
end
2433
end

0 commit comments

Comments
 (0)