Class: SpecForge::Forge::Request
- Defined in:
- lib/spec_forge/forge/actions/request.rb
Overview
Action for the request: step attribute
Builds and executes an HTTP request based on the step's configuration, then stores both the request and response in the forge's variables for use by subsequent actions.
Instance Attribute Summary
Attributes inherited from Action
Instance Method Summary collapse
-
#run(forge) ⇒ void
Executes the HTTP request and stores the response.
Methods inherited from Action
Constructor Details
This class inherits a constructor from SpecForge::Forge::Action
Instance Method Details
#run(forge) ⇒ void
This method returns an undefined value.
Executes the HTTP request and stores the response
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/spec_forge/forge/actions/request.rb', line 20 def run(forge) sendable_request, resolved_request = build_requests forge.display.action( "#{sendable_request.http_verb} #{sendable_request.url}", symbol: :right_arrow, symbol_styles: :yellow ) response = forge.http_client.perform(sendable_request) response = parse_response(response) # Only store the original resolved request before we modify it forge.variables[:request] = resolved_request forge.variables[:response] = response end |