Module: Arachni::Element::Capabilities::Refreshable
Instance Method Summary collapse
-
#refresh(http_opts = {}, &block) ⇒ Form
Refreshes the form’s inputs and re-applies user updates.
Instance Method Details
#refresh(http_opts = {}, &block) ⇒ Form
Refreshes the form’s inputs and re-applies user updates.
The way it works is by requesting the Base#url, parsing the response and updating the form with the fresh form’s inputs.
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/arachni/element/capabilities/refreshable.rb', line 33 def refresh( http_opts = {}, &block ) updated = nil http.get( url.to_s, http_opts.merge( async: !!block ) ) do |res| # find ourselves f = self.class.from_response( res ).select { |f| f.id == id_from( :original ) }.first # get user updates updates = changes # update the form's inputs with the fresh ones and re-apply the user changes updated = update( f.auditable ).update( updates ) block.call( updated ) if block_given? end updated end |