From c8a6c81fd428497df91d204cae36ad900622ff77 Mon Sep 17 00:00:00 2001 From: tanuki Date: Thu, 7 May 2026 18:10:42 +0200 Subject: [PATCH 1/2] added a second argument --- lib/rage/controller/api.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rage/controller/api.rb b/lib/rage/controller/api.rb index 213c67c3..242b1e8f 100644 --- a/lib/rage/controller/api.rb +++ b/lib/rage/controller/api.rb @@ -555,7 +555,7 @@ def render(json: nil, plain: nil, sse: nil, status: nil) # head :unauthorized # @example # head 429 - def head(status) + def head(status, options = nil) @__rendered = true @__status = if status.is_a?(Symbol) From 386e08c1fef0358c002d23e9b9434ac8e9e6e8b0 Mon Sep 17 00:00:00 2001 From: tanuki Date: Thu, 21 May 2026 01:51:15 +0200 Subject: [PATCH 2/2] pass options to headers --- lib/rage/controller/api.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/rage/controller/api.rb b/lib/rage/controller/api.rb index 242b1e8f..f82325e3 100644 --- a/lib/rage/controller/api.rb +++ b/lib/rage/controller/api.rb @@ -551,6 +551,7 @@ def render(json: nil, plain: nil, sse: nil, status: nil) # Send a response with no body. # # @param status [Integer, Symbol] set a response status + # @param options [Symbol] pass extra options to the response headers # @example # head :unauthorized # @example @@ -558,6 +559,12 @@ def render(json: nil, plain: nil, sse: nil, status: nil) def head(status, options = nil) @__rendered = true + if options + options.each do |key, value| + @__headers[key] = value.to_s + end + end + @__status = if status.is_a?(Symbol) ::Rack::Utils::SYMBOL_TO_STATUS_CODE[status] else