File tree Expand file tree Collapse file tree 5 files changed +22
-3
lines changed
Expand file tree Collapse file tree 5 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 3131 with :
3232 chrome-version : stable
3333
34+ - name : Fix GA Chrome Permissions
35+ run : |
36+ sudo chown root:root /opt/hostedtoolcache/setup-chrome/chromium/stable/x64/chrome-sandbox
37+ sudo chmod 4755 /opt/hostedtoolcache/setup-chrome/chromium/stable/x64/chrome-sandbox
38+
3439 - name : Run tests
3540 run : |
3641 mkdir -p /tmp/ferrum
Original file line number Diff line number Diff line change 22
33### Added
44
5+ ` Ferrum::Network::Request#headers ` are enhanced and supplemented with ` Network.requestWillBeSentExtraInfo ` [ #506 ]
6+
57### Changed
68
79### Fixed
Original file line number Diff line number Diff line change @@ -380,16 +380,24 @@ def subscribe_request_will_be_sent
380380
381381 # We can build exchange in two places, here on the event or when request
382382 # is interrupted. So we have to be careful when to create new one. We
383- # create new exchange only if there's no with such id or there's but
383+ # create new exchange only if there's no with such id or there's, but
384384 # it's filled with request which means this one is new but has response
385385 # for a redirect. So we assign response from the params to previous
386386 # exchange and build new exchange to assign this request to it.
387387 exchange = select ( request . id ) . last
388- exchange = build_exchange ( request . id ) unless exchange &.blank?
388+ exchange = build_exchange ( request . id ) if exchange . nil? || !exchange . blank?
389+ request . headers . merge! ( Hash ( exchange . request_extra_info &.dig ( "headers" ) ) )
389390 exchange . request = request
390391
391392 @exchange = exchange if exchange . navigation_request? ( @page . main_frame . id )
392393 end
394+
395+ @page . on ( "Network.requestWillBeSentExtraInfo" ) do |params |
396+ exchange = select ( params [ "requestId" ] ) . last
397+ exchange ||= build_exchange ( params [ "requestId" ] )
398+ exchange . request_extra_info = params
399+ exchange . request &.headers &.merge! ( params [ "headers" ] )
400+ end
393401 end
394402
395403 def subscribe_response_received
Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ class Exchange
2828 # @return [Error, nil]
2929 attr_accessor :error
3030
31+ # @api private
32+ attr_accessor :request_extra_info
33+
3134 #
3235 # Initializes the network exchange.
3336 #
@@ -40,6 +43,7 @@ def initialize(page, id)
4043 @page = page
4144 @intercepted_request = nil
4245 @request = @response = @error = nil
46+ @request_extra_info = nil
4347 end
4448
4549 #
Original file line number Diff line number Diff line change 4646 end
4747
4848 config . after ( :all ) do
49- @browser . quit
49+ @browser & .quit
5050 end
5151
5252 config . before ( :each ) do
You can’t perform that action at this time.
0 commit comments