aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2017-10-04 09:48:36 -0400
committerGitHub <noreply@github.com>2017-10-04 09:48:36 -0400
commitbd2542b74fe528d95f51d8f3668b0f7d6d8af974 (patch)
tree9a0fbb2d0fe7c978172aede8117401cbf3b48b36 /railties
parentdf2814671cce80fd0d8f290e5a70bf518880d6fa (diff)
parent59a02fb7bcbe68f26e1e7fdcec45c00c66e4a065 (diff)
downloadrails-bd2542b74fe528d95f51d8f3668b0f7d6d8af974.tar.gz
rails-bd2542b74fe528d95f51d8f3668b0f7d6d8af974.tar.bz2
rails-bd2542b74fe528d95f51d8f3668b0f7d6d8af974.zip
Merge pull request #30744 from eileencodes/early-hints
Implement H2 Early Hints for Rails
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/commands/server/server_command.rb8
-rw-r--r--railties/test/commands/server_test.rb12
2 files changed, 19 insertions, 1 deletions
diff --git a/railties/lib/rails/commands/server/server_command.rb b/railties/lib/rails/commands/server/server_command.rb
index 785265d766..5b5037d3de 100644
--- a/railties/lib/rails/commands/server/server_command.rb
+++ b/railties/lib/rails/commands/server/server_command.rb
@@ -127,6 +127,7 @@ module Rails
class_option "dev-caching", aliases: "-C", type: :boolean, default: nil,
desc: "Specifies whether to perform caching in development."
class_option "restart", type: :boolean, default: nil, hide: true
+ class_option "early_hints", type: :boolean, default: nil, desc: "Enables HTTP/2 early hints."
def initialize(args = [], local_options = {}, config = {})
@original_options = local_options
@@ -161,7 +162,8 @@ module Rails
daemonize: options[:daemon],
pid: pid,
caching: options["dev-caching"],
- restart_cmd: restart_command
+ restart_cmd: restart_command,
+ early_hints: early_hints
}
end
end
@@ -227,6 +229,10 @@ module Rails
"bin/rails server #{@server} #{@original_options.join(" ")} --restart"
end
+ def early_hints
+ options[:early_hints]
+ end
+
def pid
File.expand_path(options[:pid])
end
diff --git a/railties/test/commands/server_test.rb b/railties/test/commands/server_test.rb
index 556c2289e7..a6201e4f04 100644
--- a/railties/test/commands/server_test.rb
+++ b/railties/test/commands/server_test.rb
@@ -81,6 +81,18 @@ class Rails::ServerTest < ActiveSupport::TestCase
assert_equal false, options[:caching]
end
+ def test_early_hints_with_option
+ args = ["--early-hints"]
+ options = parse_arguments(args)
+ assert_equal true, options[:early_hints]
+ end
+
+ def test_early_hints_is_nil_by_default
+ args = []
+ options = parse_arguments(args)
+ assert_nil options[:early_hints]
+ end
+
def test_log_stdout
with_rack_env nil do
with_rails_env nil do