unpoly-rails 3.9.2.1 → 3.9.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -61,10 +61,15 @@ module Unpoly
61
61
  end
62
62
 
63
63
  define_method "#{method}_from_request_headers" do
64
+ raw_value = send("raw_#{method}_from_request_headers")
65
+ field.parse(raw_value)
66
+ end
67
+
68
+ define_method "raw_#{method}_from_request_headers" do
64
69
  header_name = send("#{method}_request_header_name")
65
70
  raw_value = request.headers[header_name]
66
71
  send("#{method}_request_header_accessed!")
67
- field.parse(raw_value)
72
+ raw_value
68
73
  end
69
74
 
70
75
  define_method "#{method}_param_name" do
@@ -76,29 +81,26 @@ module Unpoly
76
81
  field.stringify(value)
77
82
  end
78
83
 
79
- # define_method "#{name}_from_response_headers" do
80
- # raw_value = response.headers[field.header_name]
81
- # field.parse(raw_value)
82
- # end
84
+ define_method "raw_#{method}_from_params" do
85
+ params[field.param_name]
86
+ end
83
87
 
84
88
  define_method "#{method}_from_params" do
85
- raw_value = params[field.param_name]
89
+ raw_value = send("raw_#{method}_from_params")
86
90
  field.parse(raw_value)
87
91
  end
88
92
 
89
93
  define_method "#{method}_from_request" do
90
- value = send("#{method}_from_request_headers")
91
- if value.nil?
92
- value = send("#{method}_from_params")
93
- end
94
- value
94
+ raw_value = send("raw_#{method}_from_params") || send("raw_#{method}_from_request_headers")
95
+ field.parse(raw_value)
95
96
  end
96
97
 
97
98
  define_method "write_#{method}_to_response_headers" do
98
99
  value = send(method)
99
100
  stringified = field.stringify(value)
101
+
100
102
  if stringified.present? # app servers don't like blank header values
101
- header_name = send("#{method}_response_header_name" )
103
+ header_name = send("#{method}_response_header_name")
102
104
  response.headers[header_name] = stringified
103
105
  end
104
106
  end
@@ -69,7 +69,7 @@ module Unpoly
69
69
  # The target has changed if either:
70
70
  # (1) The #target= setter was called, setting @server_target
71
71
  # (2) An up[target] param was set to preserve a previously changed target through a redirect.
72
- (@server_target && @server_target != target_from_request_headers) || target_from_params
72
+ (@server_target && @server_target != target_from_request_headers) || !!target_from_params
73
73
  end
74
74
 
75
75
  ##
@@ -3,6 +3,6 @@ module Unpoly
3
3
  ##
4
4
  # The current version of the unpoly-rails gem.
5
5
  # The first 3 digits should match the version of the Unpoly frontend code.
6
- VERSION = '3.9.2.1'
6
+ VERSION = '3.9.3.1'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unpoly-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.2.1
4
+ version: 3.9.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-23 00:00:00.000000000 Z
11
+ date: 2024-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties