mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #31815 from composerinteralia/make-request-id
Allow @ in X-Request-Id header
This commit is contained in:
commit
8ef0751b12
2 changed files with 6 additions and 1 deletions
|
@ -30,7 +30,7 @@ module ActionDispatch
|
|||
private
|
||||
def make_request_id(request_id)
|
||||
if request_id.presence
|
||||
request_id.gsub(/[^\w\-]/, "".freeze).first(255)
|
||||
request_id.gsub(/[^\w\-@]/, "".freeze).first(255)
|
||||
else
|
||||
internal_request_id
|
||||
end
|
||||
|
|
|
@ -11,6 +11,11 @@ class RequestIdTest < ActiveSupport::TestCase
|
|||
assert_equal "X-Hacked-HeaderStuff", stub_request("HTTP_X_REQUEST_ID" => "; X-Hacked-Header: Stuff").request_id
|
||||
end
|
||||
|
||||
test "accept Apache mod_unique_id format" do
|
||||
mod_unique_id = "abcxyz@ABCXYZ-0123456789"
|
||||
assert_equal mod_unique_id, stub_request("HTTP_X_REQUEST_ID" => mod_unique_id).request_id
|
||||
end
|
||||
|
||||
test "ensure that 255 char limit on the request id is being enforced" do
|
||||
assert_equal "X" * 255, stub_request("HTTP_X_REQUEST_ID" => "X" * 500).request_id
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue