diff --git a/lib/rage/controller/api.rb b/lib/rage/controller/api.rb index 213c67c3..f82325e3 100644 --- a/lib/rage/controller/api.rb +++ b/lib/rage/controller/api.rb @@ -551,13 +551,20 @@ 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 # head 429 - def head(status) + 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