File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
actionpack/lib/action_dispatch Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ def #{env.delete_prefix("HTTP_").downcase} # def accept_charset
55
55
METHOD
56
56
end
57
57
58
+ TRANSFER_ENCODING = "HTTP_TRANSFER_ENCODING" # :nodoc:
59
+
58
60
def self . empty
59
61
new ( { } )
60
62
end
@@ -282,7 +284,7 @@ def media_type
282
284
283
285
# Returns the content length of the request as an integer.
284
286
def content_length
285
- return raw_post . bytesize if headers . key? ( "Transfer-Encoding" )
287
+ return raw_post . bytesize if has_header? ( TRANSFER_ENCODING )
286
288
super . to_i
287
289
end
288
290
@@ -467,7 +469,7 @@ def default_session
467
469
468
470
def read_body_stream
469
471
reset_stream ( body_stream ) do
470
- if headers . key? ( "Transfer-Encoding" )
472
+ if has_header? ( TRANSFER_ENCODING )
471
473
body_stream . read # Read body stream until EOF if "Transfer-Encoding" is present
472
474
else
473
475
body_stream . read ( content_length )
Original file line number Diff line number Diff line change @@ -25,11 +25,12 @@ class RequestId
25
25
def initialize ( app , header :)
26
26
@app = app
27
27
@header = header
28
+ @env_header = "HTTP_#{ header . upcase . tr ( "-" , "_" ) } "
28
29
end
29
30
30
31
def call ( env )
31
32
req = ActionDispatch ::Request . new env
32
- req . request_id = make_request_id ( req . headers [ @header ] )
33
+ req . request_id = make_request_id ( req . get_header ( @env_header ) )
33
34
@app . call ( env ) . tap { |_status , headers , _body | headers [ @header ] = req . request_id }
34
35
end
35
36
You can’t perform that action at this time.
0 commit comments